follow normal zsh case conventions in some functions

This commit is contained in:
Oliver Kiddle 2017-10-28 00:23:07 +02:00
parent 29ce259ea5
commit 538f2a0287
12 changed files with 353 additions and 382 deletions

View File

@ -38,30 +38,24 @@
#
# ------------------------------------------------------------------------------
_afew() {
_arguments -C \
'(- 1 *)'-h"[Show help and exit]" \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -m --move-mails)"{-w,--watch}"[Continuously monitor the mailbox for new messages matching the given query]" \
"(-c --classify -l --learn= -u --update -U --update-reference -m --move-mails -w --watch)"{-t,--tag}"[Run the tag filters]" \
"(-c --classify -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-l,--learn=}"[Train category with the messages matching query]" \
"(-c --classify -l --learn= -t --tag -U --update-reference -m --move-mails -w --watch)"{-u,--update}"[Update the categories (requires no query)]" \
"(-c --classify -l --learn= -t --tag -u --update -m --move-mails -w --watch)"{-U,--update-reference}"[Update the reference category (takes quite some time) (requires no query)]" \
"(-l --learn= -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-c,--classify}"[Classify each message matching the iven query]" \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -w --watch)"{-m,--move-mails}"[Move mail files between maildir folders]" \
"(-n --all)"{-a,--all}"[Operate on all email]" \
"(-a --new)"{-n,--new}"[Operate on all new email]" \
{-C,--notmuch-config=}"[Path to notmuch configuration file]:files:_files" \
{-e,--enable-filters=}"[Flter classes to use]:filters" \
{-d,--dry-run}"[Dont change the DB]" \
{-R,--reference-set-size=}"[Size of the reference set (default: 1000)]:size:" \
{-T,--reference-set-timeframe-days=}"[Do not use emails older than DAYS days (default: 30)]:days:" \
{--verbose,-v}"[Be more verbose]" \
'*:Query:' \
}
_afew
_arguments \
'(- 1 *)-h[display usage information]' \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -m --move-mails)"{-w,--watch}"[continuously monitor the mailbox for new messages matching the given query]" \
"(-c --classify -l --learn= -u --update -U --update-reference -m --move-mails -w --watch)"{-t,--tag}"[run the tag filters]" \
"(-c --classify -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-l,--learn=}"[train category with the messages matching query]" \
"(-c --classify -l --learn= -t --tag -U --update-reference -m --move-mails -w --watch)"{-u,--update}"[update the categories (requires no query)]" \
"(-c --classify -l --learn= -t --tag -u --update -m --move-mails -w --watch)"{-U,--update-reference}"[update the reference category (takes quite some time) (requires no query)]" \
"(-l --learn= -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-c,--classify}"[classify each message matching the iven query]" \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -w --watch)"{-m,--move-mails}"[move mail files between maildir folders]" \
"(-n --all)"{-a,--all}"[operate on all email]" \
"(-a --new)"{-n,--new}"[operate on all new email]" \
{-C,--notmuch-config=}"[specify path to notmuch configuration file]:files:_files" \
{-e,--enable-filters=}"[specify filter classes to use]:filter" \
{-d,--dry-run}"[don't change the DB]" \
{-R,--reference-set-size=}"[specify size of the reference set]:size [1000]" \
{-T,--reference-set-timeframe-days=}"[don't use emails older than specified age]:age (days) [30]" \
{--verbose,-v}"[be more verbose]" \
'*: :_guard "^-*" query'
# Local Variables:
# mode: Shell-Script

View File

