12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #compdef weechat-curses
- local state ret=-1
- _arguments -s -C \
- '(-a --no-connect)'{-a,--no-connect}'[disable auto-connect to servers at startup]' \
- '(-c --config)'{-c,--config}'[display config file options]' \
- '(-d --dir)'{-d,--dir}'[set WeeChat home directory (default: ~/.weechat)]:dir:_dir_list' \
- '(-f --key-functions)'{-f,--key-functions}'[display WeeChat internal functions for keys]' \
- '(-h --help)'{-h,--help}'[display help and usage]' \
- '(-i --irc-commands)'{-i,--irc-commands}'[display IRC commands]' \
- '(-k --keys)'{-k,--keys}'[display WeeChat default keys]' \
- '(-l --license)'{-l,--license}'[display WeeChat license]' \
- '(-p --no-plugin)'{-p,--no-plugin}"[don't load any plugin at startup]" \
- '(-v --version)'{-v,--version}'[display WeeChat version]' \
- '(-w --weechat-commands)'{-w,--weechat-commands}'[display WeeChat commands]' \
- '1:url:->weeurl' \
- '*::arguments _normal' \
- && ret=0
- if [ "$state" = 'weeurl' ]; then
- urls=( irc:// ircs:// irc6:// irc6s:// )
- nicks=( $(grep server_nick ~/.weechat/weechat.rc | tr -d '"' | cut -d ' ' -f3 | tr '\n' ' ') )
- nicks+=('undef')
-
- pass=( $(grep server_password ~/.weechat/weechat.rc | tr -d '"' | cut -d ' ' -f3 | tr '\n' ' ') )
- pass+=('undef')
-
- servers=( $(grep server_address ~/.weechat/weechat.rc | tr -d '"' | cut -d ' ' -f3 | tr '\n' ' ') )
- servers+=('undef')
-
- set -a weeconf
-
- weeconf=()
- for u in $urls ; do
- for n in $nicks ; do
- for p in $pass; do
- for s in $servers; do
- value=$u
- if [ "$n" != 'undef' ]; then
- if [ "$p" != 'undef' ]; then
- value="${value}${n}:${p}"
- else
- value="${value}${n}"
- fi
- if [ "$s" != 'undef' ]; then
- value="${value}@${s}"
- fi
- else
- if [ "$s" != 'undef' ]; then
- value="${value}${s}"
- fi
- fi
- weeconf+=( $value )
- done
- done
- done
- done
-
- _wanted weeconf expl weeconf compadd $weeconf
-
- fi
- return ret
|