fix completions

This commit is contained in:
arcan1s 2014-07-17 23:40:25 +04:00
parent 31f52e5d22
commit 75a95661f8
2 changed files with 46 additions and 44 deletions

View File

@ -44,23 +44,22 @@ _netctl_gui_arglist=(
) )
_netctl_gui_settings=( _netctl_gui_settings=(
'CTRL_DIR=' 'CTRL_DIR'
'CTRL_GROUP=' 'CTRL_GROUP'
'IFACE_DIR=' 'IFACE_DIR'
'LANGUAGE=' 'LANGUAGE'
'NETCTLAUTO_PATH=' 'NETCTLAUTO_PATH'
'NETCTLAUTO_SERVICE=' 'NETCTLAUTO_SERVICE'
'NETCTL_PATH=' 'NETCTL_PATH'
'PID_FILE=' 'PID_FILE'
'PREFERED_IFACE=' 'PREFERED_IFACE'
'PROFILE_DIR=' 'PROFILE_DIR'
'RFKILL_DIR=' 'RFKILL_DIR'
'SUDO_PATH=' 'SUDO_PATH'
'SYSTEMCTL_PATH=' 'SYSTEMCTL_PATH'
'WPAACTIOND_PATH=' 'WPACLI_PATH'
'WPACLI_PATH=' 'WPASUP_PATH'
'WPASUP_PATH=' 'WPA_DRIVERS'
'WPA_DRIVERS='
) )
_netctl_gui_tabs=( _netctl_gui_tabs=(
@ -78,6 +77,7 @@ _netctl_gui() {
wantfiles='-@(c|-config)' wantfiles='-@(c|-config)'
wantprofiles='-@(o|-open|s|-select)' wantprofiles='-@(o|-open|s|-select)'
wantsettings='-@(-set-opts)' wantsettings='-@(-set-opts)'
wantstring='-@(e|-essid)'
wanttabs='-@(t|-tab)' wanttabs='-@(t|-tab)'
_get_comp_words_by_ref cur prev _get_comp_words_by_ref cur prev
@ -87,6 +87,8 @@ _netctl_gui() {
COMPREPLY=($(compgen -W '${_netctl_profiles[@]}' -- "$cur")) COMPREPLY=($(compgen -W '${_netctl_profiles[@]}' -- "$cur"))
elif [[ $prev = $wantsettings ]]; then elif [[ $prev = $wantsettings ]]; then
COMPREPLY=($(compgen -S ',' -W '${_netctl_gui_settings[@]}' -- "$cur")) COMPREPLY=($(compgen -S ',' -W '${_netctl_gui_settings[@]}' -- "$cur"))
elif [[ $prev = $wantstring ]]; then
COMPREPLY=()
elif [[ $prev = $wanttabs ]]; then elif [[ $prev = $wanttabs ]]; then
COMPREPLY=($(compgen -W '${_netctl_gui_tabs[@]}' -- "$cur")) COMPREPLY=($(compgen -W '${_netctl_gui_tabs[@]}' -- "$cur"))
else else

View File

@ -22,37 +22,36 @@ _netctl_gui_arglist=(
{'--about','--about'}'[show about window]' {'--about','--about'}'[show about window]'
{'--netctl-auto','--netctl-auto'}'[show netctl-auto window]' {'--netctl-auto','--netctl-auto'}'[show netctl-auto window]'
{'--settings','--settings'}'[show settings window]' {'--settings','--settings'}'[show settings window]'
{'(--essid)-e','(-e)--essid'}'[select ESSID]:essid:->essid' {'(--essid)-e','(-e)--essid'}'[select ESSID]:type ESSID:->essid'
{'(--open)-o','(-o)--open'}'[open profile]:filename:->profiles' {'(--open)-o','(-o)--open'}'[open profile]:select profile:->profiles'
{'(--select)-s','(-s)--select'}'[select profile]:filename:->profiles' {'(--select)-s','(-s)--select'}'[select profile]:select profile:->profiles'
{'(--config)-c','(-c)--config'}'[read configuration from this file]:filename:->files' {'(--config)-c','(-c)--config'}'[read configuration from this file]:select file:->files'
{'(--debug)-d','(-d)--debug'}'[print debug information]' {'(--debug)-d','(-d)--debug'}'[print debug information]'
{'--default','--default'}'[start with default settings]' {'--default','--default'}'[start with default settings]'
{'--set-opts','--set-opts'}'[set options for this run, comma separated]:settings:->settings' {'--set-opts','--set-opts'}'[set options for this run, comma separated]:comma separated:->settings'
{'(--tab)-t','(-t)--tab'}'[open a tab with specified number]:tab:->tab' {'(--tab)-t','(-t)--tab'}'[open a tab with specified number]:select tab:->tab'
{'(--version)-v','(-v)--version'}'[show version and exit]' {'(--version)-v','(-v)--version'}'[show version and exit]'
{'(--info)-i','(-i)--info'}'[show build information and exit]' {'(--info)-i','(-i)--info'}'[show build information and exit]'
{'(--help)-h','(-h)--help'}'[show help and exit]' {'(--help)-h','(-h)--help'}'[show help and exit]'
) )
_netctl_gui_settings=( _netctl_gui_settings=(
'CTRL_DIR=' 'CTRL_DIR'
'CTRL_GROUP=' 'CTRL_GROUP'
'IFACE_DIR=' 'IFACE_DIR'
'LANGUAGE=' 'LANGUAGE'
'NETCTLAUTO_PATH=' 'NETCTLAUTO_PATH'
'NETCTLAUTO_SERVICE=' 'NETCTLAUTO_SERVICE'
'NETCTL_PATH=' 'NETCTL_PATH'
'PID_FILE=' 'PID_FILE'
'PREFERED_IFACE=' 'PREFERED_IFACE'
'PROFILE_DIR=' 'PROFILE_DIR'
'RFKILL_DIR=' 'RFKILL_DIR'
'SUDO_PATH=' 'SUDO_PATH'
'SYSTEMCTL_PATH=' 'SYSTEMCTL_PATH'
'WPAACTIOND_PATH=' 'WPACLI_PATH'
'WPACLI_PATH=' 'WPASUP_PATH'
'WPASUP_PATH=' 'WPA_DRIVERS'
'WPA_DRIVERS='
) )
_netctl_gui_tabs=( _netctl_gui_tabs=(
@ -61,7 +60,9 @@ _netctl_gui_tabs=(
'3' '3'
) )
_netctl_profiles=($(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")) _netctl_profiles() {
print $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
}
# work block # work block
@ -69,16 +70,15 @@ _netctl-gui() {
_arguments $_netctl_gui_arglist _arguments $_netctl_gui_arglist
case "$state" in case "$state" in
essid) essid)
_message "netctl"
;; ;;
files) files)
_files _files
;; ;;
profiles) profiles)
_values 'profiles' $_netctl_profiles _values 'profiles' $(_netctl_profiles)
;; ;;
settings) settings)
_values -s , 'settings' $_netctl_gui_settings _values -s ',' 'settings' $_netctl_gui_settings
;; ;;
tab) tab)
_values 'tab' $_netctl_gui_tabs _values 'tab' $_netctl_gui_tabs