@ -39,9 +39,9 @@
# ------------------------------------------------------------------------------
local curcontext="$curcontext" state line _packages _opts ret=1
local curcontext="$curcontext" state line _opts ret=1
_arguments -C -A "-v" -A "--version" \
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'1: :->cmds' \
'*:: :->args' && ret=0
@ -49,35 +49,34 @@ _arguments -C -A "-v" -A "--version" \
case $state in
cmds)
_values "bower command" \
"cache[Manage bower cache]" \
"help[Display help information about Bower]" \
"home[Opens a package homepage into your favorite browser]" \
"info[Info of a particular package]" \
"init[Interactively create a bower.json file]" \
"install[Install a package locally]" \
"link[Symlink a package folder]" \
"list[List local packages - and possible updates]" \
"login[Authenticate with GitHub and store credentials]" \
"lookup[Look up a package URL by name]" \
"prune[Removes local extraneous packages]" \
"register[Register a package]" \
"search[Search for a package by name]" \
"update[Update a local package]" \
"uninstall[Remove a local package]" \
"unregister[Remove a package from the registry]" \
"version[Bump a package version]"
"cache[manage bower cache]" \
"help[display help information about Bower]" \
"home[opens a package homepage into your favorite browser]" \
"info[info of a particular package]" \
"init[interactively create a bower.json file]" \
"install[install a package locally]" \
"link[symlink a package folder]" \
"list[list local packages - and possible updates]" \
"login[authenticate with GitHub and store credentials]" \
"lookup[look up a package URL by name]" \
"prune[removes local extraneous packages]" \
"register[register a package]" \
"search[search for a package by name]" \
"update[update a local package]" \
"uninstall[remove a local package]" \
"unregister[remove a package from the registry]" \
"version[bump a package version]" && ret=0
_arguments \
'(--force)--force[Makes various commands more forceful]' \
'(--json)--json[Output consumable JSON]' \
'(--log-level)--log-level[What level of logs to report]' \
'(--offline)--offline[Do not hit the network]' \
'(--quiet)--quiet[Only output important information]' \
'(--silent)--silent[Do not output anything, besides errors]' \
'(--verbose)--verbose[Makes output more verbose]' \
'(--allow-root)--allow-root[Allows running commands as root]' \
'(--version)--version[Output Bower version]' \
'(--no-color)--no-color[Disable colors]'
ret=0
'(--force)--force[make various commands more forceful]' \
'(--json)--json[output consumable JSON]' \
'(--log-level)--log-level[what level of logs to report]' \
"(--offline)--offline[don't hit the network]" \
'(--quiet)--quiet[only output important information]' \
"(--silent)--silent[don't output anything, besides errors]" \
'(--verbose)--verbose[make output more verbose]' \
'(--allow-root)--allow-root[allow running commands as root]' \
'(--version)--version[output Bower version]' \
'(--no-color)--no-color[disable colors]' && ret=0
;;
args)
case $line[1] in
@ -98,54 +97,46 @@ case $state in
'update' \
'uninstall' \
'unregister' \
'version'
ret=0
'version' && ret=0
;;
(home|info|init|link|lookup|prune|register|search|unregister)
_arguments \
'(--help)--help[Show help message]'
ret=0
'(--help)--help[show help message]' && ret=0
;;
install)
_arguments \
'(--force-latest)--force-latest[Force latest version on conflict]' \
'(--help)--help[Show help message]' \
'(--production)--production[Do not install project devDependencies]' \
'(--save)--save[Save installed packages into the project''s bower.json dependencies]' \
'(--save-dev)--save-dev[Save installed packages into the project''s bower.json devDependencies]'
ret=0
'(--force-latest)--force-latest[force latest version on conflict]' \
'(--help)--help[show help message]' \
"(--production)--production[don't install project devDependencies]" \
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
;;
list)
_arguments \
'(--help)--help[Show help message]' \
'(--paths)--paths[Generate a simple JSON source mapping]' \
'(--relative)--relative[Make paths relative to the directory config property, which defaults to bower_components]'
ret=0
'(--help)--help[show help message]' \
'(--paths)--paths[generate a simple JSON source mapping]' \
'(--relative)--relative[make paths relative to the directory config property, which defaults to bower_components]' && ret=0
;;
login)
_arguments \
'(--help)--help[Show help message]' \
'(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]'
ret=0
'(--help)--help[show help message]' \
'(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' && ret=0
;;
uninstall)
_arguments \
'(--help)--help[Show help message]' \
'(--save)--save[Save installed packages into th projects''s bower.json dependencies]' \
'(--save-dev)--save-dev[Save installed packages into th projects''s bower.json devDependencies]'
ret=0
'(--help)--help[show help message]' \
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
;;
update)
_arguments \
'(--force-latest)--force-latest[Force latest version on conflict]' \
'(--help)--help[Show help message]' \
'(--production)--production[Do not install project devDependencies]'
ret=0
'(--force-latest)--force-latest[force latest version on conflict]' \
'(--help)--help[show help message]' \
"(--production)--production[don't install project devDependencies]" && ret=0
;;
version)
_arguments \
'(--message)--message[Custom git commit and tag message]'
ret=0
'(--message)--message[custom git commit and tag message]' && ret=0
;;
exec)
_normal && ret=0
@ -154,7 +145,7 @@ case $state in
_opts=( $(bower help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
_opts+=( $(bower help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
if [[ $_opts != "" ]]; then
_values 'options' $_opts && ret=0
_values 'option' $_opts && ret=0
fi
;;
esac

View File

@ -40,54 +40,56 @@
_stack () {
_arguments \
--version'[Show version]' \
--help'[Show this help text]' \
'--docker*''[Run "stack --docker-help" for details]' \
--verbosity'[Verbosity: silent, error, warn, info, debug]' \
{-v,--verbose}'[Enable verbose mode: verbosity level "debug"]' \
--system-ghc'[Enable using the system installed GHC (on the PATH) if available and a matching version]' \
--no-system-ghc'[Disable using the system installed GHC (on the PATH) if available and a matching version]' \
--install-ghc'[Enable downloading and installing GHC if necessary (can be done manually with stack setup)]' \
--no-install-ghc'[Disable downloading and installing GHC if necessary (can be done manually with stack setup)]' \
--arch'[System architecture, e.g. i386, x86_64]' \
--os'[Operating system, e.g. linux, windows]' \
{-j,--jobs}'[Number of concurrent jobs to run]' \
--extra-include-dirs'[Extra directories to check for C header files]' \
--extra-lib-dirs'[Extra directories to check for libraries]' \
--skip-ghc-check'[Enable skipping the GHC version and architecture check]' \
--no-skip-ghc-check'[Disable skipping the GHC version and architecture check]' \
--skip-msys'[Enable skipping the local MSYS installation (Windows only)]' \
--no-skip-msys'[Disable skipping the local MSYS installation (Windows only)]' \
--resolver'[Override resolver in project file]' \
--no-terminal'[Override terminal detection in the case of running in a false terminal]' \
--stack-yaml'[Override project stack.yaml file (overrides any STACK_YAML environment variable)]' \
--version'[display version information]' \
--help'[display usage information]' \
'--docker*''[run "stack --docker-help" for details]' \
--verbosity'[verbosity: silent, error, warn, info, debug]' \
{-v,--verbose}'[enable verbose mode: verbosity level "debug"]' \
--system-ghc'[enable using the system installed GHC (on the PATH) if available and a matching version]' \
--no-system-ghc'[disable using the system installed GHC (on the PATH) if available and a matching version]' \
--install-ghc'[enable downloading and installing GHC if necessary (can be done manually with stack setup)]' \
--no-install-ghc'[disable downloading and installing GHC if necessary (can be done manually with stack setup)]' \
--arch'[system architecture, e.g. i386, x86_64]' \
--os'[operating system, e.g. linux, windows]' \
{-j,--jobs}'[number of concurrent jobs to run]' \
--extra-include-dirs'[extra directories to check for C header files]' \
--extra-lib-dirs'[extra directories to check for libraries]' \
--skip-ghc-check'[enable skipping the GHC version and architecture check]' \
--no-skip-ghc-check'[disable skipping the GHC version and architecture check]' \
--skip-msys'[enable skipping the local MSYS installation (Windows only)]' \
--no-skip-msys'[disable skipping the local MSYS installation (Windows only)]' \
--resolver'[override resolver in project file]' \
--no-terminal'[override terminal detection in the case of running in a false terminal]' \
--stack-yaml'[override project stack.yaml file (overrides any STACK_YAML environment variable)]' \
'*: :__stack_modes'
}
__stack_modes () {
_values \
'subcommand' \
'build[Build the project(s) in this directory/configuration]' \
'install[Build executables and install to a user path]' \
'test[Build and test the project(s) in this directory/configuration]' \
'bench[Build and benchmark the project(s) in this directory/configuration]' \
'haddock[Generate haddocks for the project(s) in this directory/configuration]' \
'new[Create a brand new project]' \
'init[Initialize a stack project based on one or more cabal packages]' \
'solver[Use a dependency solver to try and determine missing extra-deps]' \
'setup[Get the appropriate ghc for your project]' \
'path[Print out handy path information]' \
'unpack[Unpack one or more packages locally]' \
'update[Update the package index]' \
'upgrade[Upgrade to the latest stack (experimental)]' \
'upload[Upload a package to Hackage]' \
'dot[Visualize your projects dependency graph using Graphviz dot]' \
'exec[Execute a command]' \
'ghc[Run ghc]' \
'ghci[Run ghci in the context of project(s)]' \
'ide[Run ide-backend-client with the correct arguments]' \
'runghc[Run runghc]' \
'clean[Clean the local packages]' \
'docker[Subcommands specific to Docker use]'
'build[build the project(s) in this directory/configuration]' \
'install[build executables and install to a user path]' \
'test[build and test the project(s) in this directory/configuration]' \
'bench[build and benchmark the project(s) in this directory/configuration]' \
'haddock[generate haddocks for the project(s) in this directory/configuration]' \
'new[create a brand new project]' \
'init[initialize a stack project based on one or more cabal packages]' \
'solver[use a dependency solver to try and determine missing extra-deps]' \
'setup[get the appropriate ghc for your project]' \
'path[print out handy path information]' \
'unpack[unpack one or more packages locally]' \
'update[update the package index]' \
'upgrade[upgrade to the latest stack (experimental)]' \
'upload[upload a package to Hackage]' \
'dot[visualize your projects dependency graph using Graphviz dot]' \
'exec[execute a command]' \
'ghc[run ghc]' \
'ghci[run ghci in the context of project(s)]' \
'ide[run ide-backend-client with the correct arguments]' \
'runghc[run runghc]' \
'clean[clean the local packages]' \
'docker[subcommands specific to Docker use]'
}
_stack "$@"

View File

@ -39,22 +39,17 @@
# ------------------------------------------------------------------------------
_subl() {
integer ret=1
local I="-h --help -v --version"
local -a args
args+=(
"(- *)"{-h,--help}'[Show help and exit]'
"(- *)"{-v,--version}'[Show version and exit]'
"($I)--project[Load the given project]:project:"
"($I)--command[Run the given command]:command:"
"($I -n --new-window)"{-n,--new-window}'[Open a new window]'
"($I -a --add)"{-a,--add}'[Add folders to the current window]'
"($I -w --wait)"{-w,--wait}'[Wait for the files to be closed before returning]'
"($I -b --background)"{-b,--background}'[Do not activate the application]'
)
_arguments $args[@] '*:file:_files' && ret=0
return ret
}
local I="-h --help -v --version"
local -a args
args+=(
"(- *)"{-h,--help}'[display usage information]'
"(- *)"{-v,--version}'[display version information]'
"($I)--project[load the given project]:project"
"($I)--command[run the given command]:command"
"($I -n --new-window)"{-n,--new-window}'[open a new window]'
"($I -a --add)"{-a,--add}'[add folders to the current window]'
"($I -w --wait)"{-w,--wait}'[wait for the files to be closed before returning]'
"($I -b --background)"{-b,--background}"[don't activate the application]"
)
_arguments "$args[@]" '*:file:_files'
_subl

View File

@ -39,16 +39,10 @@
# ------------------------------------------------------------------------------
_trash-list() {
_arguments -C \
'--version[Show programs version number and exit]' \
{-h,--help}'[Show help message and exit]' \
'*: :' \
}
_trash-list
_arguments \
'--version[show programs version number and exit]' \
{-h,--help}'[show help message and exit]' \
'*: :'
# Local Variables:
# mode: Shell-Script

View File

@ -39,21 +39,15 @@
# ------------------------------------------------------------------------------
_trash-put() {
_arguments -C \
'--version[Show programs version number and exit]' \
{-h,--help}'[Show help message and exit]' \
{-d,--directory}'[Remove empty directories - ignored (for GNU rm compabilty)]' \
{-f,--force}'[Ignore nonexistent arguments and never prompt - ignored (for GNU rm compabilty)]' \
{-i,--interactive}'[Prompt before every removal - ignored (for GNU rm compabilty)]' \
{-r,-R,--recursive}'[Remove directories and their content recursively - ignored (for GNU rm compabilty)]' \
{-v,--verbose}'[Explain what is being done]' \
'*: :_files' \
}
_trash-put
_arguments -C \
'--version[display version information]' \
{-h,--help}'[display usage information]' \
{-d,--directory}'[remove empty directories - ignored (for GNU rm compabilty)]' \
{-f,--force}'[ignore nonexistent arguments and never prompt - ignored (for GNU rm compabilty)]' \
{-i,--interactive}'[prompt before every removal - ignored (for GNU rm compabilty)]' \
{-r,-R,--recursive}'[remove directories and their content recursively - ignored (for GNU rm compabilty)]' \
{-v,--verbose}'[explain what is being done]' \
'*: :_files'
# Local Variables:
# mode: Shell-Script

View File

@ -56,7 +56,7 @@ _paths() {
_path_list+=$_path
done
_describe 'paths' _path_list
_describe 'path' _path_list
}
_filesystems() {
@ -68,96 +68,97 @@ _filesystems() {
'xenix' 'xfs' 'xiafs'
)
_describe 'file system types' _fs_types
_describe 'file system type' _fs_types
}
_udisksctl() {
typeset -A opt_args
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
_arguments -C \
'1:udisksctl commands:->cmds' \
'*:: :->cmd_args' \
'*:: :->cmd_args' && ret=0
case $state in
cmds)
local commands; commands=(
'help: Show help'
'info: Show info about an object'
'dump: Show info about all object'
'status: Shows high-level status'
'monitor: Monitor changes to objects'
'mount: Mount a filesystem'
'unmount: Unmount a filesystem'
'unlock: Unlock an encrypted device'
'lock: Lock an encrypted device'
'loop-setup: Set-up a loop device'
'loop-delete: Delete a loop device'
'power-off: Safely power off a drive'
'smart-simulate: Set SMART data for a drive'
'help:show help'
'info:show info about an object'
'dump:show info about all object'
'status:shows high-level status'
'monitor:monitor changes to objects'
'mount:mount a filesystem'
'unmount:unmount a filesystem'
'unlock:unlock an encrypted device'
'lock:lock an encrypted device'
'loop-setup:set-up a loop device'
'loop-delete:delete a loop device'
'power-off:safely power off a drive'
'smart-simulate:set SMART data for a drive'
)
_describe -t commands 'udisksctl commands' commands
_describe -t commands 'udisksctl command' commands && ret=0
;;
cmd_args)
case $words[1] in
info)
_arguments \
{-p,--object-path}'[Object to get information about]:object path:_paths' \
{-b,--block-device}'[Block device to get information about]:block device:_paths' \
{-d,--drive}'[Drive to get information about]:drives:_paths' \
{-p,--object-path}'[specify object to get information about]:object path:_paths' \
{-b,--block-device}'[specify block device to get information about]:block device:_paths' \
{-d,--drive}'[specify drive to get information about]:drive:_paths' && ret=0
;;
mount)
_arguments \
{-p,--object-path}'[Object to mount]:object path:_paths' \
{-b,--block-device}'[Block device to mount]:block device:_paths' \
{-t,--filesystem-type}'[Filesystem type to use]:fs type:_filesystems' \
{-o,--options}'[Mount options]' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-p,--object-path}'[specify object to mount]:object path:_paths' \
{-b,--block-device}'[specify block device to mount]:block device:_paths' \
{-t,--filesystem-type}'[specify filesystem type to use]:fs type:_filesystems' \
{-o,--options}'[mount options]' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
unmount)
_arguments \
{-p,--object-path}'[Object to unmount]:object path:_paths' \
{-b,--block-device}'[Block device to unmount]:block device:_paths' \
{-f,--force}'[Force/lazy unmount]' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-p,--object-path}'[object to unmount]:object path:_paths' \
{-b,--block-device}'[block device to unmount]:block device:_paths' \
{-f,--force}'[force/lazy unmount]' \
"(--no-user-interaction)--no-user-interaction[don't auhenticate the user if needed]" && ret=0
;;
unlock|lock)
_arguments \
{-p,--object-path}'[Object to lock/unlock]:object path:_paths' \
{-b,--block-device}'[Block device to lock/unlock]:block device:_paths' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-p,--object-path}'[object to lock/unlock]:object path:_paths' \
{-b,--block-device}'[block device to lock/unlock]:block device:_paths' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
loop-setup)
_arguments \
{-f,--file}'[File to set-up a loop device for]:files:_files' \
{-r,--read-only}'[Setup read-only device]' \
{-o,--offset}'[Start at <num> bytes into file]:offset in bytes:' \
{-s,--size}'[Limit size to <num> bytes]:limit in bytes:' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-f,--file}'[specify file to set-up a loop device for]:files:_files' \
{-r,--read-only}'[setup read-only device]' \
{-o,--offset}'[start at specified offset into file]:offset (bytes)' \
{-s,--size}'[limit size]:limit (bytes)' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
loop-delete)
_arguments \
{-p,--object-path}'[Object for loop device to delete]:object path:_paths' \
{-b,--block-device}'[Loop device to delete]:block device:_paths' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-p,--object-path}'[object for loop device to delete]:object path:_paths' \
{-b,--block-device}'[loop device to delete]:block device:_paths' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
power-off)
_arguments \
{-p,--object-path}'[Object path for ATA device]:object path:_paths' \
{-b,--block-device}'[Device file for ATA devic]:block device:_paths' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-p,--object-path}'[object path for ATA device]:object path:_paths' \
{-b,--block-device}'[device file for ATA devic]:block device:_paths' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
smart-simulate)
_arguments \
{-f,--file}'[File with libatasmart blob]:files:_files' \
{-p,--object-path}'[Object to get information about]:object path:_paths' \
{-b,--block-device}'[Block device to get information about]:block device:_paths' \
'(--no-user-interaction)--no-user-interaction[Do not authenticate the user if needed]' \
{-f,--file}'[file with libatasmart blob]:files:_files' \
{-p,--object-path}'[object to get information about]:object path:_paths' \
{-b,--block-device}'[block device to get information about]:block device:_paths' \
"(--no-user-interaction)--no-user-interaction[don't authenticate the user if needed]" && ret=0
;;
esac
;;
esac
return ret
}
_udisksctl "$@"

