1 Star 0 Fork 27

王磊/ZeroTierOne

forked from opopop880/ZeroTierOne 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
zerotier-cli-completion.bash 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Travis LaDuke 提交于 2019-09-27 14:50 . Create a bash completion script.
#compdef zerotier-cli
#autoload
_get_network_ids ()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
COMPREPLY=($(compgen -W "$(ls -1 /Library/Application\ Support/ZeroTier/One/networks.d | cut -c 1-16)" -- ${cur}))
else
COMPREPLY=($(compgen -W "$(ls -1 /var/lib/zerotier-one/networks.d | cut -c 1-16)" -- ${cur}))
fi
}
_get_network_ids_from_history ()
{
COMPREPLY=($(compgen -W "$(fc -l -1000 -1 | sed -n 's/.*\([[:xdigit:]]\{16\}\).*/\1/p')" -- ${cur}))
}
_zerotier-cli_completions()
{
local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -W "info listpeers peers listnetworks join leave set get listmoons orbit deorbit" -- ${cur}))
;;
2)
case ${prev} in
leave)
_get_network_ids
;;
join)
_get_network_ids_from_history
;;
set)
_get_network_ids
;;
get)
_get_network_ids
;;
*)
COMPREPLY=()
;;
esac
;;
*)
COMPREPLY=()
;;
esac
}
complete -F _zerotier-cli_completions zerotier-cli
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanglei900510/ZeroTierOne.git
git@gitee.com:wanglei900510/ZeroTierOne.git
wanglei900510
ZeroTierOne
ZeroTierOne
master

搜索帮助