diff --git a/src/_console b/src/_console index 2d11e43..3ed8dd7 100644 --- a/src/_console +++ b/src/_console @@ -35,30 +35,38 @@ # ------- # # * loranger (https://github.com/loranger) -# * Yohan Tambè (https://github.com/Cronos87) +# * Yohan Tamb (https://github.com/Cronos87) # # ------------------------------------------------------------------------------ -_find_console () { - echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)" +_console_find_console() { + echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)" } -_console_get_command_list () { - IFS=" " - `_find_console` --no-ansi | \ - sed "1,/Available commands/d" | \ - awk '/ [a-z]+/ { print $0 }' | \ - sed -E 's/^[ ]+//g' | \ - sed -E 's/[:]+/\\:/g' | \ - sed -E 's/[ ]{2,}/\:/g' +_console_get_command_list() { + IFS=" " + `_console_find_console` --no-ansi | \ + sed "1,/Available commands/d" | \ + awk '/ [a-z]+/ { print $0 }' | \ + sed -E 's/^[ ]+//g' | \ + sed -E 's/[:]+/\\:/g' | \ + sed -E 's/[ ]{2,}/\:/g' } -_console () { - local -a commands - IFS=$'\n' - commands=(`_console_get_command_list`) - _describe 'commands' commands +_console() { + local -a commands + IFS=$'\n' + commands=(`_console_get_command_list`) + _describe 'commands' commands } compdef _console php console compdef _console console + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/src/_cppcheck b/src/_cppcheck index e8ab3fe..859f656 100644 --- a/src/_cppcheck +++ b/src/_cppcheck @@ -49,12 +49,9 @@ _cppcheck_files() { } _cppcheck() { - local curcontext="$curcontext" state line - typeset -A opt_args - local check_ids='(all warning style performance portability information unusedFunction missingInclude)' - _arguments -C \ + _arguments \ "--addon=[Execute addon]" \ "--addon-python=[Specify the python interpreter]: :_files" \ "--cppcheck-build-dir=[Analysis output directory]:directory:_files -/" \ diff --git a/src/_dad b/src/_dad index 40d523c..f925377 100644 --- a/src/_dad +++ b/src/_dad @@ -39,30 +39,37 @@ # ------------------------------------------------------------------------------ _dad() { - local -a commands + typeset -A opt_args + local context state line + local curcontext="$curcontext" - commands=( - "start:Start aria2c daemon" - "stop:Stop aria2c daemon" - ) + local -a commands=( + "start:Start aria2c daemon" + "stop:Stop aria2c daemon" + ) - _arguments -C \ - '(- 1 *)'-h"[Show help and exit]" \ - "-d[Set download dir]:download_dir:->val" \ - "-s[Set secret token]:secret_token:->val" \ - "-u[Set aria2c username]:username:->val" \ - "-p[Set aria2c password]:password:->val" \ - '1:cmd:->cmds' \ - '*: : :->args' \ + _arguments -C \ + '(- 1 *)'-h"[Show help and exit]" \ + "-d[Set download dir]:download_dir:->val" \ + "-s[Set secret token]:secret_token:->val" \ + "-u[Set aria2c username]:username:->val" \ + "-p[Set aria2c password]:password:->val" \ + '1:cmd:->cmds' \ + '*: : :->args' - case "$state" in - (cmds) - _describe -t commands 'commands' commands - ;; - (*) - ;; - esac + case "$state" in + (cmds) + _describe -t commands 'commands' commands + ;; + esac } _dad +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/src/_gist b/src/_gist index 1db566e..561213e 100644 --- a/src/_gist +++ b/src/_gist @@ -61,21 +61,21 @@ _arguments -C \ '(-l --list)'{-l,--list}'[List all gists for user ]::user' \ '(-h --help)'{-h,--help}'[print options help]' \ '(-v --version)'{-v,--version}'[print version]' \ - '(-r --read)'{-r,--read}'[Read a gist and print out the contents]:user gists:user_gists' \ + '(-r --read)'{-r,--read}'[Read a gist and print out the contents]:user gists:_gist_read_gists' \ '*: :_files' && ret=0 -_user_gists_cache_policy() { +_gist_cache_policy() { # rebuild if cache is more than a day old local -a oldp oldp=( "$1"(mh+1) ) (( $#oldp )) } -user_gists() { +_gist_read_gists() { local update_policy ret=1 zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _user_gists_cache_policy + zstyle ":completion:${curcontext}:" cache-policy _gist_cache_policy fi # stores the gists of the logged in user in the format ID[Description] diff --git a/src/_optirun b/src/_optirun index dbd01fc..3e53e41 100644 --- a/src/_optirun +++ b/src/_optirun @@ -39,29 +39,24 @@ # # ------------------------------------------------------------------------------ -local curcontext="$curcontext" state line -typeset -A opt_args - -local -a arguments - -arguments=( - '--version[output version information]' - '(-h --help)'{-h,--help}'[show help]' - '(-c --vgl-compress)'{-c,--vgl-compress}'[image transport method]:method:(proxy jpeg rgb xb yuv)' - '--failsafe[run a program even if the nvidia card is unavailable]:boolean:(true false)' - '--no-failsafe[do not run a program if the nvidia card is unavailable]' - '--vgl-options[options to be passed to vglrun (example: +tr)]' - '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress all logging messages]' - '(-v --verbose)'{-v,--verbose}'[increase the verbosity level of log messages]' - '--debug[set the verbosity level to the maximum]' - '(-b --bridge)'{-b,--bridge}'[specify bridge library to use: VirtualGL, Primus or auto]:method:(auto primus virtualgl none)' - '(-d --display)'{-d,--display}'[the X display number to use]' - '(-C --config)'{-C,--config}'[retrieve settings for Bumblebee from FILE]:file:_files' - '(-l --ldpath)'{-l,--ldpath}'[PATH the libraries like libGL.so are searched in]:file:_files' - '--primus-ldpath[a colon-separated list of paths which are searched for the primus libGL.so.1]:file:_files' - '(-s --socket)'{-s,--socket}'[use FILE for communication with the daemon]:file:_files' - '--no-xorg[do not start secondary X server (implies -b none)]' - '*::arguments: _normal' +local -a arguments=( + '--version[output version information]' + '(-h --help)'{-h,--help}'[show help]' + '(-c --vgl-compress)'{-c,--vgl-compress}'[image transport method]:method:(proxy jpeg rgb xb yuv)' + '--failsafe[run a program even if the nvidia card is unavailable]:boolean:(true false)' + '--no-failsafe[do not run a program if the nvidia card is unavailable]' + '--vgl-options[options to be passed to vglrun (example: +tr)]' + '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress all logging messages]' + '(-v --verbose)'{-v,--verbose}'[increase the verbosity level of log messages]' + '--debug[set the verbosity level to the maximum]' + '(-b --bridge)'{-b,--bridge}'[specify bridge library to use: VirtualGL, Primus or auto]:method:(auto primus virtualgl none)' + '(-d --display)'{-d,--display}'[the X display number to use]:display:_x_display' + '(-C --config)'{-C,--config}'[retrieve settings for Bumblebee from FILE]:file:_files' + '(-l --ldpath)'{-l,--ldpath}'[PATH the libraries like libGL.so are searched in]:file:_files -/' + '--primus-ldpath[a colon-separated list of paths which are searched for the primus libGL.so.1]:file:_files' + '(-s --socket)'{-s,--socket}'[use FILE for communication with the daemon]:file:_files' + '--no-xorg[do not start secondary X server (implies -b none)]' + '*::arguments: _normal' ) _arguments $arguments diff --git a/src/_ralio b/src/_ralio index 0a42270..eaa679b 100644 --- a/src/_ralio +++ b/src/_ralio @@ -28,8 +28,8 @@ # Description # ----------- # -# Completion script for ralio (https://github.com/oesmith/ralio), a -# Rally client +# Completion script for ralio (https://github.com/oesmith/ralio) +# a Rally client # # ------------------------------------------------------------------------------ # Authors @@ -41,98 +41,89 @@ _ralio () { - local curcontext="$curcontext" state line - typeset -A opt_args + local curcontext="$curcontext" state line + typeset -A opt_args - _arguments -C \ - ':command:->command' \ - '*::options:->options' \ + _arguments -C \ + ':command:->command' \ + '*::options:->options' - case $state in - (command) + case $state in + (command) + local -a subcommands=( + "backlog:Show the product backlog" + "sprint:Show the current team iteration" + "show:Show related information for an individual story, defect or task" + "open:Open a story, defect or task in a web browser" + "start:Set a task, defect or story state to in-progress and assign it to you" + "finish:Set a task, defect or story state to completed and assign it to you" + "abandon:Set a task, defect or story state to defined and clear the owner" + "block:Set a task, defect or story state to blocked" + "unblock:Set a task, defect or story state to unblocked" + "current:Show your current tasks and stories" + "point:Set the points for a story or defect" + "task:Allow you to create and delete story tasks." + "configure:Set your Rally configurations." + ) + _describe -t commands 'ralio commands' subcommands - local -a subcommands - subcommands=( - "backlog:Show the product backlog" - "sprint:Show the current team iteration" - "show:Show related information for an individual story, defect or task" - "open:Open a story, defect or task in a web browser" - "start:Set a task, defect or story state to in-progress and assign it to you" - "finish:Set a task, defect or story state to completed and assign it to you" - "abandon:Set a task, defect or story state to defined and clear the owner" - "block:Set a task, defect or story state to blocked" - "unblock:Set a task, defect or story state to unblocked" - "current:Show your current tasks and stories" - "point:Set the points for a story or defect" - "task:Allow you to create and delete story tasks." - "configure:Set your Rally configurations." - ) - _describe -t commands 'ralio commands' subcommands - - _arguments -C \ - {-V,--version}"[display version information]" \ - {-h,--help}"[output usage information]" - ;; - - (options) - case $line[1] in - - - (sprint) - _arguments \ - "-t[Show tasks]" \ - "-p[Project name]" \ - "-f[Filter results]" + _arguments \ + {-V,--version}"[display version information]" \ + {-h,--help}"[output usage information]" + ;; + (options) + case $line[1] in + (sprint) + _arguments \ + "-t[Show tasks]" \ + "-p[Project name]" \ + "-f[Filter results]" ;; - (start | finish) - _arguments \ - '--pair[Pair programming partner]' \ - "--resolution[Resolution status]" \ - "--rootcause[Root cause]" - ;; + (start | finish) + _arguments \ + '--pair[Pair programming partner]' \ + "--resolution[Resolution status]" \ + "--rootcause[Root cause]" + ;; - (task) - __ralio-task - ;; + (task) + __ralio-task + ;; - esac - ;; - esac + esac + ;; + esac } __ralio-task () { - local curcontext="$curcontext" state line - typeset -A opt_args + local curcontext="$curcontext" state line + typeset -A opt_args - _arguments -C \ - ':command:->command' \ - '*::options:->options' + _arguments \ + ':command:->command' \ + '*::options:->options' - case $state in - (command) + case $state in + (command) + local -a subcommands=( + "create:Create a new task" + "delete:Delete a task" + ) + _describe -t commands 'ralio task' subcommands + ;; - local -a subcommands - subcommands=( - "create:Create a new task" - "delete:Delete a task" - ) - _describe -t commands 'ralio task' subcommands - ;; - - (options) - case $line[1] in - - (create|delete) - _arguments \ + (options) + case $line[1] in + (create|delete) + _arguments \ -n"[Name of the new task]" \ -t"[Name of the parent task]" - ;; - - esac - ;; - esac + ;; + esac + ;; + esac } _ralio "$@" diff --git a/src/_redis-cli b/src/_redis-cli index 0320f9c..aa3647b 100644 --- a/src/_redis-cli +++ b/src/_redis-cli @@ -36,9 +36,7 @@ # # ------------------------------------------------------------------------------ - -local -a _1st_arguments -_1st_arguments=( +local -a redis_commands=( 'append:append a value to a key' 'auth:authenticate to the server' 'bgrewriteeaof:asynchronously rewrite the append-only file' @@ -163,17 +161,11 @@ _1st_arguments=( 'zunionstore:add multiple sorted sets and store the resulting sorted set in a new key' ) -local expl - _arguments \ '(-v --version)'{-v,--version}'[show version]' \ '(-h --help)'{-h,--help}'[show help]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "redis-cli subcommand" _1st_arguments - return -fi + '1::command:{ _describe -t commands "redis-cli subcommand" redis_commands }' \ + && return 0 # Local Variables: # mode: Shell-Script diff --git a/src/_rmlint b/src/_rmlint index 5730ac7..e66c5b2 100644 --- a/src/_rmlint +++ b/src/_rmlint @@ -420,3 +420,11 @@ _rmlint() { } _rmlint "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/src/_shellcheck b/src/_shellcheck index 20d023e..daab776 100644 --- a/src/_shellcheck +++ b/src/_shellcheck @@ -53,7 +53,7 @@ _arguments \ {-V,--version}'[print version information]' \ {-W,--wiki-link-count=}'[specify number of wiki links to show, when applicable]:number' \ {-x,--external-sources}'[allow outside sources]' \ - '--help[show this usage summary and exit]' \ + '(- *)--help[show this usage summary and exit]' \ '*: :_files' # Local Variables: diff --git a/src/_wemux b/src/_wemux index 691636f..0fde5d8 100644 --- a/src/_wemux +++ b/src/_wemux @@ -37,9 +37,6 @@ # * Akira Maeda # # ------------------------------------------------------------------------------ -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------ _wemux() { @@ -80,3 +77,11 @@ _wemux() { } _wemux + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/src/_xsel b/src/_xsel index 460d992..43f9d20 100644 --- a/src/_xsel +++ b/src/_xsel @@ -39,7 +39,7 @@ # ------------------------------------------------------------------------------ local input='(-a --append -f --follow -i --input)' -local operation='(-c --clear -d --delete -k --keep -x --exchange)' +local operation='(-c --clear -d --delete -k --keep -x --exchange)' local selection='(-p --primary -s --secondary -b --clipboard)' _arguments -s \ @@ -58,6 +58,14 @@ _arguments -s \ {-t,--selectionTimeout}'[specify the timeout in milliseconds within which the selection must be retrieved]:number' \ {-l,--logfile}'[specify the file to log errors to when detached (default $HOME/.xsel.log)]:log file:_files' \ {-n,--nodetach}'[do not detach from the controlling terminal]' \ - {-h,--help}'[display usage information and exit]' \ + '(- *)'{-h,--help}'[display usage information and exit]' \ {-v,--verbose}'[print informative messages; additional instances of -v raise the debugging level]' \ - '--version[output version information and exit]' + '(- *)--version[output version information and exit]' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et