View File

@ -41,7 +41,7 @@
_ufw_logging() {
local main additional second
local params additional second
second=$words[2]
if [ ! -z $second ]; then
@ -60,8 +60,8 @@ _ufw_logging() {
"full"
)
_describe -t params 'On/Off' params
_describe -t additional 'Level' additional
_describe -t params 'on/off' params
_describe -t additional 'level' additional
}
@ -85,35 +85,34 @@ _ufw_delete() {
}
_ufw() {
local -a commands
local curcontext="$curcontext" ret=1
local -a state line commands
commands=(
"enable:Enables the firewall"
"disable:Disables the firewall"
"default:Set default policy"
"logging:Set logging to LEVEL"
"allow:Add allow rule"
"deny:Add deny rule"
"reject:Add reject rule"
"limit:Add limit rule"
"delete:Delete RULE"
"insert:Insert RULE at NUM"
"route:Add route RULE"
"reload:Reload firewall"
"reset:Reset firewall"
"status:Show firewall status"
"show:Show firewall report"
"version:Display version information"
"enable:enable the firewall"
"disable:disable the firewall"
"default:set default policy"
"logging:set logging level"
"allow:add allow rule"
"deny:add deny rule"
"reject:add reject rule"
"limit:add limit rule"
"delete:delete rule"
"insert:insert rule at position"
"route:add route rule"
"reload:reload firewall"
"reset:reset firewall"
"status:show firewall status"
"show:show firewall report"
"version:display version information"
)
_arguments -C -s -S -n \
'(- 1 *)'--version"[Show program\'s version number and exit]: :->full" \
'(- 1 *)'{-h,--help}'[Show help message and exit]: :->full' \
'(- 1 *)'--dry-run"[Don\'t modify anything, just show the changes]: :->cmds" \
'(- 1 *)'--version"[display version information]: :->full" \
'(- 1 *)'{-h,--help}'[display usage information]: :->full' \
'(- 1 *)'--dry-run"[don't modify anything, just show the changes]: :->cmds" \
'1:cmd:->cmds' \
'*:: :->args' \
'*:: :->args' && ret=0
case "$state" in
(cmds)
@ -124,19 +123,21 @@ _ufw() {
cmd=$words[1]
case "$cmd" in
(logging)
_ufw_logging
_ufw_logging && ret=0
;;
(delete)
_ufw_delete
_ufw_delete && ret=0
;;
(*)
return
_default && ret=0
;;
esac
;;
(*)
;;
esac
return ret
}
_ufw

View File

@ -38,73 +38,75 @@
#
# ------------------------------------------------------------------------------
local context state state_descr line
local curcontext="$curcontext" state state_descr line ret=1
typeset -A opt_args
local period="-d --days -h --hours -m --months -w --weeks"
_arguments : \
'--cleartop[Remove all top 10 entries]' \
'--config[Specify alternate configuration file]:file:_files' \
"($period)"{-d,--days}'[Show traffic for days]' \
"($period)"{-h,--hours}'[Show trafic for last 24 hours]' \
"($period)"{-m,--months}'[Show traffic for months]' \
"($period)"{-w,--weeks}'[Show traffic for 7 days]' \
'--dbdir[Specify database directory]:directory:_files -/' \
'(-D --debug)'{-D,--debug}'[Show additional debug output]' \
'--delete[Delete database and stop monitoring selected interface]' \
'--dumpdb[Dump database in parseable format]' \
'(--disable)--enable[Enable updates for selected interface]' \
'(--enable)--disable[Disable updates for selected interface]' \
'(-i --iface)'{-i,--iface}'[Specify interface for actions]:interface:->interface' \
'--iflist[List available interfaces]' \
'(-l --live)'{-l,--live}'[Display current transfer rate]:mode:->live' \
'--locale[Specify locale]:locale:' \
'--nick[Set nickname for alias]:nickname:' \
'--oneline[Traffic summary in one-line, parseable format]' \
'(-q --query)'{-q,--query}'[Force database query mode]' \
'(-r --reset)'{-r,--reset}'[Reset internal counters]' \
'--rebuildtotal[Reset total trafic counters]' \
'(-ru --rateunit)'{-ru,--rateunit}'[Swap configured rate unit]' \
'--savemerged[Write result of database merge]' \
'(-s --short)'{-s,--short}'[Use short output mode]' \
'--style[Modify content and style of output]:style:->style' \
'--sync[Synchronize internal counters]' \
'--testkernel[Test kernel boot time information]' \
'(-t --top10)'{-t,--top10}'[Show all time top 10 traffic days]' \
'-tr[Calculate amount of traffic in given time]:seconds:' \
'(-u --update)'{-u,--update}'[Update databases]' \
'--xml[Show database content in XML format]' \
'(-)'{-v,--version}'[Show current version]' \
'(-)'{-\?,--help}'[Show command summary]' \
'(-)--longhelp[Show complete options list]' \
_arguments -C : \
'--cleartop[remove all top 10 entries]' \
'--config[specify alternate configuration file]:file:_files' \
"($period)"{-d,--days}'[show traffic for days]' \
"($period)"{-h,--hours}'[show trafic for last 24 hours]' \
"($period)"{-m,--months}'[show traffic for months]' \
"($period)"{-w,--weeks}'[show traffic for 7 days]' \
'--dbdir[specify database directory]:directory:_files -/' \
'(-D --debug)'{-D,--debug}'[show additional debug output]' \
'--delete[delete database and stop monitoring selected interface]' \
'--dumpdb[dump database in parseable format]' \
'(--disable)--enable[enable updates for selected interface]' \
'(--enable)--disable[disable updates for selected interface]' \
'(-i --iface)'{-i,--iface}'[specify interface for actions]:interface:->interface' \
'--iflist[list available interfaces]' \
'(-l --live)'{-l,--live}'[display current transfer rate]:mode:->live' \
'--locale[specify locale]:locale:' \
'--nick[set nickname for alias]:nickname:' \
'--oneline[traffic summary in one-line, parseable format]' \
'(-q --query)'{-q,--query}'[force database query mode]' \
'(-r --reset)'{-r,--reset}'[reset internal counters]' \
'--rebuildtotal[reset total trafic counters]' \
'(-ru --rateunit)'{-ru,--rateunit}'[swap configured rate unit]' \
'--savemerged[write result of database merge]' \
'(-s --short)'{-s,--short}'[use short output mode]' \
'--style[modify content and style of output]:style:->style' \
'--sync[synchronize internal counters]' \
'--testkernel[test kernel boot time information]' \
'(-t --top10)'{-t,--top10}'[show all time top 10 traffic days]' \
'-tr[calculate amount of traffic in given time]:seconds:' \
'(-u --update)'{-u,--update}'[update databases]' \
'--xml[show database content in XML format]' \
'(-)'{-v,--version}'[show current version]' \
'(-)'{-\?,--help}'[show command summary]' \
'(-)--longhelp[show complete options list]' \
&& ret=0
case "$state" in
(live)
_values 'Live mode' \
'0[Packets per second]' \
'1[Traffic counters]'
_values 'live mode' \
'0[packets per second]' \
'1[traffic counters]' && ret=0
;;
(style)
_values 'Output style' \
'0[Narrow output]' \
'1[Enable bar column]' \
'2[Bar column with average traffic rate]' \
'3[Enable average traffic rate]' \
'4[Disable use of terminal control characters]'
_values 'output style' \
'0[narrow output]' \
'1[enable bar column]' \
'2[bar column with average traffic rate]' \
'3[enable average traffic rate]' \
'4[disable use of terminal control characters]' && ret=0
;;
(interface)
local interfaces="$(_call_program interfaces 'vnstat --iflist')"
interfaces="${interfaces#*:}"
_values -s + 'Interface' ${(z)interfaces}
_values -s + 'interface' ${(z)interfaces} && ret=0
;;
esac
return ret
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2

View File

@ -35,13 +35,13 @@ _vpnc-connect() {
'--ifname[visible name of the TUN/TAP interface]:name' \
'--ifmode[mode of TUN/TAP interface]: :_vpnc_tun_tap_modes' \
'--debug[show verbose debug messages]: :_vpnc_debug_levels' \
'--no-detach[Don'\''t detach from the console after login]' \
"--no-detach[don't detach from the console after login]" \
'--pid-file[store the pid of background process in the file]:pid file:_files' \
'--local-addr[local IP to use for ISAKMP/ESP/...]: :_hosts' \
'--local-port[local ISAKMP port number to use]: :_vpnc_isakmp_port_numbers' \
'--udp-port[local UDP port number to use]: :_vpnc_udp_port_numbers' \
'--dpd-idle[send DPD packet after not receiving anything for X seconds]: :_vpnc_dpd_idle_times' \
'--non-inter[Don'\''t ask anything, exit on missing options]' \
"--non-inter[don't ask anything, exit on missing options]" \
'--auth-mode[authentication mode]: :_vpnc_authentication_modes' \
'--ca-file[filename and path to the CA-PEM-File]:CA-PEM file:_files' \
'--ca-dir[path of the trusted CA-Directory]:CA directory:_files -/' \
@ -116,7 +116,7 @@ _vpnc_tun_tap_modes() {
(( $+functions[_vpnc_debug_levels] )) ||
_vpnc_debug_levels() {
local levels; levels=(
'0:do not print debug information'
"0:don't print debug information"
'1:print minimal debug information'
'2:show statemachine and packet/payload type information'
'3:dump everything excluding authentication data'

View File

@ -92,7 +92,7 @@ _yaourt_action_sync() {
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*-c[Remove old packages from cache]' \
'*-c[remove old packages from cache]' \
;;
sync_group)
_arguments -s : \
@ -213,110 +213,110 @@ _yaourt() {
# options for passing to _arguments: main pacman commands
typeset -a _yaourt_opts_commands
_yaourt_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
'-Q[query the package database]'
'-R[remove a package from the system]'
'-S[synchronize packages]'
'-U[upgrade a package]'
'-V[display version and exit]'
'-h[display usage information]'
'-B[backup pacman database]'
'-G[Get PKGBUILD]'
'-C[Clean backup files]'
'--stats[Package Statistics]'
'-G[get PKGBUILD]'
'-C[clean backup files]'
'--stats[package statistics]'
)
# options for passing to _arguments: options common to all commands
typeset -a _yaourt_opts_common
_yaourt_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[Alternate configuration file]:config file:_files'
'--debug[Display debug messages]'
'--gpgdir[Alternate GnuPG home directory]:gpg_directory:_files -/'
'--logfile[Alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
'-b[alternate database location]:database_location:_files -/'
'-h[display syntax for the given operation]'
'-r[alternate installation root]:installation root:_files -/'
'-v[be more verbose]'
'--cachedir[specify alternate package cache location]:cache_location:_files -/'
'--config[specify alternate configuration file]:config file:_files'
'--debug[display debug messages]'
'--gpgdir[specify alternate GnuPG home directory]:gpg_directory:_files -/'
'--logfile[specify alternate log file]:config file:_files'
"--noconfirm[don't ask for confirmation]"
"--noprogressbar[don't show a progress bar when downloading files]"
"--noscriptlet[don't execute the install scriptlet if one exists]"
'--print[only print the targets instead of performing the operation]'
)
# options for passing to _arguments: options for --upgrade commands
typeset -a _yaourt_opts_pkgfile
_yaourt_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-d[skip dependency checks]'
'-f[overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar*(.)"'
)
# options for passing to _arguments: subactions for --query command
typeset -a _yaourt_opts_query_actions
_yaourt_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
'-g[view all members of a package group]:*:package groups:->query_group'
'-o[query the package that owns a file]:file:_files'
'-p[package file to query]:*:package file:->query_file'
'-s[search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
typeset -a _yaourt_opts_query_modifiers
_yaourt_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-k[Check package files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
'--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]'
'--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]'
'--date[List packages sorted ascendingly (oldest is printed first) by installation date]'
'-c[list package changelog]'
'-d[list packages installed as dependencies]'
'-e[list packages explicitly installed]'
'-i[view package information]'
'-ii[view package information including backup files]'
'-k[check package files]'
'-l[list package contents]'
'-m[list installed packages not found in sync db(s)]'
'-t[list packages not required by any package]'
'-u[list packages that can be upgraded]'
'--aur[install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]'
'--devel[used with -u updates all cvs/svn/git/hg/bzr packages]'
'--date[list packages sorted in ascending order (oldest first) by installation date]'
)
# options for passing to _arguments: options for --remove command
typeset -a _yaourt_opts_remove
_yaourt_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'-c[remove all dependent packages]'
'-d[skip dependency checks]'
"-k[only remove database entry, don't remove files]"
'-n[remove protected configuration files]'
'-s[remove dependencies not required by other packages]'
'*:installed package:_yaourt_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
typeset -a _yaourt_opts_sync_actions
_yaourt_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
'*-c[remove old packages from cache]:*:clean:->sync_clean'
'*-cc[remove all packages from cache]:*:clean:->sync_clean'
'-g[view all members of a package group]:*:package group:->sync_group'
'-s[search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
typeset -a _yaourt_opts_sync_modifiers
_yaourt_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
'-d[skip dependency checks]'
'-f[overwrite conflicting files]'
'-i[view package information]'
'-l[list all packages in a repository]'
'-p[print download URIs for each package to be installed]'
'-u[upgrade all out-of-date packages]'
'-w[download packages only]'
'-y[download fresh package databases]'
'*--ignore[ignore a package upgrade]:package:
_yaourt_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
'*--ignoregroup[ignore a group upgrade]:package group:
_yaourt_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
'--needed[Do not reinstall up to date packages]'
'--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]'
'--asdeps[install packages as non-explicitly installed]'
'--asexplicit[install packages as explicitly installed]'
"--needed[don't reinstall up to date packages]"
'--devel[used with -u updates all cvs/svn/git/hg/bzr packages]'
)
case $words[2] in

