From 70e0128c0fdf216396a67f23154dac649158b9a8 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 31 May 2011 12:38:32 +0000 Subject: users/16057: add _tree --- Completion/Unix/Command/.distfiles | 1 + 1 file changed, 1 insertion(+) (limited to 'Completion/Unix/Command/.distfiles') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index cc47a7a0b..91a8786c8 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -224,6 +224,7 @@ _toilet _topgit _totd _tracepath +_tree _twisted _unace _uname -- cgit v1.2.3 From d1a557d008b7fa7881327acbd6decdb50631cc9c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 4 Jul 2011 20:14:51 +0000 Subject: Eric Moors: 29531: Android debugger completion --- ChangeLog | 7 +- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_adb | 541 +++++++++++++++++++++++++++++++++++++ 3 files changed, 548 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_adb (limited to 'Completion/Unix/Command/.distfiles') diff --git a/ChangeLog b/ChangeLog index d67af6545..e2fa793ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-04 Peter Stephenson + + * Eric Moors: 29531: Completion/Unix/Command/_adb: completion + for Android debugger. + 2011-07-03 Frank Terbeck * unposted: Doc/Zsh/contrib.yo: Fix typo "paramter". Caught by @@ -15092,5 +15097,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5393 $ +* $Revision: 1.5394 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 91a8786c8..05b4d573a 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -2,6 +2,7 @@ DISTFILES_SRC=' .distfiles _a2ps _aap +_adb _ant _antiword _apachectl diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb new file mode 100644 index 000000000..2e36046c7 --- /dev/null +++ b/Completion/Unix/Command/_adb @@ -0,0 +1,541 @@ +#compdef adb -value-,ADB_TRACE,-default- -value-,ANDROID_SERIAL,-default- -value-,ANDROID_LOG_TAGS,-default- + +local ADB_DEVICE_SPECIFICATION LOG_REDIRECT + +_adb() { + # rely on localoptions + setopt nonomatch + + ADB_DEVICE_SPECIFICATION="" + + if [[ $1 = -l ]]; then + # Run to load _adb and associated functions but do + # nothing else. + return + fi + + if [[ $service = -value-* ]]; then + #_message compstate=$compstate[parameter] + case $compstate[parameter] in + (ADB_TRACE) + _adb_trace_opts + ;; + + (ANDROID_SERIAL) + _adb_device_serial + ADB_DEVICE_SPECIFICATION="-s ${ANDROID_SERIAL}" + ;; + + (ANDROID_LOG_TAGS) + _adb_logcat_filter_specification + ;; + + esac + # We do not handle values anywhere else. + return + fi + + local -a ALL_ADB_COMMANDS + ALL_ADB_COMMANDS=( + "connect" + "disconnect" + "shell" + "wait-for-device" + "push" + "pull" + "logcat" + "jdwp" + "bugreport" + "version" + "forward" + "install" + "uninstall" + "help" + "start-server" + "kill-server" + "devices" + "get-state" + "get-serialno" + "status-window" + "remount" + "reboot" + "reboot-bootloader" + "root" + "usb" + "tcpip" + "ppp" + ) + + (( $+functions[_adb_device_specification] )) && _adb_device_specification + + adb ${=ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null || { + # early bail-out until a single valid device/emulator is specified and up-and-running + _message -r "No (started) device specified, completions do not yet work" + _arguments \ + '(-d -e )-s[serial]: :_adb_device_serial' \ + '( -e -s)-d[device]' \ + '(-d -s)-e[emulator]' \ + '*:"options":_adb_options_handler' + + return; + } + + (( $+functions[_adb_check_log_redirect] )) && _adb_check_log_redirect + + (( $+functions[_adb_dispatch_command] )) && _adb_dispatch_command +} + +(( $+functions[_adb_dispatch_command] )) || +_adb_dispatch_command () { + local curcontext="${curcontext}" + local integer last_command_pos=-1 + + (( $+functions[_adb_sanitize_context] )) && _adb_sanitize_context + if [[ ${last_command_pos} -gt 0 ]] + then + shift ${last_command_pos}-1 words + CURRENT=$(( ${CURRENT} - ${last_command_pos} + 1 )) + fi + + case ${curcontext} in + (*:adb:shell) + (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell + ;; + (*:adb:connect|*:adb:disconnect) + (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling + ;; + (*:adb:logcat) + (( $+functions[_adb_dispatch_logcat] )) && _adb_dispatch_logcat + ;; + (*:adb:push) + (( $+functions[_adb_dispatch_push] )) && _adb_dispatch_push + ;; + (*:adb:pull) + (( $+functions[_adb_dispatch_pull] )) && _adb_dispatch_pull + ;; + (*:adb:install) + (( $+functions[_adb_dispatch_install] )) && _adb_dispatch_install + ;; + (*:adb:uninstall) + (( $+functions[_adb_dispatch_uninstall] )) && _adb_dispatch_uninstall + ;; + (*) + _arguments \ + '(-d -e)-s["serial"]: :_adb_device_serial' \ + '(-s -e)-d["device"]' \ + '(-d -s)-e["emulator"]' \ + '*:"options":_adb_options_handler' + ;; + esac +} + +(( $+functions[_adb_sanitize_context] )) || +_adb_sanitize_context () { + local -a mywords + for adbcommand in "${ALL_ADB_COMMANDS[@]}" + do + if [[ -n "${adbcommand}" ]] && [[ ${words[(I)${adbcommand}]} -gt 0 ]] + then + last_command_pos=${words[(I)${adbcommand}]} + mywords[${last_command_pos}]=${adbcommand} + fi + done + ##expand unquoted to remove sparse elements + mywords=( ${mywords[@]} ) + curcontext="${curcontext}${mywords[-1]}" +} + +(( $+functions[_adb_device_specification] )) || +_adb_device_specification () { + local integer i=1 + foreach word ($words) + do + i=$(( ++i )) + case ${words[$i]} in + (-d|-e) + ADB_DEVICE_SPECIFICATION="${words[$i]}" + break + ;; + (-s) + ADB_DEVICE_SPECIFICATION="-s ${words[$i + 1]}" + break + ;; + (-*) + continue + ;; + (*) + break + ;; + esac + done +} + +(( $+functions[_adb_dispatch_shell] )) || +_adb_dispatch_shell () { + if [[ ${#words} -le 2 ]] + then + (( $+functions[_adb_shell_commands_handler] )) && _adb_shell_commands_handler + return + fi + + case ${words[2]} in + (am) + (( $+functions[_adb_activity_manager_handler] )) && _adb_activity_manager_handler + ;; + (pm) + (( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler + ;; + (*) + _arguments '*:adb_remote_folder:_adb_remote_folder' + ;; + esac +} + +(( $+functions[_adb_pm_list] )) || +_adb_pm_list () { + case ${words[4]} in + (packages) + _arguments -s '-f[see their associated file]' \ + ':' + ;; + (permissions) + _arguments -s '-g[organize by group]' \ + '-f[print all information]' \ + '-d[only list dangerous pemissions]' \ + '-u[only list user visible permissions]' \ + '-s[short summary]' \ + ':' + ;; + (permission-groups) + ;; + (instrumentation) + _arguments -s '-f[see their associated file]' \ + ':' + ;; + (features) + ;; + (*) + _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features + ;; + esac +} + +(( $+functions[_adb_intent_handler] )) || +_adb_intent_handler () { + _message -r " specifications include these flags: + [-a ] [-d ] [-t ] + [-c [-c ] ...] + [-e|--es ...] + [--esn ...] + [--ez ...] + [-e|--ei ...] + [-n ] [-f ] + [--grant-read-uri-permission] [--grant-write-uri-permission] + [--debug-log-resolution] + [--activity-brought-to-front] [--activity-clear-top] + [--activity-clear-when-task-reset] [--activity-exclude-from-recents] + [--activity-launched-from-history] [--activity-multiple-task] + [--activity-no-animation] [--activity-no-history] + [--activity-no-user-action] [--activity-previous-is-top] + [--activity-reorder-to-front] [--activity-reset-task-if-needed] + [--activity-single-top] + [--receiver-registered-only] [--receiver-replace-pending] + []" +} + +(( $+functions[_adb_activity_manager_handler] )) || +_adb_activity_manager_handler () { + if [[ ${#words} -le 3 ]] + then + _wanted am_argument expl 'am argument' compadd start startservice broadcast instrument profile + return + fi + case ${words[3]} in + (start) + _arguments -s '-D[enable debugging]' \ + '-W[wait for launch to complete]' \ + '*:intent:_adb_intent_handler' + ;; + (startservice) + _arguments -s '*:intent:_adb_intent_handler' + ;; + (broadcast) + _arguments -s '*:intent:_adb_intent_handler' + ;; + (instrument) + _arguments -s '-r[print raw results]' \ + '-e[set argument NAME to VALUE]: :' \ + '-p[write profiling data to FILE]::' \ + '-w[wait for instrumenation to finish]' \ + ':' + ;; + (profile) + _message -r " start/stop " + ;; + esac +} + +(( $+functions[_adb_package_manager_handler] )) || +_adb_package_manager_handler () { + case ${words[3]} in + (list) + (( $+functions[_adb_pm_list] )) && _adb_pm_list + ;; + (path) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (enable) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (disable) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (setInstallLocation) + _wanted set_installlcation expl 'install location' compadd -d "(0:auto 1:internal 2:external)" 0 1 2 + ;; + (getInstallLocation) + ;; + (*) + _wanted pm_argument expl 'pm argument' compadd list path install unistall enable disable setInstallLocation getInstallLocation + ;; + esac +} + +(( $+functions[_adb_dispatch_uninstall] )) || +_adb_dispatch_uninstall () { + argcount=${#${(M)words#-*}} + if [[ $CURRENT -gt (( argcount + 2 )) ]] + then + _message -r "Notice: you can only uninstall one package at a time" + return + fi + + _arguments \ + '-k["keep data and cache"]' \ + '*:"installed package":_adb_installed_packages' +} + +(( $+functions[_adb_dispatch_install] )) || +_adb_dispatch_install () { + argcount=${#${(M)words#-*}} + if [[ $CURRENT -gt (( argcount + 2 )) ]] + then + _message -r "Notice: you can only install one package at a time" + return + fi + + _arguments \ + '-l["forward lock"]' \ + '-r["reinstall"]' \ + '-s["install on sd"]' \ + '*:"select apk file":_path_files -g "*(/)|*.apk"' +} + +(( $+functions[_adb_dispatch_push] )) || +_adb_dispatch_push () { + if [[ ${#words} -gt 3 ]] + then + _message -r "Notice: you can only push a single item at a time" + return + fi + if [[ ${#words} -gt 2 ]] + then + _arguments '*:adb_remote_folder:_adb_remote_folder' + else + _arguments '*:"local file/folder":_files' + fi +} + +(( $+functions[_adb_dispatch_pull] )) || +_adb_dispatch_pull () { + if [[ ${#words} -gt 3 ]] + then + _message -r "Notice: you can only pull a single item at a time" + return + fi + if [[ ${#words} -gt 2 ]] + then + _arguments '*:"local file/folder":_files' + else + _arguments '*:adb_remote_folder:_adb_remote_folder' + fi +} + +(( $+functions[_adb_dispatch_connection_handling] )) || +_adb_dispatch_connection_handling () { + if compset -P '*:' + then + local expl + _wanted ports expl port compadd "$@" 5555 + else + _hosts -qS: + fi +} + +(( $+functions[adb_check_log_redirect] )) || +_adb_check_log_redirect () { + LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio)// +/} + [[ ${LOG_REDIRECT[1,4]} == "true" ]] && _message -r "Notice: stdio log redirection enabled on the device, so some completions will not work" +} + +(( $+functions[_adb_trace_opts] )) || +_adb_trace_opts() { + _values -s , 'adb trace options' \ + '(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \ + '(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \ + 'adb' \ + 'sockets' \ + 'packets' \ + 'rwx' \ + 'usb' \ + 'sync' \ + 'sysdeps' \ + 'transport' \ + 'jdwp' +} + +(( $+functions[_adb_device_serial] )) || +_adb_device_serial() { + local expl + _wanted dev_serial expl 'available devices' compadd $(command adb devices | sed -n 's/^\([^[:space:]]*\)\t.*$/\1/p') +} + +(( $+functions[_adb_logcat_filter_specification] )) || +_adb_logcat_filter_specification() { + zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command + + local cacheid=logcat_filter_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + typeset -a logcat_filter_tags + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + logcat_filter_tags=( $(command adb ${=ADB_DEVICE_SPECIFICATION} logcat -d | sed -n 's#^[VDIWEF]/\([^[:space:](]*\).*#\1#p' |sort | uniq) ) + _store_cache "$cacheid" logcat_filter_tags + fi + local expl + if compset -P '*:' + then + _wanted filter expl filter compadd W S E I D V \* + else + _wanted filtertags expl filtertags compadd -qS: ${logcat_filter_tags[@]} \* + fi +} + +(( $+functions[_adb_dispatch_logcat] )) || +_adb_dispatch_logcat() { + _arguments \ + '(-c -g)-s[set default filter to silent]' \ + '(-c -g)-f[log output to file (defaults to stdout)]:logfile:_files' \ + '(-c -g -d)-r[rotate log every kbytes (default 16, requires -f)]:logsize:_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-n[max number of rotated logs (default 4)]:number :_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-v[log format]:format: _values "format" brief process tag thread raw time threadtime long' \ + '(-d -t -g)-c[clear log]' \ + '(-c -g)-d[dump log]' \ + '(-c -g)-t[print only recent lines (implies -d)]:linecount:_guard "[0-9]#" "numeric value"' \ + '(-c -g)-B[output log in binary]' \ + '(-c -g)*:filtering:_adb_logcat_filter_specification' +} + +(( $+functions[_adb_options_handler] )) || +_adb_options_handler() { + local expl + _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}" +} + +(( $+functions[_adb_shell_commands_handler] )) || +_adb_shell_commands_handler() { + local expl + _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat +} + +(( $+functions[_adb_any_device_available] )) || +_adb_any_device_available() { + _any_device_available=${#$(adb devices | sed -n 's/^\([^[:space:]]*\)\t.*$/\1/p')} +} + +(( $+functions[_adb_device_available] )) || +_adb_device_available() { + [[ $(adb ${=ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0 + return 1 +} + +(( $+functions[_adb_full_folder_scan] )) || +_adb_full_folder_scan() { + local -a rv; + rv=( ${$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'for i in $(ls -d /*) + do + case $i in + /proc|/sys|/acct) + ;; + *) + ls -R $i + ;; + esac + done' )//'$\r'/} ) + for line in ${rv[@]}; + do + [[ ${line[1]} == '/' ]] && folder="${line%:}" && adb_device_folders+=$folder && continue; + adb_device_folders+=$folder/$line; + done +} + +(( $+functions[_adb_remote_folder] )) || +_adb_remote_folder () { + local expl + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_daily + fi + local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + typeset -a filesystem_content + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + local -a adb_device_folders + _adb_full_folder_scan + # remove any duplicates and the initial slash => should still remove bare folders from it when it has children + filesystem_content=( ${(u)adb_device_folders#/} ) + _store_cache "$cacheid" filesystem_content + fi + _adb_device_available && \ + _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ -i / filesystem_content +} + +(( $+functions[_adb_installed_packages] )) || +_adb_installed_packages() { + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command + fi + + local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + typeset -a installed_packages + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + installed_packages=(${$( adb ${=ADB_DEVICE_SPECIFICATION} shell pm list packages )//#package:/}) + _store_cache "$cacheid" installed_packages + fi + + _wanted adb_installed_packages expl 'packages that are installed' compadd ${installed_packages} +} + +(( $+functions[_adb_cache_policy_single_command] )) || +_adb_cache_policy_single_command () { + typeset -a old + + # cache is valid for 1 minute + old=( "$1"(mm+1) ) + (( $#old )) +} + +(( $+functions[_adb_cache_policy_daily] )) || +_adb_cache_policy_daily () { + typeset -a old + + # cache is valid for a day + old=( "$1"(mh+12) ) + (( $#old )) +} + + + +_adb $@ -- 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/Unix/Command/.distfiles') 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 5bbedb3df35aaa0cb72882674f50eb89f8d30a7b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 17 Aug 2011 18:54:30 +0000 Subject: Anthony R Fletcher: users/16260: new systemctl completion --- ChangeLog | 7 ++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_systemctl | 102 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_systemctl (limited to 'Completion/Unix/Command/.distfiles') diff --git a/ChangeLog b/ChangeLog index 3c3b3b538..bd9d9229b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-17 Peter Stephenson + + * Anthony R Fletcher: users/16260: + Completion/Unix/Command/_systemctl: new completion. + 2011-08-17 Nikolai Weibull * 29698: Completion/Unix/Command/_git: Complete diff options for git @@ -15289,5 +15294,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5436 $ +* $Revision: 1.5437 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 19fa397d5..696faea88 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -208,6 +208,7 @@ _subversion _sudo _surfraw _sysctl +_systemctl _tar _tardy _tcpdump diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl new file mode 100644 index 000000000..5dd35db7a --- /dev/null +++ b/Completion/Unix/Command/_systemctl @@ -0,0 +1,102 @@ +#compdef systemctl + +# Completion for systemd's systemctl +# Version 1.0 ARF 3 August 2011 + +# list the unit completions. +_systemd_units(){ + local -a units + local expl + units=(${(f)"$( systemctl --full list-units | sed -e 's/ .*//' )"}) + _wanted keys expl 'units' compadd "$units[@]" +} + +# list the job completions. +_systemd_jobs(){ + local -a jobs + local expl + jobs=(${(f)"$( systemctl --full list-jobs | sed -e 's/ .*//' )"}) + _wanted keys expl 'jobs' compadd "$jobs[@]" +} + +# list the snapshot completions. +_systemd_snapshots(){ + local -a ss + local expl + ss=(${(f)"$( + systemctl dump | sed -n -e 's/^-> Unit \(.*\.snapshot\):/\1/p' + )"}) + _wanted keys expl 'snapshots' compadd "$ss[@]" +} + +_systemctl(){ + local -a _systemctl_cmds + + # Determine the sub commands + #$(systemctl --help | sed -n -e 's/^ \([a-z]\)/\1/p' | sed -e 's/ .*//') + _systemctl_cmds=( + list-units start stop reload restart try-restart reload-or- + restart reload-or-try-restart isolate kill is-active status show + reset-failed enable disable is-enabled load list-jobs cancel + monitor dump dot snapshot delete daemon-reload daemon-reexec show- + environment set-environment unset-environment default rescue + emergency halt poweroff reboot kexec exit + ) + + local curcontext="$curcontext" state line expl + typeset -A opt_args + + # Initial flags + _arguments -A '-*' \ + '--help[Show help]' \ + '--version[Show package version]' \ + '(-a,--all)'{-a,--all}'[Show all units/properties, including dead/empty ones]' \ + '--full[Dont ellipsize unit names on output]' \ + '--failed[Show only failed units]' \ + '--fail[When queueing a new job, fail if conflicting jobs are pending]' \ + '--ignore-dependencies[ignore dependencies]' \ + '(-p,--privileged)'{-p,--privileged}'[Acquire privileges before execution]' \ + '(-q,--quiet)'{-q,--quiet}'[Suppress output]' \ + '--no-block[Do not wait until operation finished]' \ + '--no-wall[Dont send wall message before halt/power-off/reboot]' \ + '--no-reload[dont reload daemon configuration]' \ + '--no-pager[Do use pager]' \ + '--no-ask-password[Do not ask for system passwords]' \ + '--order[When generating graph for dot, show only order]' \ + '--require[When generating graph for dot, show only requirement]' \ + '--system[Connect to system manager]' \ + '--user[Connect to user service manager]' \ + '--global[Enable/disable unit files globally]' \ + '(-f,--force)'{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ + '--defaults[When disabling unit files, remove default symlinks only]' \ + '*::command:->subcmd' && return 0 + + # Complete subcommands. + if (( CURRENT == 1 )); then + _describe -t commands "command" _systemctl_cmds + return + fi + + # handle arguments to the subcommands. + case $words[1] in + start|restart|reload|stop|status|try-restart|reload-or-restart|reload-or-try-restart|isolate|kill|is-active|show|reset-failed|enable|disable|is-enabled|load) + # many units can be listed + _arguments "*:key:_systemd_units" + ;; + + cancel) _arguments "*:key:_systemd_jobs" ;; + + # snapshots + snapshot) _normal ;; + delete) _arguments "*:key:_systemd_snapshots" ;; + + # no arguments + dump|dot|monitor|daemon-reload|daemon-reexec|show-environment|default|rescue|emergency|halt|poweroff|reboot|kexec|exit|list-jobs|list-units) + ;; + + *) _message "unknown systemctl command: $words[1]" ;; + esac +} + +_systemctl "$@" + -- cgit v1.2.3 From cfdb417a6b91364706a8fd5ba319eac086d0d568 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sat, 20 Aug 2011 07:44:39 +0000 Subject: 29707: Completion/Unix/Command/_ln: New _ln completer --- ChangeLog | 7 +++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_ln | 76 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_ln (limited to 'Completion/Unix/Command/.distfiles') diff --git a/ChangeLog b/ChangeLog index ff7d8d384..a7d2c0bac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-20 Nikolai Weibull + + * 29707: Completion/Unix/Command/.distfiles, + Completion/Unix/Command/_ln: New _ln completer. + 2011-08-18 Mikael Magnusson * unposted: Completion/Linux/Command/.distfiles, @@ -15318,5 +15323,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5442 $ +* $Revision: 1.5443 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 696faea88..22e0a4fbe 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -111,6 +111,7 @@ _last _ldd _less _links +_ln _loadkeys _locate _look diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln new file mode 100644 index 000000000..89b7177ab --- /dev/null +++ b/Completion/Unix/Command/_ln @@ -0,0 +1,76 @@ +#compdef ln gln + +local curcontext="$curcontext" state line ret=1 +local -A opt_args + +local -a args +args=( + '-f[remove existing destination files]' + '-s[create symbolic links instead of hard links]') + +local -a opts + +local variant +_pick_variant -r variant gnu=gnu unix --help +if [[ $variant == gnu ]]; then + opts=(-S) + args=( + '(-b --backup)-b[create a backup of each existing destination file]' \ + '(-b --backup)--backup=[create a backup of each existing destination file]::method:(( + none\:"never create backups" + off\:"never create backups" + numbered\:"create numbered backup" + t\:"create numbered backup" + existing\:"same as numbered if numbered backups exist, otherwise same as simple" + nil\:"same as numbered if numbered backups exist, otherwise same as simple" + simple\:"always create simple backups" + never\:"always create simple backups"))' + '(-d -F --directory)'{-d,-F,--directory}'[allow the superuser to attempt to hard link directories]' + '(-f --force)'{-f,--force}'[remove existing destination files]' + '(-i --interactive)'{-i,--interactive}'[prompt before removing destination files]' + '(-L --logical)'{-L,--logical}'[create hard links to symbolic link references]' + '(-n --no-dereference)'{-n,--no-dereference}'[treat destination symbolic link to a directory as if it were a normal file]' + '(-P --physical)'{-P,--physical}'[create hard links directly to symbolic links]' + '(-s --symbolic)'{-s,--symbolic}'[create symbolic links instead of hard links]' + '(-S --suffix)'{-S,--suffix=}'[override default backup suffix]:suffix' + '(-t --target-directory)'{-t,--target-directory=}'[specify directory in which to create the links]: :_directories' + '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as a normal file]' + '(-v --verbose)'{-v,--verbose}'[print name of each linked file]' + '--help[display usage information and exit]' + '--version[display version information and exit]') +elif (( ${+builtins[ln]} )); then + args+=( + '-d[attempt to hard link directories]' + {-h,-n}'[do not dereference destination]' + '-i[prompt before removing destination files]') +elif [[ $OSTYPE == darwin* ]]; then + args+=( + '-F[remove existing destination directories]' + {-h,-n}'[do not dereference destination]' + '-i[prompt before removing destination files]' + '-v[print name of each linked file]') +fi + +_arguments -s $opts \ + $args \ + ':link target:_files' \ + '*:: :->files' && ret=0 + +case $state in + (files) + if [[ $variant == gnu && -n ${opt_args[(I)-t|--target-directory]} ]]; then + _wanted files expl 'link target' _files && ret=0 + else + if (( CURRENT == 2 )); then + local expl + _wanted files expl 'additional link target or link name' _files && ret=0 + else + _alternative \ + 'link-targets:additional link target:_files' \ + 'target-directories:target directory:_directories' && ret=0 + fi + fi + ;; +esac + +return ret -- cgit v1.2.3 From d47847c5f5c89f2ce4cfe53857086ce0f0037c8f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 24 Nov 2011 09:16:40 +0000 Subject: 29915: new nm completion --- ChangeLog | 7 ++++++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_nm | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_nm (limited to 'Completion/Unix/Command/.distfiles') diff --git a/ChangeLog b/ChangeLog index e29cd0730..3645503f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-24 Peter Stephenson + + * 29915: Completion/Unix/Command/.distfiles, + Completion/Unix/Command/_nm: new nm completion. + 2011-11-23 Peter Stephenson * Ignacy Gawędzki: 29912: Completion/Unix/Command/_ssh: add "--" @@ -15604,5 +15609,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5504 $ +* $Revision: 1.5505 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 22e0a4fbe..a89b7d923 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -141,6 +141,7 @@ _mysqldiff _ncftp _netcat _nice +_nm _nmap _notmuch _npm diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm new file mode 100644 index 000000000..276a38f19 --- /dev/null +++ b/Completion/Unix/Command/_nm @@ -0,0 +1,29 @@ +#compdef nm + +# This is a stub. It's main reason for existence is to offer +# object files with nm. Feel free to extend it. If you do, remove +# this comment. + +local state context line expl +local -A opt_args +local -a args +integer ret=1 + +if _pick_variant gnu='Free Soft' unix --version; then + args+=(-s --) +fi +args+=('*:file:->file') + +_arguments "$args[@]" && ret=0 + +case $state in + (file) + _alternative \ + "object-files:object file:_path_files -g '*.o'" \ + "executable-files:executable file:_path_files -g '*(*)'" \ + "dynamic-libraries:dynamic library:_path_files -g '*.so'" \ + "static-libraries:static library:_path_files -g '*.a'" && ret=0 + ;; +esac + +return ret -- cgit v1.2.3