From 9dc573c260d1a413e9c0c1a02464f835772d0416 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 18 Jun 2011 19:24:41 +0000 Subject: Michel Dos Reis: 29482: handle .gz kernel modules --- Completion/Linux/Command/_modutils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Completion/Linux') diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index b3f8fcd46..e2671f2a7 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -107,7 +107,7 @@ case "$state" in ! _retrieve_cache modules-$kver; then # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough? - modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) ) + modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r:r) ) _store_cache modules-$kver modules fi -- cgit v1.2.3 From c3d1277229c81e646e00cbd5d55e69d715e26023 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 27 Jul 2011 10:26:25 +0000 Subject: 29618: Fix some syntax to not depend on SHORT_LOOPS being set. --- ChangeLog | 8 +++++++- Completion/Linux/Command/_ethtool | 8 ++++---- Completion/Zsh/Type/_file_descriptors | 4 +++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'Completion/Linux') diff --git a/ChangeLog b/ChangeLog index b5a2baddf..84a8cb7d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-07-27 Mikael Magnusson + + * 29618: Completion/Linux/Command/_ethtool, + Completion/Zsh/Type/_file_descriptors: Fix some syntax to not depend + on SHORT_LOOPS being set. + 2011-07-25 Peter Stephenson * 29561: Src/exec.c, Src/utils.c, Test/A04redirect.ztst: Allow @@ -15159,5 +15165,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5407 $ +* $Revision: 1.5408 $ ***************************************************** diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index a01d38823..5d607741f 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -3,9 +3,9 @@ local -a cmds if [[ $CURRENT -ge 4 ]]; then - case $words[CURRENT-1]; in + case $words[CURRENT-1] in rx|tx) - if [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on + [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on ;; autoneg|adaptive-rx|adaptive-tx|raw|hex|sg|tso|ufo|gso) _wanted -x onoff expl 'enabled' compadd off on @@ -55,7 +55,7 @@ if [[ $CURRENT -ge 4 ]]; then _wanted files expl 'raw register dump files' _files ;; *) - case $words[2]; in + case $words[2] in -A|--pause) _values -S ' ' -w 'pause options' \ 'autoneg[specify if pause autonegotiation is enabled]' \ @@ -111,7 +111,7 @@ if [[ $CURRENT -ge 4 ]]; then 'gso[specify if generic segmentation offload is enabled]' ;; -p|--identify) - if [[ $CURRENT -eq 4 ]] && _message -e length 'seconds' + [[ $CURRENT -eq 4 ]] && _message -e length 'seconds' ;; -t|--test) _values -S ' ' -w 'selftest option' \ diff --git a/Completion/Zsh/Type/_file_descriptors b/Completion/Zsh/Type/_file_descriptors index 1dac47f61..3e251b733 100644 --- a/Completion/Zsh/Type/_file_descriptors +++ b/Completion/Zsh/Type/_file_descriptors @@ -13,7 +13,9 @@ if zstyle -T ":completion:${curcontext}:" verbose && [[ -h /proc/$$/fd/$fds[1] ] list+=( "$i $sep ${link[1]}" ) done elif (( $+commands[readlink] )); then - for i in "${fds[@]}"; list+=( "$i $sep $(readlink /proc/$$/fd/$i)" ) + for i in "${fds[@]}"; do + list+=( "$i $sep $(readlink /proc/$$/fd/$i)" ) + done else for i in "${fds[@]}"; do list+=( "$i $sep $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" ) -- cgit v1.2.3 From 2a79494070d9805a7f3ab97ba18ae2733737ec52 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 17 Aug 2011 10:24:34 +0000 Subject: 29690: new _twidge and _cryptsetup completers from Daniel Friesel. --- ChangeLog | 6 +- Completion/Linux/Command/.distfiles | 1 + Completion/Linux/Command/_cryptsetup | 103 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_twidge | 77 ++++++++++++++++++++++++++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 Completion/Linux/Command/_cryptsetup create mode 100644 Completion/Unix/Command/_twidge (limited to 'Completion/Linux') diff --git a/ChangeLog b/ChangeLog index 6aefda033..eba819cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ * 29683: Completion/Unix/Command/_ssh: add -O forward to _ssh. + * Daniel Friesel: 29690: Completion/Linux/Command/_cryptsetup, + Completion/Unix/Command/_twidge: new _twidge and _cryptsetup + completers. + 2011-08-16 Wayne Davison * 29650: Src/jobs.c: don't lose the the time info after a @@ -15280,5 +15284,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5434 $ +* $Revision: 1.5435 $ ***************************************************** diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index 251204e3b..509330f6b 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -5,6 +5,7 @@ _acpitool _analyseplugin _brctl _chrt +_cryptsetup _ethtool _fusermount _ionice diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup new file mode 100644 index 000000000..3519336e8 --- /dev/null +++ b/Completion/Linux/Command/_cryptsetup @@ -0,0 +1,103 @@ +#compdef cryptsetup +## completion for cryptsetup 1.3.0, based on cryptsetup(1) + +function _cryptsetup_action { + typeset -a actions + actions=( + 'create:create a mapping' + 'remove:remove an existing mapping' + 'status:report mapping status' + 'resize:resize an active mapping' + 'luksFormat:Initialize a LUKS partition' + 'luksOpen:Open LUKS partition' + 'luksClose:remove an existing mapping' + 'luksSuspend:suspend active device' + 'luksResume:resume suspended device' + 'luksAddKey:add a new key' + 'luksRemoveKey:remove a key' + 'luksChangeKey:change a key' + 'luksKillSlot:wipe key from slot' + 'luksUUID:print/change device UUID' + 'isLuks:check if device is a LUKS partition' + 'luksDump:dump header information' + 'luksHeaderBackup:store binary backup of headers' + 'luksHeaderRestore:restore header backup' + ) + _describe action actions +} + +function _cryptsetup_device { + typeset expl + _wanted file expl device \ + _files +} + +function _cryptsetup_mapping { + typeset expl + _wanted file expl 'mapping name' \ + _path_files -W /dev/mapper +} + +function _cryptsetup_arguments { + + case ${words[1]} in + + create) + _arguments ':mapping:_cryptsetup_mapping' ':device:_cryptsetup_device' + ;; + + remove|status|resize|luksClose|luksSuspend|luksResume) + _arguments ': :_cryptsetup_mapping' + ;; + + luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks) + _arguments ': :_cryptsetup_device' + ;; + + luks(Format|AddKey|RemoveKey|ChangeKey)) + _arguments ': :_cryptsetup_device' ':key file:_files' + ;; + + luksKillSlot) + _arguments ': :_cryptsetup_device' ':key slot number' + ;; + + luksOpen) + _arguments ': :_cryptsetup_device' ': :_cryptsetup_mapping' + ;; + + esac +} + +function _cryptsetup { + _arguments \ + '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \ + '--debug[enable debug mode]' \ + '(-h --hash)'{-h,--hash}'[hash algorithm]:hash algorithm' \ + '(-c --cipher)'{-c,--cipher}'[set cipher]:cipher specification' \ + '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \ + '(-d --key-file)'{-d,--key-file}'[set keyfile]:key file:_files' \ + '(-l --keyfile-size)'{-l,--keyfile-size}'[set keyfile size]:bytes' \ + '--new-keyfile-size[set new keyfile size (luksAddKey)]:bytes' \ + '--master-key-file[set master key]:key file:_files' \ + '--dump-master-key[dump luks master key]' \ + '(--use-urandom)--use-random[use /dev/random to generate volume key]' \ + '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \ + '(-S --key-slot)'{-S,--key-slot}'[select key slot]:key slot' \ + '(-s --key-size)'{-s,--key-size}'[set key size]:bits' \ + '(-b --size)'{-b,--size}'[force device size]:sectors' \ + '(-o --offset)'{-o,--offset}'[set start offset]:sectors' \ + '(-p --skip)'{-p,--skip}'[data to skip at beginning]:sectors' \ + '--readonly[set up read-only mapping]' \ + '(-i --iter-time)'{-i,--iter-time}'[set password processing duration]:milliseconds' \ + '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \ + '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:seconds' \ + '(-T --tries)'{-T,--tries}'[set maximum number of retries]:maximum retries' \ + '--align-payload[set payload alignment]:sectors' \ + '--uuid[set device UUID]:uuid' \ + '--version[show version information]' \ + ':action:_cryptsetup_action' \ + '*::arguments:_cryptsetup_arguments' +} + +_cryptsetup "$@" diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 05b4d573a..19fa397d5 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -226,6 +226,7 @@ _topgit _totd _tracepath _tree +_twidge _twisted _unace _uname diff --git a/Completion/Unix/Command/_twidge b/Completion/Unix/Command/_twidge new file mode 100644 index 000000000..d8b3b3def --- /dev/null +++ b/Completion/Unix/Command/_twidge @@ -0,0 +1,77 @@ +#compdef twidge +## completion for twidge 1.0.8, based on twidge(1) + +function _twidge_command { + typeset -a twidge_commands + typeset -i skip=1 + + twidge lscommands | while read cmd desc; do + if [[ $cmd == ---* ]] { + skip=0 + continue + } + if (( skip )) { + continue + } + twidge_commands+="${cmd}:${desc}" + done + + _describe command twidge_commands +} + +function _twidge_args { + typeset -a args_common args_more args_other args_update + + args_common=( + '(-a --all)'{-a,--all}'[receive all content]' + '(-e --exec)'{-e,--exec}'[execute command for each retrieved item]:command' + '(-l --long)'{-l,--long}'[long output format]' + '(-m --mailto)'{-m,--mailto}'[mail retrieved items]:mail address' + ) + + args_more=( + '(-s --saveid)'{-s,--saveid}'[save ID of most recent message]' + '(-u --unseen)'{-u,--unseen}'[only show unseen messages]' + ) + + args_other=( + '(-U --username)'{-U,--username}'[show updates of different user]:username' + ) + + args_update=( + '(-i --inreplyto)'{-i,--inreplyto}'[update in reply to a message]:message id' + '(-i --inreplyto 1)-r[read RFC2822 Mail]' + ':status' + ) + + case ${words[1]} in + lsarchive) + _arguments $args_common $args_more $args_other + ;; + ls(dm(|archive)|recent|replies|rt(|archive|replies))) + _arguments $args_common $args_more + ;; + lsfollow(ers|ing)) + _arguments $args_common :username + ;; + dmsend) + _arguments :recipient :status + ;; + (un|)follow) + _message username + ;; + update) + _arguments $args_update + ;; + esac +} + +function _twidge { + _arguments \ + '(-c --config)'{-c,--config}'[config file]:file:_files' \ + '(-d --debug)'{-d,--debug}'[enable debugging output]' \ + '(-): :_twidge_command' \ + '(-)*:: :_twidge_args' +} + +_twidge "$@" -- cgit v1.2.3 From f0eaa5713eca5abfdeacabb1a71159456d1e3539 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 18 Aug 2011 12:48:42 +0000 Subject: unposted: move _schedtool to correct dir --- ChangeLog | 10 +++++++++- Completion/Linux/Command/.distfiles | 1 + Completion/Linux/Command/_schedtool | 25 +++++++++++++++++++++++++ Completion/Zsh/Command/.distfiles | 1 - Completion/Zsh/Command/_schedtool | 25 ------------------------- 5 files changed, 35 insertions(+), 27 deletions(-) create mode 100644 Completion/Linux/Command/_schedtool delete mode 100644 Completion/Zsh/Command/_schedtool (limited to 'Completion/Linux') diff --git a/ChangeLog b/ChangeLog index 2c409cfdd..059d6db6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-08-18 Mikael Magnusson + + * unposted: Completion/Linux/Command/.distfiles, + Completion/Linux/Command/_schedtool, + Completion/Zsh/Command/.distfiles, + Completion/Zsh/Command/_schedtool: move _schedtool completion + to correct directory. + 2011-08-17 Peter Stephenson * 29703: Src/exec.c, Src/subst.c, Test/D03procsubst.ztst: @@ -15307,5 +15315,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5440 $ +* $Revision: 1.5441 $ ***************************************************** diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index 509330f6b..941e2de3c 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -20,6 +20,7 @@ _modutils _mondo _pkgtool _rpmbuild +_schedtool _sshfs _strace _tpb diff --git a/Completion/Linux/Command/_schedtool b/Completion/Linux/Command/_schedtool new file mode 100644 index 000000000..869f146e3 --- /dev/null +++ b/Completion/Linux/Command/_schedtool @@ -0,0 +1,25 @@ +#compdef schedtool + +local curcontext="$curcontext" line state ret=1 + +_arguments -C \ + '(-p -F -R -B -I -D -M)-N[for SCHED_NORMAL]' \ + '( -N -R -B -I -D -M)-F[for SCHED_FIFO]' \ + '( -N -F -B -I -D -M)-R[for SCHED_RR]' \ + '(-p -N -F -R -I -D -M)-B[for SCHED_BATCH]' \ + '( -N -F -R -B -D -M)-I[for SCHED_ISO]' \ + '(-p -N -F -R -B -I -M)-D[for SCHED_IDLEPRIO]' \ + '( -N -F -R -B -I -D )-M[for manual mode; raw number for POLICY]:raw policy number' \ + '( -N -B -D )-p[usually 1-99; only for FIFO, RR or ISO]:static priority' \ + '-a[cpu affinity]:mask or list' \ + '-n[set niceness to NICE_LEVEL]:priority' \ + '-e[start COMMAND with specified policy/priority]:program: _command_names -e:*::program arguments: _normal' \ + '-v[be verbose]' \ + '*:processes:->processes' && ret=0 + +if [[ -n "$state" ]]; then + _alternative \ + 'processes:: _pids' && ret=0 +fi + +return ret diff --git a/Completion/Zsh/Command/.distfiles b/Completion/Zsh/Command/.distfiles index 3981f74cc..6feec496d 100644 --- a/Completion/Zsh/Command/.distfiles +++ b/Completion/Zsh/Command/.distfiles @@ -23,7 +23,6 @@ _print _prompt _read _sched -_schedtool _set _setopt _source diff --git a/Completion/Zsh/Command/_schedtool b/Completion/Zsh/Command/_schedtool deleted file mode 100644 index 869f146e3..000000000 --- a/Completion/Zsh/Command/_schedtool +++ /dev/null @@ -1,25 +0,0 @@ -#compdef schedtool - -local curcontext="$curcontext" line state ret=1 - -_arguments -C \ - '(-p -F -R -B -I -D -M)-N[for SCHED_NORMAL]' \ - '( -N -R -B -I -D -M)-F[for SCHED_FIFO]' \ - '( -N -F -B -I -D -M)-R[for SCHED_RR]' \ - '(-p -N -F -R -I -D -M)-B[for SCHED_BATCH]' \ - '( -N -F -R -B -D -M)-I[for SCHED_ISO]' \ - '(-p -N -F -R -B -I -M)-D[for SCHED_IDLEPRIO]' \ - '( -N -F -R -B -I -D )-M[for manual mode; raw number for POLICY]:raw policy number' \ - '( -N -B -D )-p[usually 1-99; only for FIFO, RR or ISO]:static priority' \ - '-a[cpu affinity]:mask or list' \ - '-n[set niceness to NICE_LEVEL]:priority' \ - '-e[start COMMAND with specified policy/priority]:program: _command_names -e:*::program arguments: _normal' \ - '-v[be verbose]' \ - '*:processes:->processes' && ret=0 - -if [[ -n "$state" ]]; then - _alternative \ - 'processes:: _pids' && ret=0 -fi - -return ret -- cgit v1.2.3 From 970adcc4d0e9f2ab08439d9db43076e02885553b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 8 Nov 2011 09:51:31 +0000 Subject: Haakon Riiser: 29895, 29897: _ffmpeg, _nmcli --- ChangeLog | 9 +- Completion/Linux/Command/.distfiles | 1 + Completion/Linux/Command/_nmcli | 244 ++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_ffmpeg | 13 ++ 4 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 Completion/Linux/Command/_nmcli (limited to 'Completion/Linux') diff --git a/ChangeLog b/ChangeLog index 66347ea1a..e712811a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-11-08 Peter Stephenson + + * Haakon Riiser: 29895, 29887: Completion/Unix/Command/_ffmpeg, + Completion/Linux/Command/_nmcli (plus + Completion/Linux/Command/.distfiles): update and new + NetworkManager client completion. + 2011-11-07 Simon Ruderich * 29893: Completion/Unix/Command/_ssh: Update (mostly) for 5.9. @@ -15552,5 +15559,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5495 $ +* $Revision: 1.5496 $ ***************************************************** diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index 941e2de3c..0d817fc5d 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -18,6 +18,7 @@ _mdadm _mii-tool _modutils _mondo +_nmcli _pkgtool _rpmbuild _schedtool diff --git a/Completion/Linux/Command/_nmcli b/Completion/Linux/Command/_nmcli new file mode 100644 index 000000000..a6b97a36c --- /dev/null +++ b/Completion/Linux/Command/_nmcli @@ -0,0 +1,244 @@ +#compdef nmcli + +local context state line expl +typeset -A opt_args + +if [[ -z $_nmcli_version ]]; then + _nmcli_version="${"$(_call_program nmcli $words[1] --version)"##*version }" +fi + +(( $+functions[_nmcli_is_running] )) || _nmcli_is_running() { + [[ $(_call_program nmcli $words[1] -f running nm) != *'not running'* ]] +} + +(( $+functions[_nmcli_con_ids] )) || _nmcli_con_ids() { + _nmcli_is_running || return + local -a con_ids + con_ids=(${(f)"$(_call_program nmcli $words[1] -f name con)"}) + con_ids=(${con_ids[2,-2]}) + con_ids=(${con_ids[@]%%\ ##}) + _describe 'select connection' con_ids +} + +(( $+functions[_nmcli_con_uuids] )) || _nmcli_con_uuids() { + _nmcli_is_running || return + local -a con_uuids + con_uuids=(${(f)"$(_call_program nmcli $words[1] -f uuid con)"}) + con_uuids=(${con_uuids[2,-2]}) + con_uuids=(${con_uuids[@]%%\ ##}) + _describe 'select connection' con_uuids +} + +(( $+functions[_nmcli_objects] )) || _nmcli_objects() { + local -a objects_array + objects_array=( + 'nm:NetworkManager status' + 'con:NetworkManager connections' + 'dev:devices managed by NetworkManager' + ) + _describe 'nmcli object' objects_array +} + +(( $+functions[_nmcli_nm] )) || _nmcli_nm() { + local -a nm_array + nm_array=( + 'status:show overall status of NetworkManager' + 'enable:get status or enable/disable networking' + 'sleep:get sleep status or put to sleep/awake NetworkManager' + 'wifi:inquire or set status of WiFi in NetworkManager' + 'wwan:inquire or set status of WWAN in NetworkManager' + ) + _describe 'inquire and change state of NetworkManager' nm_array +} + +(( $+functions[_nmcli_con] )) || _nmcli_con() { + local -a con_array + con_array=( + 'list:list configured connections' + 'status:print status of active connections' + 'up:activate a connection' + 'down:deactivate a connection' + ) + if [[ $_nmcli_version == 0.9.[1-9]* ]]; then + con_array[5]="delete:delete a connection" + fi + _describe "get information about NetworkManager's connections" con_array +} + +(( $+functions[_nmcli_con_list] )) || _nmcli_con_list() { + local -a con_list_array + con_list_array=( + 'id:get details on connection specified by id' + 'uuid:get details on connection specified by uuid' + ) + if [[ $_nmcli_version == 0.8* ]]; then + con_list_array[3]='system:only list system connections' + con_list_array[4]='user:only list user connections' + fi + _describe 'list configured connections' con_list_array +} + +(( $+functions[_nmcli_con_up] )) || _nmcli_con_up() { + local -a con_up_array + con_up_array=( + 'id:activate connection specified by id' + 'uuid:activate connection specified by uuid' + ) + _describe 'activate connection by id or uuid' con_up_array +} + +(( $+functions[_nmcli_con_down] )) || _nmcli_con_down() { + local -a con_down_array + con_down_array=( + 'id:deactivate connection specified by id' + 'uuid:deactivate connection specified by uuid' + ) + _describe 'deactivate connection by id or uuid' con_down_array +} + +(( $+functions[_nmcli_con_delete] )) || _nmcli_con_delete() { + local -a con_delete_array + con_delete_array=( + 'id:delete connection specified by id' + 'uuid:delete connection specified by uuid' + ) + _describe 'delete connection by id or uuid' con_delete_array +} + +(( $+functions[_nmcli_con_up_extraargs] )) || _nmcli_con_up_extraargs() { + local -a con_up_extraargs_array + con_up_extraargs_array=( + 'iface:require a particular interface' + 'ap:require a specific access point' + '--nowait:don''t wait for command completion' + '--timeout:specify how long to wait for operation to complete' + ) + _describe 'extra options for "con up"' con_up_extraargs_array +} + +(( $+functions[_nmcli_dev_disconnect_extraargs] )) || _nmcli_dev_disconnect_extraargs() { + local -a dev_disconnect_extraargs_array + dev_disconnect_extraargs_array=( + '--nowait:don''t wait for command completion' + '--timeout:specify how long to wait for operation to complete' + ) + _describe 'extra options for "dev disconnect"' dev_disconnect_extraargs_array +} + +(( $+functions[_nmcli_dev_wifi_list] )) || _nmcli_dev_wifi_list() { + local -a dev_wifi_list_array + dev_wifi_list_array=( + 'iface:list APs for a particular interface' + ) + if [[ $_nmcli_version == 0.8* || $_nmcli_version == 0.9.0* ]]; then + dev_wifi_list_array[2] = 'hwaddr:list a specific AP by MAC address' + elif [[ $_nmcli_version == 0.9.[1-9]* ]]; then + dev_wifi_list_array[2] = 'bssid:list a specific AP by BSSID' + fi + _describe 'options for specifying the AP to list' dev_wifi_list_array +} + +(( $+functions[_nmcli_dev] )) || _nmcli_dev() { + local -a dev_array + dev_array=( + 'status:print status of devices' + 'list:get detailed information about devices' + 'disconnect:disconnect device and prevent it from automatically activating' + 'wifi:list available WiFi access points' + ) + _describe "get information about devices" dev_array +} + +(( $+functions[_nmcli_truefalse] )) || _nmcli_truefalse() { + _wanted boolean expl 'use true/false to modify (nothing = query status)' compadd true false +} + +(( $+functions[_nmcli_onoff] )) || _nmcli_onoff() { + _wanted onoff expl 'use on/off to modify (nothing = query status)' compadd on off +} + +local w1="${words[$#words - 1]}" +local w2="${words[$#words - 2]}" +local w3="${words[$#words - 3]}" +local w4="${words[$#words - 4]}" + +if [[ $w2 == nm && $w1 == (sleep|enable) ]]; then + _nmcli_truefalse && return +elif [[ $w2 == nm && $w1 == (wifi|wwan) ]]; then + _nmcli_onoff && return +elif [[ $w1 == nm ]]; then + _nmcli_nm && return +elif [[ $w3 == con && $w2 == list && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $w3 == con && $w2 == list && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ $w2 == con && $w1 == list ]]; then + _nmcli_con_list && return +elif [[ $w3 == con && $w2 == (up|down) && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $w3 == con && $w2 == (up|down) && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ ${(pj:\0:)words} == *$'\0con\0up\0'(id|uuid)$'\0'* ]]; then + if [[ $w1 == iface ]]; then + _net_interfaces && return + elif [[ $w1 == ap ]]; then + _message -e descriptions 'enter MAC address' && return + elif [[ $w1 == --timeout ]]; then + _message -e descriptions 'enter timeout' && return + else + _nmcli_con_up_extraargs && return + fi +elif [[ $w2 == con && $w1 == up ]]; then + _nmcli_con_up && return +elif [[ $w2 == con && $w1 == down ]]; then + _nmcli_con_down && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w2 == con && $w1 == delete ]]; then + _nmcli_con_delete && return +elif [[ $w1 == con ]]; then + _nmcli_con && return +elif [[ $w3 == dev && $w2 == (list|disconnect) && $w1 == iface ]]; then + _net_interfaces && return +elif [[ ${(pj:\0:)words} == *$'\0dev\0disconnect\0iface\0'* ]]; then + if [[ $w1 == --timeout ]]; then + _message -e descriptions 'enter timeout' && return + else + _nmcli_dev_disconnect_extraargs && return + fi +elif [[ $w2 == dev && $w1 == list ]]; then + compadd iface && return +elif [[ $w2 == dev && $w1 == disconnect ]]; then + compadd iface && return +elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == iface ]]; then + _net_interfaces && return +elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == hwaddr ]]; then + _message -e descriptions 'enter MAC address' && return +elif [[ $w3 == dev && $w2 == wifi && $w1 == list ]]; then + _nmcli_dev_wifi_list && return +elif [[ $w2 == dev && $w1 == wifi ]]; then + compadd list && return +elif [[ $w1 == dev ]]; then + _nmcli_dev && return +else + _arguments \ + {'(--terse)-t','(-t)--terse'}'[terse output]' \ + {'(--pretty)-p','(-p)--pretty'}'[pretty output]' \ + {'(--mode)-m','(-m)--mode'}'[output mode]:output mode:(tabular multiline)' \ + {'(--fields)-f','(-f)--fields'}'[specify fields to output]: :->fields' \ + {'(--escape)-e','(-e)--escape'}'[escape columns separators in values]:escape columns separators in values:(yes no)' \ + {'(--version)-v','(-v)--version'}'[show program version]' \ + {'(--help)-h','(-h)--help'}'[print this help]' \ + '*::nmcli object:_nmcli_objects' \ + && return +fi + +[[ "$state" == "fields" ]] && + _values -s , 'fields to be printed' \ + all common \ + autoconnect dbus-path device name net-enabled readonly running \ + scope state timestamp timestamp-real type uuid wifi wifi-hardware \ + wwan wwan-hardware \ + && return diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index 8f9b2c9cb..6a4ba234d 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -21,6 +21,12 @@ typeset -A opt_args _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a vcodecs } +(( $+functions[_ffmpeg_scodecs] )) || _ffmpeg_scodecs() { + local scodecs + scodecs=(copy ${${(M)${(f)"$(_call_program video-codecs $words[1] -codecs 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]]S[S[:space:]][D[:space:]][T[:space:]][[:space:]][^[:space:]]##*}//(#b)????????([^[:space:]]##)*/$match[1]}) + _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a scodecs +} + (( $+functions[_ffmpeg_formats] )) || _ffmpeg_formats() { local formats formats=(${(ou)${=${(s:,:)${${(M)${(f)"$(_call_program formats $words[1] -formats 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]][[:space:]][^[:space:]]##*}//(#b)????([^[:space:]]##)*/$match[1]}}}}) @@ -84,6 +90,7 @@ typeset -A _ffmpeg_flags lastopt+=":$lastopt_description:" if (( $#lastopt_values )); then if [[ $lastopt_type == flags ]]; then + lastopt="*$lastopt" flagtype=${${lastopt%%:*}#-} lastopt+="->$flagtype" _ffmpeg_flags[$flagtype]="${lastopt_values[*]}" @@ -125,6 +132,7 @@ local -a _ffmpeg_argspecs lastopt+=":$lastopt_description:_files" elif [[ $lastopt == -[asv]pre ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_presets" elif [[ $lastopt == -acodec ]]; then lastopt_takesargs=0 @@ -132,11 +140,16 @@ local -a _ffmpeg_argspecs elif [[ $lastopt == -vcodec ]]; then lastopt_takesargs=0 lastopt+=": :_ffmpeg_vcodecs" + elif [[ $lastopt == -scodec ]]; then + lastopt_takesargs=0 + lastopt+=": :_ffmpeg_scodecs" elif [[ $lastopt == -f ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_formats" elif [[ $lastopt == -pix_fmt ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_pix_fmts" elif [[ $example == bitstream_filter ]]; then lastopt_takesargs=0 -- cgit v1.2.3