View File

@ -38,25 +38,24 @@
#
# ------------------------------------------------------------------------------
_zcash-cli() {
local context state line curcontext="$curcontext"
local state line curcontext="$curcontext" ret=1
_arguments -C \
-?'[This help message]' \
-conf='[Specify configuration file (default: zcash.conf)]:PATH:_files' \
-datadir='[Specify data directory]:PATH:_directories' \
-testnet'[Use the test network]' \
-regtest'[Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.]' \
-rpcconnect='[Send commands to node running on <ip> (default: 127.0.0.1)]:RPCCONNECT:_hosts' \
-rpcport='[Connect to JSON-RPC on <port> (default: 8232 or testnet: 18232)]: :_guard "[[\:digit\:]]#" "PORT"' \
-rpcwait'[Wait for RPC server to start]' \
-rpcuser='[Username for JSON-RPC connections]:RPCUSER:()' \
-rpcpassword='[Password for JSON-RPC connections]:RPCPASSWORD:()' \
-rpcclienttimeout='[Timeout in seconds during HTTP requests, or 0 for no timeout. (default: 900)]: :_guard "[[\:digit\:]]#" "RPCCLIENTTIMEOUT"' \
':subcommand:->subcommand' && ret=0
_arguments -C \
'-?[display usage information]' \
-conf='[specify configuration file]:file [zcash.conf]:_files' \
-datadir='[specify data directory]:directory:_directories' \
-testnet'[use the test network]' \
-regtest'[enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.]' \
-rpcconnect='[send commands to node running on specified ip]:rpcconnect [127.0.0.1]:_hosts' \
-rpcport='[connect to JSON-RPC on specified port]: :_guard "[[\:digit\:]]#" "port [8232 or testnet\: 18232]"' \
-rpcwait'[wait for RPC server to start]' \
-rpcuser='[username for JSON-RPC connections]:rpcuser' \
-rpcpassword='[password for JSON-RPC connections]:rpcpassword' \
-rpcclienttimeout='[specify timeout during HTTP requests, or 0 for no timeout]: :_guard "[[\:digit\:]]#" "timeout (seconds) [900]"' \
':subcommand:->subcommand' && ret=0
case $state in
subcommand)
case $state in
subcommand)
subcommands=(
'getbestblockhash'
'getblock'
@ -167,13 +166,11 @@ _zcash-cli() {
'zcsamplejoinsplit'
)
_describe -t subcommands 'zcash-cli subcommands' subcommands && ret=0
esac
_describe -t subcommands 'zcash-cli subcommand' subcommands && ret=0
;;
esac
return ret
}
_zcash-cli "$@"
return ret
# Local Variables:
# mode: Shell-Script