diff options
author | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-08-23 01:19:54 +0200 |
---|---|---|
committer | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-08-23 01:19:54 +0200 |
commit | 01bc3c124a8c1dc8a5c45f5f5d67bba6e29cabff (patch) | |
tree | 83f9b7b4a4e3a958f5f93b48c7d1a72776206ecc | |
parent | 6fcb32b30051523ad155273fe8b1a775c5f6ba3b (diff) | |
download | zsh-01bc3c124a8c1dc8a5c45f5f5d67bba6e29cabff.tar.gz zsh-01bc3c124a8c1dc8a5c45f5f5d67bba6e29cabff.tar.xz zsh-01bc3c124a8c1dc8a5c45f5f5d67bba6e29cabff.zip |
43301: add some functions from zsh-completions project
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Completion/Debian/Command/_debuild | 20 | ||||
-rw-r--r-- | Completion/Unix/Command/_ack | 138 | ||||
-rw-r--r-- | Completion/Unix/Command/_scons | 59 | ||||
-rw-r--r-- | Completion/Unix/Command/_vpnc | 54 | ||||
-rw-r--r-- | Completion/X/Command/_geany | 30 |
6 files changed, 308 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index f6fc5855e..52cf22461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-08-23 Oliver Kiddle <okiddle@yahoo.co.uk> + + * 43301 (based on work by Julien Nicoulaud): + Completion/Debian/Command/_debuild, Completion/Unix/Command/_ack, + Completion/Unix/Command/_scons, Completion/Unix/Command/_vpnc, + Completion/X/Command/_geany: functions from zsh-completions project + 2018-08-21 Daniel Shahaf <d.s@daniel.shahaf.name> * unposted: Doc/Zsh/compsys.yo: docs: Fix duplicated words diff --git a/Completion/Debian/Command/_debuild b/Completion/Debian/Command/_debuild new file mode 100644 index 000000000..5b1d0ea37 --- /dev/null +++ b/Completion/Debian/Command/_debuild @@ -0,0 +1,20 @@ +#compdef debuild + +local ign noc + +(( $#words > 2 )) && ign='!' +(( CURRENT != 2 )) && noc='!' + +_arguments \ + "${ign}(- 1 *)"{-h,--help}'[display usage information]' \ + "${ign}(- 1 *)--version[display version and copyright information]" \ + ${noc}{--no-conf,--noconf}"[don't read devscripts config files]" \ + {-r-,--rootcmd=}'[specify command used to become root if debuild not setuid root]: : _command_names -e' \ + '(--preserve-env)*'{-e-,--preserve-envvar=}'[preserve environment variable]:environment variable:_parameters -g "*export*"' \ + '(-e --preserve-envvar)--preserve-env[preserve all environment vars (except PATH)]' \ + '*'{-e-,--set-envvar=}'[preserve environment variable]:environment variable:_parameters -g "*export*" -qS=' \ + '--prepend-path=[prepend to the sanitised PATH]: :_dir_list' \ + '(-D)-d[skip checking of build dependencies]' \ + '(-d)-D[force checking of build dependencies]' \ + '--check-dirname-level[specify how much to check directory names]:level [1]:((0\:never 1\:only\ if\ program\ changes\ directory 2\:always))' \ + '--check-dirname-regex[specify what constitutes a matching directory name]:perl regex [PACKAGE(-.*)?]' diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack new file mode 100644 index 000000000..626e54e0f --- /dev/null +++ b/Completion/Unix/Command/_ack @@ -0,0 +1,138 @@ +#compdef ack ack2 ack-grep ack-standalone + +local curcontext="$curcontext" update_policy ign suf ret=1 +local -a state line +local -A opt_args + +_ack_types_caching_policy() { + # Rebuild if ackrc more recent than cache. + [[ -f ${ACKRC:-$HOME/.ackrc} && ${ACKRC:-$HOME/.ackrc} -nt "$1" ]] && return 0 + + # Rebuild if cache is older than one week. + local -a oldp + oldp=( "$1"(Nmw+1) ) + (( $#oldp )) && return 0 + + return 1 +} + +zstyle -s ":completion:${curcontext}:" cache-policy update_policy +[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ack_types_caching_policy + +typeset -ga _ack_raw_types +if _cache_invalid ack-types || ! _retrieve_cache ack-types; then + (( ${+commands[${words[1]}]} )) && _ack_raw_types=( + ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]} ) + [[ $#_ack_raw_types -gt 0 ]] && _store_cache ack-types _ack_raw_types +fi + +(( $#words > 2 )) && ign='!' + +_arguments -C -s -S \ + '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \ + '(-i --ignore-case --no-smart-case --nosmart-case --lines)--smart-case[case-insensitive match unless pattern includes uppercase]' \ + '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \ + '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \ + '(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \ + '(-Q --literal)'{-Q,--literal}'[use literal strings]' \ + '(1)*--lines=[only print specific lines of each file]:line number (list and/or range)' \ + '(-l --files-with-matches -L --files-without-matches)'{-l,--files-with-matches}"[output matching files' names only]" \ + '(-L --files-without-matches -l --files-with-matches)'{-L,--files-without-matches}"[output non-matching files' names only]" \ + '--output=[output result of expression for each line (turns off text highlighting)]:perl expression' \ + '-o[show only matching part of line]' \ + '--passthru[print all lines, whether matching or not]' \ + '(1)--match=[specify the pattern explicitly]:pattern' \ + '(-m --max-count)'{-m+,--max-count=}'[stop after specified no of matches in each file]:max number of matches' \ + '-1[stop after reporting first match of any kind]' \ + '(-H --with-filename -h --no-filename)'{-H,--with-filename}'[print filename with each match]' \ + '(-h --no-filename -H --with-filename)'{-h,--no-filename}'[suppress printing of filenames]' \ + '(-c --count)'{-c,--count}'[only print a count of matching lines]' \ + '--column[print column number of first match on each line]' \ + '(-A --after-context -C --context)'{-A+,--after-context=}'[specify lines of trailing context]::lines [2]' \ + '(-B --before-context -C --context)'{-B+,--before-context=}'[specify lines of leading context]::lines [2]' \ + '(-C --context -A --after-context -B --before-context)'{-C+,--context=}'[specify lines of context]:lines [2]' \ + '--print0[separate filenames with a null instead of a newline]' \ + '-s[suppress error messages about nonexistent or unreadable files]' \ + "(--nopager)--pager=[direct ack's output through program]: : _command_names -e" \ + "(--pager)--nopager[don't send output through a pager; overrides .ackrc, ACK_PAGER & ACK_PAGER_COLOR]" \ + '(--noheading --heading)'{--noheading,--heading}'[print a filename heading above results, default on]' \ + '(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]' \ + '(--nogroup)--group[group matches by file name]' \ + "(--group)--nogroup[don't group matches by file name]" \ + '(--nocolor --nocolour)--colo'{,u}'r[enable color highlighting of output]' \ + '(--color --colour --color-filename --color-match --color-lineno)--nocolo'{,u}'r[suppress the color]' \ + '(--nocolor --nocolour --color --colour)--color-filename=[sets the color to be used for filenames]:color:->colors' \ + '(--nocolor --nocolour --color --colour)--color-match=[sets the color to be used for matches]:color:->colors' \ + '(--nocolor --nocolour --color --colour)--color-lineno=[specify color for line numbers]:color:->colors' \ + '--flush[flush output on every line]' \ + '(1)-f[only print the files that would be searched, without actually doing any searching]' \ + '(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \ + '--sort-files[sorts the found files lexically]' \ + '--show-types[print the file types that ack associates with each file]' \ + '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \ + '(-x --files-from)-x[read the list of files to search from standard input]' \ + '*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \ + '*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \ + '*--ignore-file=[add filter for ignoring files]:filter:->filters' \ + '(-r -R --recurse -n --no-recurse)'{-r,-R,--recurse}'[recurse subdirectories]' \ + '(-n --no-recurse -r -R --recurse)'{-n,--no-recurse}"[don't descend into subdirectories]" \ + '(--nofollow)--follow[follow symlinks]' \ + "(--follow)--nofollow[don't follow symlinks]" \ + '(-k --known-types)'{-k,--known-types}'[include only files of types that ack recognizes]' \ + '*--type=[specify the types of files to include or exclude from a search]:type:->file-types' \ + '*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \ + '*--type-del=[remove all filters associated with specified file type]: :->file-types' \ + '(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \ + '--ackrc=[specify an ackrc file to use]:files:_files' \ + '--ignore-ack-defaults[ignore default definitions included with ack]' \ + "${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \ + "${ign}(- 1 *)"{-\?,--help}'[display usage information]' \ + "${ign}(- 1 *)--help-types[display all known types]" \ + "${ign}(- 1 *)--dump[display information on which options are loaded and which RC files]" \ + '(--filter --nofilter)--filter[treat standard input as pipe]' \ + '(--filter --nofilter)--nofilter[treat standard input as tty]' \ + "${ign}(- 1 *)--man[display the manual page]" \ + "${ign}(- 1 *)--version[display version and copyright information]" \ + "${ign}(- 1 *)--bar[consult Admiral Ackbar]" \ + "${ign}(- 1 *)--thpppt[bill the cat]" \ + "${ign}(- 1 *)--cathy[chocolate chocolate chocolate]" \ + {'--','--no'}${_ack_raw_types/ ##/\[}']' \ + '1: :_guard "^-*" pattern' \ + '*:file:_files' && ret=0 + +case $state in + colors) + compset -P '* ' + compset -S ' *' + _wanted colors expl color compadd \ + {,on_}{,bright_}{black,red,green,yellow,blue,magenta,cyan,white} \ + clear reset dark bold under{line,score} blink reverse concealed && ret=0 + ;; + type-defs) + if ! compset -P 1 '*:'; then + _message -e type-name 'type name' + return + fi + ;& # fall-through + filters) + if compset -P 1 'ext:'; then + _sequence _wanted extensions expl 'extension' compadd - *.*(N:e) && ret=0 + elif compset -P 1 'is:'; then + _description files expl 'file name' + _files "$expl[@]" && ret=0 + elif compset -P 1 '(firstline|)match:'; then + _message -e patterns 'pattern' + else + compset -S ':*' || suf=-S + _description filters expl filter + compadd "$expl[@]" ${suf:+-S:} ext is && ret=0 + compadd "$expl[@]" ${suf:+-S:/} match firstlinematch && ret=0 + fi + ;; + file-types) + local types; types=( {,no}${^_ack_raw_types/ ##/:} ) + _describe -t file-types 'file type' types && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons new file mode 100644 index 000000000..2c620cc1a --- /dev/null +++ b/Completion/Unix/Command/_scons @@ -0,0 +1,59 @@ +#compdef scons + +_arguments -s -S \ + '(-c --clean --remove)-'{c,-clean,-remove}'[remove specified targets and dependencies]' \ + '(-C --directory)-'{C,-directory=}'[change to specified directory first]:directory:_directories' \ + '--cache-debug=[print CacheDir debug info to file]:file:_files' \ + '(--cache-disable --no-cache)--'{cache-disable,no-cache}"[don't retrieve built targets from cache]" \ + '(--cache-force --cache-populate)--'{cache-force,cache-populate}'[copy already-built targets into cache]' \ + "--cache-readonly[don't update CacheDir with built targets]" \ + '--cache-show[print build actions for files from cache]' \ + '--config=[set Configure mode]:mode:(auto force cache)' \ + '(-u --up --search-up -U)-D[search up for SConstruct; build default targets]' \ + '--debug=[print debugging information]:type:( + count duplicate explain findlibs includes memoizer memory objects pdb prepare presub stacktrace time)' \ + '--diskcheck=[enable specific on-disk checks]:check:(all none match rcs sccs)' \ + '--duplicate=[set preferred file duplication methods]:file duplication methods:( + hard-soft-copy soft-hard-copy hard-copy soft-copy copy)' \ + '(-f --file --makefile --sconstruct)-'{f,-file=,-makefile=,-sconstruct=}'[specify SConstruct file]:file:_files' \ + '(-)-'{h,-help}'[display defined usage information]' \ + '(-)-'{H,-help-options}'[display usage information]' \ + '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \ + \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \ + '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \ + '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \ + '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \ + '--interactive[start interactive mode]' \ + '(-j --jobs)-'{j,jobs=}'[specify no of jobs to run in parallel]' \ + '(-k --keep-going)-'{k,-keep-going}'[continue after an error]' \ + '--max-drift=[set the maximum clock drift]:drift (seconds)' \ + '--md5-chunksize=[set chunksize for MD5 signature computation]:size (kB)' \ + '(-n --just-print --dry-run --recon)-'{n,-just-print,-dry-run,-recon}"[print commands but don't run them]" \ + "--no-site-dir[don't use the usual site_scons directory]" \ + '--profile=[profile scons]:output file:_files' \ + '(-q --question)-'{q,question}'[query whether up-to-date]' \ + '-Q[suppress progress messages]' \ + '--random[build dependencies in random order]' \ + '(-s --silent --quiet)-'{s,-silent,-quiet}"[don't print commands]" \ + '--site-dir=[specify site_scons directory]:directory:_directories' \ + '--stack-size[set stacksize of threads]:size (kB)' \ + '--taskmastertrace=[trace node evaluation to file]:file' \ + '--tree=[print dependency tree]:format:(all derived prune status)' \ + '(-u --up --search-up -D -U)-'{u,-up,-search-up}'[search up for SConstruct; build current directory]' \ + '(-u --up --search-up -D)-U[search up for SConstruct; build Default targets]' \ + '(-)-'{v,-version}'[print version information]' \ + \*{--warn=,--warning=}'[enable or disable warnings]:type:( + all cache-write-error corrupt-sconsign dependency deprecated + deprecated-copy deprecated-source-signatures deprecated-target-signatures + duplicate-environment fortran-cxx-mix link misleading-keywords + missing-sconscript no-md5-module no-metaclass-support no-object-count + no-parallel-support python-version reserved-variable stack-size no-all + no-cache-write-error no-corrupt-sconsign no-dependency no-deprecated + no-deprecated-copy no-deprecated-source-signatures + no-deprecated-target-signatures no-duplicate-environment + no-fortran-cxx-mix no-link no-misleading-keywords no-missing-sconscript + no-no-md5-module no-no-metaclass-support no-no-object-count + no-no-parallel-support no-python-version no-reserved-variable + no-stack-size)' \ + \*{-Y,--repository}'[search specified repository for files]:repository:_files' \ + '*:target:_default' # Doesn't seem to be a simple way to get a list of targets diff --git a/Completion/Unix/Command/_vpnc b/Completion/Unix/Command/_vpnc new file mode 100644 index 000000000..9c4f4d41b --- /dev/null +++ b/Completion/Unix/Command/_vpnc @@ -0,0 +1,54 @@ +#compdef vpnc vpnc-connect + +local ign + +(( $#words > 2 )) && ign='!' +_arguments \ + "${ign}(- : *)--version[display version information]" \ + "${ign}(- : *)--"{,long-}'help[display usage information]' \ + '--gateway=[specify IP/name of IPSec gateway]: :_hosts' \ + '--id=[specify group name]: :_groups' \ + '--username=[specify username]: :_users' \ + '--domain=[specify domain name for authentication]: :_domains' \ + '--xauth-inter[enable interactive extended authentication]' \ + '--vendor=[specify IPSec gateway vendor]:vendor:(cisco netscreen)' \ + '--natt-mode=[specify NAT-Traversal method to use]:NAT-traversal method [natt]:(( + natt\:NAT-T\ as\ defined\ in\ RFC3947 + none\:disable\ use\ of\ any\ NAT-T\ method + force-natt\:always\ use\ NAT-T\ encapsulation\ even\ without\ presence\ of\ a\ NAT\ device + cisco-udp\:Cisco\ proprietary\ UDP\ encapsulation,\ commonly\ over\ port\ 10000 + ))' \ + '--script=[specify command executed using system() to configure the interface, routing and so on]: : _command_names -e' \ + '--dh=[specify the IKE DH group]:group:(dh1 dh2 dh5)' \ + '--pfs=[specify Diffie-Hellman group to use for PFS]:group:(nopfs dh1 dh2 dh5 server)' \ + '--enable-1des[enable weak single DES encryption]' \ + '--enable-no-encryption[use no encryption for data traffic (key exchange still encrypted)]' \ + '--application-version=[specify application version to report]:application version' \ + '--ifname=[specify visible name of the TUN/TAP interface]:interface name' \ + '--ifmode=[specify mode of TUN/TAP interface]:mode [tun]:(tun tap)' \ + '--ifmtu=[set MTU for TUN/TAP device]:MTU (0-65535) [0 - automatic]' \ + "--debug[show verbose debug messages]:debug information:(( + 0\:don\'t\ print\ debug\ information + 1\:print\ minimal\ debug\ information + 2\:show\ state\ machine\ and\ packet/payload\ type\ information + 3\:dump\ everything\ excluding\ authentication\ data + 99\:dump\ everything\ including\ authentication\ data\ \(e.g.\ passwords\) + ))" \ + "--no-detach[don't detach from the console after login]" \ + '--pid-file=[store the pid of background process in specified file]:pid file:_files' \ + '--local-addr=[specify local IP to use for ISAKMP/ESP/...]: :_hosts' \ + '--local-port=[specify local ISAKMP port number to use]:ISAKMP port number (0-65535) [500]' \ + '--udp-port=[specify local UDP port number to use]:udp port (0-65535) [10000]' \ + '--dpd-idle=[send DPD packet after not receiving anything for specified time]:timeout (seconds) [600]' \ + "--non-inter[don't ask anything, exit on missing options]" \ + '--auth-mode=[specify authentication mode]:authentication mode [psk]:(( + psk\:pre-shared\ key + cert\:server\ +\ client\ certificate + hybrid\:server\ certificate\ +\ xauth + ))' \ + '--ca-file=[specify CA-PEM-File]:CA-PEM file:_files -g "*.pem(-.)"' \ + '--ca-dir=[specify trusted CA-Directory]:CA directory:_files -/' \ + '--target-network=[specify target network]:network/netmask' \ + '--password-helper=[specify password helper executable]: : _command_names -e' \ + '--print-config[print configuration in form that can be used as vpnc.conf]' \ + '*:configuration [default]:compadd - /etc/vpnc/*.conf(N:t:r)' diff --git a/Completion/X/Command/_geany b/Completion/X/Command/_geany new file mode 100644 index 000000000..c6a9ae113 --- /dev/null +++ b/Completion/X/Command/_geany @@ -0,0 +1,30 @@ +#compdef geany + +local ign + +(( $#words > 2 )) && ign='!' +_arguments -s -S \ + "${ign}(- *)"{-h,--help}'[display usage information]' \ + "${ign}(- *)--help-all[display all options]" \ + "${ign}(- *)--help-gtk[display GTK+ Options]" \ + '--column=[set initial column number for the first opened file]:column number' \ + '(-c --config)'{-c,--config=}'[use an alternate configuration directory]:configuration directory:_directories' \ + "${ign}(- *)--ft-names[print internal filetype names]" \ + {-g,--generate-tags}'[generate global tags file]:tags file:_files -g "*.tags(-.)":*:source file:_files' \ + '(-P --no-preprocessing)'{-P,--no-preprocessing}"[don't preprocess C/C++ files when generating tags]" \ + '(-i --new-instance --socket-file)'{-i,--new-instance}"[don't open files in a running instance, force opening a new instance]" \ + '(-i --new-instance)--socket-file=[use specified socket file to communicate with a Geany instance]:socket:_files -g "*(-=)"' \ + "${ign}(- *)--list-documents[return a list of open documents in a running Geany instance]" \ + '(-l --line)'{-l,--line=}'[set initial line number for the first opened file]:line number' \ + '(-m --no-msgwin)'{-m,--no-msgwin}"[don't show message window at startup]" \ + '(-n --no-ctags)'{-n,--no-ctags}"[don't load completion and call tip data]" \ + '(-p --no-plugins)'{-p,--no-plugins}"[don't load plugins]" \ + "${ign}(- *)--print-prefix[print Geany's installation prefix]" \ + '(-r --read-only)'{-r,--read-only}'[open all given files in read-only mode]' \ + '(-s --no-session)'{-s,--no-session}"[don't load the previous session's files]" \ + '(-t --no-terminal --vte-lib)'{-t,--no-terminal}"[don't load terminal support]" \ + '(-t --no-terminal)--vte-lib=[specify path and filename of VTE library]:libvte.so filename:_files -g "*.so(-.)"' \ + '(-v --verbose)'{-v,--verbose}'[be verbose]' \ + "${ign}(- *)"{-V,--version}'[display version information]' \ + '--display=[specify X display to use]:display:_x_display' \ + '(-g --generate-tags)*: :_files' |