From 8462d6acbcd5c3863aafadedd5da153881df72a8 Mon Sep 17 00:00:00 2001 From: Packit Date: Aug 24 2020 13:58:14 +0000 Subject: bash-completion-2.7 base --- diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..ce251c0 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,3 @@ +;; bash-completion shell-script mode additional settings for Emacs + +((sh-mode . ((sh-indent-comment . t)))) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..93f55b8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +[*] +indent_style = space +indent_size = 4 +tab_width = 8 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 79 + +[Makefile.am] +indent_style = tab diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4b547f1 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,7 @@ +David Paleino (Debian) +Freddy Vulto +Guillame Rousse (Mandriva) +Igor Murzov +Mike Kelly (Exherbo) +Santiago M. Mola (Exherbo) +Ville Skyttä (Fedora/Red Hat) diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..7e0dc8f --- /dev/null +++ b/CHANGES @@ -0,0 +1,1968 @@ +bash-completion (2.7) + + [ Eli Young ] + * Makefile: update default compatdir (#132) + + [ Ville Skyttä ] + * Make user completion file configurable, disable in tests + * test suite: Generalize xspec completion install check + * pyflakes: Remove redundant xspec completion + * test suite: Fix __expand_tilde_by_ref test expectation output + * pdfunite: New *.pdf completion + + -- Ville Skyttä Sat, 01 Jul 2017 14:08:43 +0300 + +bash-completion (2.6) + + [ Björn Kautler ] + * Add missing sidedoor to .gitignore (#114) + + [ Ville Skyttä ] + * test suite: Mark expected centos6 CI _filedir failures as such + * Expose version in BASH_COMPLETION_VERSINFO, use it in profile.d + script + * test suite: Skip an expected make test case failure in centos6 CI + * test suite: Fix ifdown and ifup CI test skipping + * test suite: Ignore env var pulled in by use of scp in tests + * test suite: If colon trim doesn't do anything, trim as usual + * tar: Comment spelling fixes + * test suite: Mark dpkg -L test case untested if no packages + installed + * test suite: Cosmetic tweaks + * dpkg: Fix dpkg -i home dir completion + * test suite: Improve ls home dir test descriptions + * python: Split module completion to separate helper + * micropython: New completion, aliased from python + * test suite: Add Python module completion test case + * python: Fix traceback avoidance on module completion error + * openssl: Parse available digests from dgst -h + * openssl: Add sha2 commands + * gm: New completion, commands only for now + * (test suite): Test screen -T completions + * (test suite): Set TERM to dumb, not dummy + * Revert "(test suite): Fix alias and cd cursor position tests" + * mplayer: Remove duplicate *.m4a and *.m4v associations + * mplayer, xine, etc: Associate *.mp4a and *.mp4v + * xine etc: Fix *.m4a association + * bind: Add option and argument (non-)completions + * _user_at_host: Set nospace only when completing username part + * _user_at_host: Append @ suffix to username part completions + * man: Don't check OSTYPE or GNU userland, just enable on all + systems + * (test suite): Set dcop result to untested if dcop server is not + running + * (test suite): Don't insist on loading all completions dynamically + * _configured_interfaces: Parse from /etc/network/interfaces.d/* on + Debian + * py.test: New completion + * oowriter: Associate with *.pdf + * Don't define BASH_COMPLETION_COMPAT_DIR + * ri: Add option and arg completions + * (test suite): Add our own dummy ri test fixture + * (test suite): Info test needs docs, don't exclude from CentOS + * (test suite): Fix CentOS 6 tcllib setup + * (test suite): Simplify renice test, fix with only one completion + * (test suite): Don't assume configured interfaces in CI setups + * Don't offer * as configured interface when there are none + * (test suite): Add basic CentOS 6 container for bash 4.1 coverage + * (test suite): Ignore runtime loaded env function changes + * (test suite): Add mailman bin dir to PATH for arch test + * arch: Parse options from --help + * (test suite): Load tested completions dynamically + * (test suite): Accept non-whitespace single word in + assert_complete_any + * (test suite): Avoid interference from user and system dirs (#87) + * (test suite): Install some things N/A in ubuntu14 to fedoradev + * (test suite): Add unrar to ubuntu14 container + * (test suite): Fix alias and cd cursor position tests + * (test suite): Add basic alpine test case + * alpine: Parse opts from -h output, add some opt arg completions + * (test suite): Install jshint globally in ubuntu14 + * (test suite): Add mailman bin dir to PATH for some mailman tools + * (test suite): Install jshint to ubuntu14 container with npm + * unshunt: Parse options from --help + * (test suite): Test lsof on ubuntu14 + * (test suite): Add basic hping3 test case + * (test suite): Add our ./configure to PATH to test it, test opts + * (test suite): Add bunch of packages to ubuntu14 container + * (test suite): Ensure /usr/(local/)games is in $PATH + * (test suite): Fix perl -d* test cases with no Devel::* installed + * (test suite): curl has lots of options, add more test prefix + * (test suite): Fix tar test case for ones having --owner-map + * (test suite): Unsupport various kill, renice cases if ps is N/A + * (test suite): Make chkconfig test behave better in container + * (test suite): Don't assume mounted filesystems in quota* tests + * newlist: Parse options from --help, add some arg non-completions + * (test suite): Delete trailing whitespace + * (test suite): Don't assume lists set up in newlist test cases + * (docker): Pull in missing fedoradev xvfb-run which dependency + * mr: Avoid stderr trash and test suite failure if man is N/A + * (test suite): Fix mmsitepass completion test + * tshark -G: Avoid stderr noise when running as superuser + * (docker): Run completion tests with xvfb-run, e.g. for gkrellm + * ssh-keygen: Make option parsing work with OpenSSH < 7 + * synclient, udevadm: Avoid use of posix char classes for awk + * test suite: Add WIP Fedora dev config + * Travis: Switch tests to docker, update to Ubuntu 14 + * xv: Associate with *.j2c, *.j2k, *.jp2, *.jpf, and *.jpg2 (Debian: + #859774) + * eog: Associate with *.j2c and *.jpg2 + * Bump copyright years + * xine etc: Associate uppercase *.WM[AV] + * mplayer: Associate *.weba (#112) + * xine etc: Associate *.webm and *.weba (#112) + + -- Ville Skyttä Tue, 27 Jun 2017 12:29:33 +0300 + +bash-completion (2.5) + + [ BartDeWaal ] + * Support for python gui source files (#91) + + [ Ben Webber ] + * mr: New completion + + [ Christian Kujau ] + * ssh-keygen: support ed25519 keys (#79) + + [ Dara Adib ] + * Add sidedoor to _ssh() completion (#106) + + [ George Kola ] + * .ipa is just a zip file and we should let unzip handle it (#71) + + [ Miroslav Šustek ] + * ant: parse targets in imported buildfiles (#84) + + [ Reuben Thomas ] + * Add more tests for ccache + * ccache: fix completing compiler's flags + + [ Ville Skyttä ] + * test suite: Add java/javac non-completion fixture + * javac: Complete -cp like -classpath + * travis: Skip bluez and nis for now due to post-install script + issues + * test/config/*: Delete trailing whitespace + * (test suite): Avoid loading user's ~/.bash_completion, fixes #87 + * ip: Recognize a as alias for address and l for link + * ip: Recognize address in addition to addr + * mr: Disable "clean" test case, command N/A before mr 1.20141023 + * ssh-keygen: Parse switches with _parse_usage, not _parse_help + * mplayer: Associate with *.mjpg, *.mjpeg (Debian: #837779) + * dd: Sync completions with coreutils 8.24 + * travis: Add mr + * perl: Remove full path to cat in PERLDOC_PAGER call + * deja-dup: New completion + * CONTRIBUTING: Reorder sections + * *: Move indentation settings to .editorconfig + * make: Declare _make_target_extract_script like other functions + * Travis: zopfli is AWOL? + * *: Whitespace fixes + + [ Zearin ] + * Minor edits to README.md (mostly formatting) (#110) + + [ l3nticular ] + * Fix bug in 'make' completion when using BSD sed (#108) + + [ osu ] + * Add support for Include in ssh config (#70) (#80) + + -- Ville Skyttä Sat, 04 Feb 2017 18:07:27 +0200 + +bash-completion (2.4) + + [ Arash Esbati ] + * xetex, xelatex, luatex, lualatex: Associate with tex files + + [ Gene Pavlovsky ] + * Use shell globbing instead of ls to source files in compat dir + + [ Grisha Levit ] + * Support completing array variables and expansions + * Add tests for declare/typeset + * Better handling of typeset/declare + + [ Kylie McClain ] + * tar: silence --version's stderr output + + [ Paul M. Lambert ] + * Support pod document files for perldoc (#39) + + [ Richard Alpe ] + * tipc: fix missing last char in link name completion + * tipc: handle complete words without trailing space + * tipc: suppress tipc error messages + * tipc: use double brackets in if conditions + * tipc: make loop variables local + * tipc: remove unnecessary return values + * tipc: readd call to complete command + * tipc: use cur variable for flag completion + * tipc: add command prefix to link sed + * tipc: remove unnecessary function _tipc_get_val() + * tipc: use bash here string instead of echo + * tipc: merge functions into main + * tipc: add test framework + * tipc: add tipc completions + + [ Ville Skyttä ] + * Release 2.4 + * rpm: Offer --filetriggers with -q + * javadoc: Add bunch of option arg (non)completions + * lrzip: Add -m arg noncompletion + * pkg-get: Don't use hyphens in function names + * jarsigner: Add some option arg (non)completions + * pkg-get,pkgrm: Drop unnecessary _have calls + * *: Trivial cleanups + * *: Remove redundant return 0's + * pypy*: Add basic --jit arg completion + * pypy3: Alias to python + * hcitool,svcadm,tar: Spelling fixes + * Travis: Install more packages for more test coverage + * (test suite): Pass assert_complete_any for exact/only given arg + completed + * tipc: Invoke ls with "command" + * tipc: Indentation fix + * (test suite): Fix fallout from + fec077d555f112b9f455c45860f90a3b47392fcf + * (test suite): Remove Bash::Completion.3pm.gz from git, create on + the fly + * (test suite): Remove test/fixtures/_filedir/a"b from git, create + on the fly + * CONTRIBUTING: Note patch preferences if not using GitHub pull + requests + * python: Support -Q and -W arg completion without space + * apache2ctl, aspell, make: Don't hardcode completion generator + command + * mysql: Avoid --default-character-set error with failglob, fixes + #46 + * test suite: Add perldoc module+pod completion test case + * perl: Remove some duplicated code + * pushd: Use _cd completion for CDPATH support, closes #38 + * test suite: Add basic pushd test case + * abook: Parse long options from command including full path + * pyvenv: New completion + * chroot: New (generic long options) completion, see #38 + * Travis: First steps toward testing with OS X + * test suite: Add bashcomp_bash env var for better control on tested + bash + * aptitude: List packages using _apt_cache_packages, fixes #33 + * vncviewer: Cleanup shopt use, drop an eval + * make: Avoid a grep + * rpm: Fix --whatenhances arg completion + * aspell, minicom, mysql: Replace use of ls with printf + * cppcheck: Complete filenames too for --platform + * man: Prioritize MANPATH, simplify, add fallback e.g. for busybox, + fixes #28 + * aclocal: Install completion for 1.14 and 1.15, fixes #25 + * mpv: Don't install symlink for it, fixes #24 + * test suite: Add function and declare test cases + * CONTRIBUTING: Highlight request for test cases + + [ Wayne Scott ] + * The BitKeeper completion used the wrong set of commands + + -- Ville Skyttä Fri, 12 Aug 2016 22:43:27 +0300 + +bash-completion (2.3) + + [ Daniel Milde ] + * Completion for python zip archives + + [ Liuhua Wang ] + * lvm: pvcreate should be able to use all block devcices + * lvm: fix all commands that should get all PVs + + [ Ville Skyttä ] + * Release 2.3 + * make-changelog: Don't output "Merge pull request" entries + * make: Use <<< instead of printf + pipe + * gnokii: Use <<< instead of echo + pipe + * *: Use [:blank:] instead of $'\t ' tricks where appropriate, fixes + #19 + * test suite: Fix abook test case + * test suite: Don't insist on property completions if synclient -l + fails + * test suite: Tolerate "See 'man feh'" feh --help output + * test suite: Fix tar failure caused by previous tar change + * tar: Detect GNU/other from --version only once per session + * tar: Remove unused variable + * tar: Fix GNU tar help output parsing regex, fixes #15 + * test suite: Add tar xvf filename test case + * tar: Don't write to /tmp/jetel + * python: Simplify code + * python: Complete all files also after -m + * python: Don't offer options after -c + * python: Complete all files only if -c is before current word + * test suite: Add some python test cases + * unzip, zipinfo: Complete on *.pyz + * travis: configure and run completions syntax check + * make check: Test syntax of all completion files + * CONTRIBUTING.md: Ask for test cases + + -- Ville Skyttä Mon, 28 Mar 2016 18:32:47 +0300 + +bash-completion (2.2) + + [ Barry Warsaw ] + * _init_completion: Handle cword < 0 (LP: #1289597) + + [ Damien Nadé ] + * (testsuite) Use 'set' command posix behaviour when saving env + (Alioth: #314720) + * Added test/site.{bak,exp} to .gitignore + * _parse_help: Fix failglob failures (Alioth: #314707) + * _lvm: using a single-pattern case and invoking function according + to words[1] + * lvm: _lvm_count_args parameter must be quoted in order to failglob + not to complain + * gendiff: Quoting suffix pattern to avoid triggering failglob + + [ Dams Nadé ] + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (Alioth: + #314709) + * Quote unset array element to avoid globbing interference (Alioth: + #314708) + + [ David Paleino ] + * Refactor bts and uscan, since they use common functions + * uscan: New completion, thanks to Federico Ceratto + * bts: New completion, thanks to Federico Ceratto. + + [ Guillaume Rousse ] + * complete on freerdp-specific known hosts list + * nmcli completion was integrated upstream + + [ Igor Murzov ] + * isql: Fix failglob failure + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (take 2) + (Alioth: #314709) + * (testsuite): move testing of _linux_fstab() to umount.exp + * umount: Fix mount points escaping/unescaping with Bash-4.3 + * slapt-src: Handle --config=FILE option properly + * sbopkg, slapt-{get,src}: expand tilde in config file name + * slapt-{get,src}: Fix issue with sed not being able to handle some + characters + * slapt-src: split options from their arguments + * Quote _filedir arguments when appropriate to prevent failglob + failures + * psql: Tell psql to not load .psqlrc as it may change output format + (Alioth: #314636) + * testsuite: Add basic tests for portsnap and freebsd-update + * mplayer: -dvd-devices takes dvd devices, dirs and .iso files as + argument + * 7z: Improve completion + * f77, f95: Use the same completion as for g77, g95 if they are + links to gfortran + * aptitude: safe-upgrade accepts package name as parameters (Alioth: + #313638, Debian: 673235) + * _longopt: Run commands in C locale. + * make: Use only posix basic regexps with sed (Alioth: #314345) + * cppcheck: Add new --enable option argument and --library argument + completion + * dpkg: Suppress unwanted error messages (Debian: #706502) + * perl: -d/-dt option argument is optional (Alioth: #314242) + * Add config for cmake to bash-completion. + * kcov: Add new sort types, complete --replace-src-path arguments + * feh: Add new sort type + + [ Mathieu Parent ] + * Puppet: describe: update options list, accordind to 'puppet help + describe' + * Puppet: cert: update options list, accordind to 'puppet help cert' + * Puppet: apply: update options list, accordind to 'puppet help + apply' + * Puppet: agent: update options list, accordind to 'puppet help + agent' + * Puppet: puppet parser support + * Puppet: puppet -* doesn't imply 'puppet apply' + * Puppet: use puppet terminology + + [ Matthew Gamble ] + * Modify all usages of 'sed' to be run with command bash builtin + * Use command built-in to run sed to avoid any custom aliases + + [ Matthieu Crapet ] + * man: Use -w instead of --path + + [ Michael Gold ] + * profile.d: Avoid some warnings from shells in "nounset" mode + (Debian: #776160) + + [ Miroslav Lichvar ] + * chronyc: Update help text parsing + * chronyc: Add missing subcommands + * chronyc: Add -6 option + + [ Nevo Hed ] + * minicom: Recognize user ~/.minirc.* as config files + + [ Ondrej Oprala ] + * __get_cword: avoid $index < 0 (Alioth: #315107) + + [ Patrick Monnerat ] + * rpmbuild: Complete *.spec on --clean (RedHat: #1132959) + + [ Pavel Raiskup ] + * tar: rework the completion completely + + [ Peter Cordes ] + * upstart support for service completion + + [ Peter Dave Hello ] + * freebsd-update: New completion. + * portsnap: New completion. + + [ Peter Wu ] + * modprobe: fix params with multi-line descriptions + * gdb: support --args style completion (Alioth: #314664) + + [ Rainer Müller ] + * make: Fix basic regex for portability (Alioth: #314345) + + [ Raphaël Droz ] + * gnokii: New completion + + [ Rune Schjellerup Philosof (Olberd) ] + * dpkg: Add support in dpkg completion for .ddeb (LP: #568404) + + [ Shaun McCance ] + * xmllint, xmlwf, xsltproc: Complete on Mallard *.page files + + [ Stefano Rivera ] + * pypy: New completion identical to python (Alioth: #314501) + + [ Thilo Six ] + * Use more straightforward way to check bash version + * _mac_addresses: Use explicit C locale for ifconfig (Debian: + #704832). + + [ Tristan Wibberley ] + * make: Don't pick up variables when makefile is reloaded + * make: Offer hidden targets when it is clear that the user is + trying to complete one of them + * make: Fix detection of intermediate targets where make has changed + its database whitespace + * make: Add __BASH_MAKE_COMPLETION__ variable + * make: completion shouldn't be confused by the output of $(info + confuse: make) + + [ Uwe Kleine-König ] + * Don't complete hostnames found after Hostname in ~/.ssh/config + + [ Ville Skyttä ] + * Release 2.2 + * README.md: Note autoreconf need only in unprepared tarball + * make-changelog.py: Set myself in footer + * make-changelog.py: Fix footer line output + * make-changelog.py: flake8 fixes + * make-changelog.py: Make work with Python 3 + * README.md: More markdown tweaks + * README.md: Markdown tweaks + * zopflipng: New completion + * README.md: Not need for autoreconf, fixes #11 + * README: Expand troubleshooting section somewhat + * Merge pull request #9 from shaunix/master + * ssh: Extract duplicate code to _ssh_configfile + * Remove various comments related to bash versions we don't support + * travis: Install more packages for [xyz]* test coverage + * travis: Install more packages for [stuvw]* test coverage + * travis: Install more packages for [qr]* test coverage + * travis: Install more packages for [op]* test coverage + * travis: Install more packages for m* test coverage + * travis: Install more packages for [jkl]* test coverage + * Merge pull request #7 from ukleinek/master + * indent: Remove generic long option completion + * Update copyright year + * travis: Install more packages for [hi]* test coverage + * travis: Install more packages for [fg]* test coverage + * mysql: Fix --default-character-set completion with mariadb + * mysql, puppet: sed portability fixes + * gnokii, minicom: Use grep through "command" + * lint: Check for sed without "command" + * Merge pull request #2 from djmattyg007/avoid_sed_alias + * travis: Install more packages for [de]* test coverage + * travis: Install more packages for c* test coverage + * travis: Add note about (currently) N/A packages + * test suite: Mark unsupported look test case as such, not + unresolved + * test suite: Use unsupported instead of xfail for modinfo/modprobe + cases + * travis: Install more packages for [0-9][ab]* test coverage + * travis: Run tests with --all to get some more useful output + * test suite: Fix ssh partial hostname completion test + * README: Split contributing to separate CONTRIBUTING doc + * README: Convert to markdown + * Drop references to bash-completion-devel@lists.alioth.debian.org + * build system: Switch to xz compressed tarball + * aclocal, automake: Install for versioned 1.14 and 1.15 executables + * Update URLs and various instructions to GitHub + * README: Update POSIX spec link + * travis: Avoid Travis default ri, use distro one instead + * test suite: Make apt-get test less sensitive to available commands + * test suite: Output tool log on failure in CI + * Set up Travis + * test suite: Expect failure in modinfo/modprobe if there are no + modules + * test suite: Fix ssh-copy-id test on old setups with no identities + * cppcheck: Add native to --platform completions + * ssh: Avoid completing commands before hostname + * chronyc: Parse command args from help output + * chronyc: Wrap long lines + * Load completions also from $XDG_DATA_DIRS (RedHat: #1264094) + * (testsuite) Ignore files generated by complete-ant-cmd.pl + * scp, sftp: Complete -S on commands + * scp, sftp: Fix querying ssh options + * sftp: Add -l arg non-completion + * ssh-copy-id: Offer only *.pub to -i + * mpv: Remove mplayer-aliased completion + * __load_completion: New function, use in _completion_loader and + _xfunc + * modplug*: Associate *.oct and *.okt + * rpm: Add --whatenhances/recommends/suggests/supplements and + --recommends/supplements completions + * pgrep, pidof, pkill, pwdx, vmstat: Add support for procps-ng + * pdftotext: New completion + * checksec: New completion + * ssh: Complete HostbasedKeyTypes,HostKeyAlgorithms,KexAlgorithms + values + * ssh: Query ciphers and macs from ssh before hardcoded fallback + * ssh: Add -Q argument completion + * sysctl: Return early on --help, --version + * sysctl: Try parsing options from help before usage + * Document how to avoid command_not_found_handler interference + * eog: Complete on *.ppm (RedHat: #1090481) + * tar: Plug $line var leak + * tar: Style tweaks + * (testsuite) Add required "empty" dir for tar + * bsdtar, tar: Remove symlinks from git, have make create them + * jshint: New completion + * gnokii: Include and install it + * gnokii: Fix completions of options that are prefixes for others + * gnokii: Drop dead code + * (testsuite): Add basic gnokii test case + * gnokii: Various minor and cosmetic fixes + * _filedir: Avoid some unnecessary work with -d + * _filedir: Remove unused variable + * _filedir: Fix overquoted argument to compgen -d (RedHat: #1171396) + * 2015 + * Load user completions from $BASH_COMPLETION_USER_DIR/completions + * Revert "README: Don't hardcode /etc in cmake fallback dir" + * README: Don't hardcode /etc in cmake fallback dir + * README: Add cmake usage example + * README: Add autotools and cmake tips + * Drop reference to no longer used sysconf_DATA + * synclient: New completion + * tune2fs: Add missing return in -M arg completion + * reptyr: Rename file to _reptyr to avoid conflict with upstreamed + completion + * cppcheck: Option argument (non-)completion update + * dropuser: New completion + * createuser: New completion + * createdb, dropdb: Drop -o default, it does not appear to do + anything good here + * tshark: Simplify cut usage + * mcrypt: Simplify -m arg completion + * (testsuite): Add mcrypt -a and -m argument completion tests + * strings: Fix -T/--target arg completion with non-English locale + * chrome, firefox etc: Complete on *.pdf + * ccache: Add -o/--set-config arg name completion + * gphoto2: Replace tail with awk + * *: Invoke command to be completed, not its basename + * gphoto2: Fix split argument handing, and colon treatment in --port + args + * _completion_loader: Protect compgen from -* leakage (Debian: + #769399) + * Actually install the lz4 completion + * _pnames: Add -s for producing (possibly) truncated names (RedHat: + #744406) + * (testsuite) Add cd in dir without subdirs or CDPATH test case + * Protect various compgen invocations from -* leakage (Debian: + #766163) + * pigz, unpigz: Handle *.zz + * _completion_loader: Set empty command to _EmptycmD_ for cross + version compat + * Comment update + * rpmbuild: Complete *.spec on --nobuild + * mplayer, *xine: Complete on *.mts (Debian: #759219) + * ant: Support buildfile set in $ANT_ARGS (Alioth: #314735) + * (testsuite) Add ant -f test case + * ant: Don't offer more completions after options that exit + * 7z, adb: Trivial cleanups + * python(3): Add -X argument non-completion + * xsltproc. TODO fix for previous commit + * xmllint, xmlwf, xsltproc: Complete on *.dbk and *.docbook (Alioth: + #314770) + * xz: Complete -T/--threads argument + * (testsuite) Save shell variables when saving env (Alioth: #314720) + * adb: New completion + * modprobe: Try parsing help before using hardcoding option list + * (testsuite) Add vgcreate test case for _lvm_count_args with + failglob on + * _filedir_xspec: Fix with failglob on + * Various mostly array element unsetting fixes under failglob + * __reassemble_comp_words_by_ref: Make work with failglob on + (Alioth: #312741) + * _services: README in sysv init dir is not a service + * mpv: New completion alias + adjustments for mplayer (Debian: + #749115) + * (testsuite) Add puppet subcommand option test case + * puppet: Recognize some short options + * puppet: Parse most subcommand options from "help subcommand" + output + * puppet: Exit early on -h|-V|--version in addition to --help + * hostname: New completion + * nslookup: complete on hosts (Alioth: #314673) + * eog: Complete on *.pgm (RedHat: #1090481) + * pngfix: New completion + * qemu: Fix -balloon arg completion + * qemu: Apply completion to qemu-kvm/-system-i386/-system-x86_64 too + * xrandr: Use the invoked command internally, not hardcoded "xrandr" + * xrandr: Add (some) --setprovider* arg completion support + * profile.d: Don't return from a sourced script (Debian: #741657) + * FAQ: Clarify that we mean the bash man page for M-/ + * (testsuite) Avoid complete-ant-cmd.pl errors with our build.xml + * ri: Fix class completion with ri >= 3. + * ri: Fix colon handling in class completion. + * flake8: New completion + * pyflakes: New completion + * cal,chfn,chsh,dmesg,eject,hexdump,look,newgrp,renice,runuser,su,wr + ite: Deprecate on Linux in favor of util-linux ones (Debian: + #737672) + * testsuite: Add basic newgrp test case + * testsuite: Add basic test cases for deprecated completions + * _*: Install our deprecated completions too, try loading them + secondarily + * hwclock,ionice,rtcwake: Deprecate in favor of util-linux ones + (Debian: #737672) + * ssh-keygen: New completion + * Bump copyright years to 2014. + * jpegoptim: New completion + * ip: Add some addr, addrlabel, and route arg completions + * aptitude, dpkg: Replace some grep+cuts with awk + * gcc, lintian, make, pkgadd, slackpkg: grep -> "command grep" + (Debian: #734095) + * lintian: Replace some grep+cuts with awk + * (testsuite) Check for grep and ls invoked without "command", see + README + * lz4: New completion. + * optipng: New completion. + * cppcheck: Include - in --file-list completions. + * (testsuite): Limit wtf completions to A* to keep expect happier. + * wtf: Look for acronym db from /usr/share/games/bsdgames/acronyms + too. + * wtf: Don't offer -f if it was already specified. + * wtf: Hush stderr when db file doesn't exist. + * appdata-validate: New completion. + * timeout: New completion. + * _known_hosts_real: Exclude %h HostName entries (RedHat: #1015935). + * cc, c++: Check path to binary when finding out if it's gcc + (Alioth: #314417). + * cc, c++: Install minimal completion for non-gcc ones (Alioth: + #314417). + * abook, kldunload: Pre-expand \t instead of relying on sed + supporting it. + * dict: Trivial regex cleanup. + * _known_hosts_real: Pre-expand \t instead of relying on sed + supporting it (Alioth: #314393). + * zopfli: New completion. + * bzip2, gzip, lzma: Cleanups. + * Cosmetics. + * export, _variables: Do TZ= completion (Redhat: #994646). + * 2to3: New completion. + * file-roller: Reuse unzip's xspec. + * 7z: New completion. + * hcitool, rfcomm, ciptool, hciconfig: Don't leak $args. + * perl: Fix -dt: completion. + * perl*: Fix handling of relative paths in @INC. + * wget: Add --accept-regex/--reject-regex/--regex-type arg + (non)completions. + * wget: Drop incorrect -nv arg completion. + * wget: Stop completing after --help/--version. + * Clean up/compact various globs. + * cvs: Fix checkout -j non-completion. + * sh: Complete script arguments with all filenames (Alioth: + #314226). + * nmcli: Deprecate our completion, upstream has one in 0.9.8.0. + * Revert "nmcli completion was integrated upstream" + * Use == instead of =. + * cvs rm: Don't filter existing files with -f (RedHat: #949479). + * aclocal, automake: Install for *-1.10, *-1.12, and *-1.13 too. + + -- Ville Skyttä Thu, 03 Mar 2016 17:22:50 +0200 + +bash-completion (2.1) + + [ AllKind ] + * Fix __ltrim_colon_completions() fail on parameter (\$1) containing + a glob. + + [ Andreas Müller ] + * completions/Makefile.am: symlinks depends on $(DATA) to avoid race + conditions + + [ Christian von Roques ] + * Fix __reassemble_comp_words_by_ref for $COMP_CWORD == ${#COMP_WORDS[@]} + + [ David Paleino ] + * Fix helper script to create changelogs + + [ Guillaume Rousse ] + * New completions: nmcli, gphoto2 + * Improved completions: + - dsniff: add -p option completion + - dsniff: fix interface completion + + + [ Igor Murzov ] + * _command_offset: Restore compopts properly (Alioth: #313890) + * _parse_help, _parse_usage: Run commands in C locale. + * New completions: wget, zathura + * Improved completions: + - cppcheck: Add new standards to --std option. + - evince: Evince supports opening .pdf.xz files (Alioth: #313739). + - feh: Add new options introduced in feh-2.7. + - feh: Fix list of background styles. + - fusermount: Complete curlftpfs-mounts for "fusermount -u" (Debian: + #685377) + - kcov: Add new sort types (introduced in kcov-9). + - kcov: Complete arguments of --limits option. + - lvm: Fix typo in option name: s/continguous/contiguous/. + - make: Do not append space if target is a filepath. + - mount: Fix parsing /etc/fstab on *BSD. + - mount.linux: Add some new mount options intoduced in Linux 3.5 and 3.7 + - mount.linux: Add options completion for nfs and davfs. + - mount.linux: Clean up mount options, remove duplicates. + - mplayer: Add opus to the list of supported formats. + - mplayer: Add -subcp argument completion. + - opera: Handle options. + - slackpkg, slapt-get: Update the list of package sets. + - tar: Fix detection if the $prev is a tar file. + - valgrind: Add --soname-synonyms option arguments completion. + * Testsuite: + - _filedir: Remove the cruft from the a\$b->h unit test (Alioth: #313480) + + [ Jeroen Hoek ] + * Improved completions: + - unzip: Add support for OpenDocument formats. + + [ Ken Sharp ] + * Improved completions: + - wine: add .msi completion + + [ Martin Ueding ] + * Stylistic cleanup + + [ Tristan Wibberley ] + * Improved completions: + - make: incremental completion for make with compact display + - make: convert make completion to use smarter parser + + [ Ville Skyttä ] + * Avoid sourcing dirs in completion loader to avoid fd leaks (RedHat: #903540) + * Ignore colormake symlink. + * Line continuation, whitespace, and compgen -W ... -- "$cur" + quoting cleanups. + * _available_interfaces: Try with "ip link" if ifconfig is not available. + * _ip_addresses: Try with "ip addr" if ifconfig is not available. + * _known_hosts_real: Filter ruptime stdout error spewage (Alioth: #313893). + * _mac_addresses: Try local interfaces with "ip link" if ifconfig not + available. + * _mac_addresses: Try ARP cache with "ip neigh" if arp is not available. + * _mac_addresses: Fix with net-tools' ifconfig that outputs ether, not HWaddr. + * New completions: chronyc, eject, eog, file-roller, hexdump, interdiff, lua, + luac, luseradd, luserdel, lusermod, mussh, nc, ngrep, patch, pydoc, + pyflakes, pylint, ss, strings, tshark, wsimport, xxd + * Improved completions: + - acpi, chpasswd, dmesg, gkrellm, groupmems, hwclock, lastlog, pwd, vipw: + Complete options even without "-" given. + - arpspoof, dsniff, ether-wake, nmap: Offer active interfaces only. + - clzip, pdlzip, plzip: New lzip alias completions. + - colormake: New make alias completion (LP: #743208, Debian: #682557) + - cpio: Recognize pass thru when -p is bundled w/other options + (RedHat: #912113). + - cppcheck: Add --language/-x argument completion. + - cppcheck: Complete --include= with filenames. + - dnsspoof, filesnarf, macof, sshow, tcpkill, tcpnice, urlsnarf: Fix -i + completion. + - genisoimage: Use _parse_help instead of hardcoding options, add basic test + case. + - groupmems: Add -R/--root arg completion. + - hexdump: Actually install for hd as well. + - host: Complete with known hosts. + - ip: Improve addr show and link show completions. + - ip: Remove some stale TODOs. + - jar: Reuse unzip's xspec (RedHat: #928253). + - koji: Complete on build targets when --target is given to wait-repo. + - lv{create,resize,extend}, vg{create,reduce,extend,split}: Fix variable + leaks. + - lvm: Add _lvm prefix to helper functions. + - lvm: Take option args into account when counting args (RedHat: #860510). + - lvm volumes: Complete on /dev/mapper/* (RedHat: #851787). + - lzip: Do not append space after equal sign in long options. + - make: Convert internal variable names to lowercase, indentation fix. + - make: Don't leak $mode. + - make: Make work in POSIX mode. + - man: Add support for .lz man pages (RedHat: #839310). + - man: Don't expand man page extensions too early. + - man: Fix -P/--pager full path arg completion. + - modinfo: Use ,, for lowercasing instead of tr in a subshell. + - modprobe: Don't suggest installing already installed modules. + - ncftp: Add option completion. + - pkg-config: Try to complete --variable= if package name is already given. + - pydoc: Complete on keywords and topics. + - python, pydoc: Add module completion. + - scp: Treat strings with slash before colon or starting with [.~] as local. + - ssh: Add some -o and related arg completions. + - ssh: Add -O argument completion (Debian: #680652). + - tar: Don't take -I to mean bzip2. + - tar: Fix completing files inside *.tlz when J is explicitly given. + - tar: Simplify bzip patterns. + - tar: Support *.tar.lz (Debian: #703599). + - tar: Recognize taz and tb2 as compressed tarballs. + - tcpdump: Fix -z full path arg completion. + - unzip/zipinfo: Associate with more StarOffice extensions. + - useradd, userdel, usermod: Add -R/--root arg completion. + - useradd, usermod: Support comma separated -G/--groups arg completion. + - useradd: Fix -k, -K, and --home-dir argument completions. + - userdel: Add -h/--help non-completion. + - valgrind: Fix full path arg completion. + - vgcreate: Add missing symlink. + - vipw: Add -R/--root arg completion. + - vpnc: Add bunch of option arg (non)completions. + - vpnc: Use _parse_help instead of hardcoding options, add basic test case. + - wget: Use == instead of =. + - wine: Fix extension glob to work on its own. + - wol: Try "ip addr" before ifconfig for finding out broadcast addresses. + - xrandr: Add bunch of option arg non-completions. + - xrandr: Use _parse_help. + - xrandr --mode: Clean up one awk call. + - xrandr: Avoid --mode completion error when --output is not given. + - xrandr: Don't leak $i when completing --mode. + * Deprecated completions: + - udevadm: one is shipped in systemd >= 196 (RedHat: #919246). + * Testsuite: + - Make pydoc test more likely to work with our limited expect buffer size. + - Fix pwd unit test + + [ Yann Rouillard ] + * New completions: pkgutil, pkgrm, pkgadd, pkg-get, svcadm. + + [ wonder.mice ] + * Fixed tilde expanding in _filedir_xspec + + -- David Paleino Fri, 05 Apr 2013 12:05:15 +0200 + +bash-completion (2.0) + + [ Anthony Ramine ] + * Properly declare 'symlinks' dependencies + + [ David Paleino ] + * apt-get: add 'changelog' to completed commands + + [ Guillaume Rousse ] + * Add xz compression extension for kernel modules + + [ Igor Murzov ] + * sudo: Handle options (Alioth: #311414). + * sudoedit: New completion. + * _command_offset: Properly quote arguments of eval (Alioth: + #313499). + * mount.linux: Add some new mount options intoduced in Linux 3.0-3.2 + * _modules: Ignore error messages. + * modprobe, modinfo, insmod: Move modprobe and modinfo completions + to their own files. + * sbopkg: Use _parse_help. + * sbopkg, slackpkg, slapt-{get,src}: Use shorter form of the check + if file exists. + * _filedir: Properly quote paths to avoid unexpected expansion. + * su: Add linux-specific completion + * insmod, modprobe: Don't hardcode path to modinfo (Alioth: #313569) + * man: --path option is supported on Darwin (Alioth: #313584) + * man: Move variable declaration to the right place. + * feh: Update option argument completions. + * fbi, feh: Complete more supported file formats. + * fbgs: Add new options introduced in fbida-2.09. + * cppcheck: Complete new --relative-paths option arguments + * _expand: Suppress unwanted bash error messages (Alioth: #313497) + + [ Itaï BEN YAACOV ] + * scp: Recognise symlinks to directories as directories (Debian: + #666055). + + [ Jonathan Nieder ] + * ri: Rename ri_get_methods helper to add leading underscore + + [ Ville Skyttä ] + * rmmod: Add option completions. + * testsuite/generate: Generate less linefeeds. + * insmod: Install for insmod.static too. + * mplayer: Add -monitoraspect arg completion. + * mplayer: Add generic handling of options that take arguments. + * testsuite: Fix spurious modinfo and modprobe test failures on + systems that have /lib and /lib64 dirs. + * pigz: Add -p/--processes arg completion. + * testsuite: Add basic su test case. + * su: Fix long option handling. + * su: Add --session-command arg completion. + * su: Complete -s/--shell with shells instead of all files. + * lyx: Remove simple completion, upstream has more complete one + (Debian: #662203) + * testsuite/generate: Tweak linefeeds. + * make: Add generic variable completion. + * man: Recognize 3gl as man page filename extension -- at least Mesa + uses it. + * _realcommand: Try greadlink before readlink (Alioth: #313659). + * Comment spelling fix. + * qiv: Add *.svg. + * xmllint: Add *.svgz. + * autotools: Use MKDIR_P instead of mkdir_p (Alioth: #313671). + * lbzip2: Add -n argument completion. + * *_tilde*: Escape tilde in [[ $1 == \~* ]] tests (RedHat: #817902). + * New completions: + - acpi, hwclock, pwd, ssh-add, vmstat + + [ Sung Pae ] + * Workaround bash bug that fails to complete <, > + + -- David Paleino Sun, 17 Jun 2012 20:01:36 +0200 + +bash-completion (1.99) + + * Hopefully the last 2.0 preview. + + [ David Paleino ] + * Correctly list purgeable packages for dpkg --listfiles and dpkg + --purge (Debian: #647684) + * Fix bash_completion paths in README (Debian: #647941) + + [ Florian Hubold ] + * xv: Add *.eps and *.ps to filename completions (Alioth: #313477) + + [ Igor Murzov ] + * Add and use _sysvdirs() function that sets correct SysV init + directory. + * cppcheck: Add new options introduced in cppcheck-1.52. + * cppcheck: Several ids separated by commas can be given for + --enable=. + * _known_hosts_real: Add some quotes (Alioth #313158) + * Merge completions/service into the bash_completion script. + * _modules: Follow symlinks in /lib/modules/$(uname -r) (Alioth: + #313461) + * mount, umount: Add linux-specific completions. + * mount: Don't suggest short options. + * pidof: Don't check OS type (Alioth #311403) + * removepkg: Make it possible to complete filenames. + * umount: Fix for completion of relative paths. + * upgradepkg: Support oldpackage%newpackage notation. + * wine: Complete all files after an .exe (Alioth #313131) + * New completions: + - htop, nethogs. + + [ Jan Kratochvil ] + * rpm: Treat -r as --root (RedHat: #759224). + + [ Raphaël Droz ] + * Added a word about compopt -o nospace in styleguide.txt. + * _ip_addresses: Make it locale agnostic. + + [ Ville Skyttä ] + * cc, c++: Install gcc completion if compiler looks like GCC + (Alioth: #311408). + * cppcheck: Offer header filename completions too. + * curl: Add bunch of new option argument completions. + * dequote: Use printf instead of echo (Alioth: #312163). + * dict: Speed up word completion with common use cases and large + word lists. + * dmesg: Adapt to versions returning long options. + * Document $split && return. + * _filedir, _tilde: Ignore compopt stderr for direct invocations in + unit tests. + * Include doc/ in dist tarball. + * _known_hosts_real: Handle more than two hostnames per known hosts + line (Debian: #647352). + * _known_hosts_real: Include hosts reported by ruptime (Alioth: + #313308). + * _known_hosts_real: Support > 1 files per *KnownHostsFile line + (Debian: #650514). + * lintian: Use <<< instead of echo and a pipe (Alioth: #312163). + * lrzip: -T no longer takes an argument since version 0.570. + * _mac_addresses: Grab addresses from FreeBSD's ifconfig -a output + too. + * make: Add -j/--jobs completion, complete up to number of CPUs * 2. + * _muttconffiles: Use printf instead of echo (Alioth: #312163). + * _parse_help, _parse_usage: If first arg is "-", read from stdin. + * rpm: Add --delsign completion, don't suggest --resign (identical + to --addsign). + * _variables: New function split from _init_completion. + * vi and friends: Fix /etc/ld.so.conf.d/* completion (Alioth: + #312409). + * New completions: + - plague-client, desktop-file-validate, valgrind, ccache, iperf, + koji, lzip, udevadm. + + -- David Paleino Sat, 07 Jan 2012 23:52:36 +0100 + +bash-completion (1.90) + + * bash-completion 2 preview: dynamic loading of completions. + + [ David Paleino ] + * If _filedir 'ext' returns nothing, just fallback to generic file + completion. It is optional, and off by default. Patch by Clint Byrum + (Debian: #619014, LP: #533985) + * Fix __get_cword_at_cursor_by_ref: check for $index when completing with a + cword+1 argument already present (Debian: #622383) + * Layout change: everything is now in /usr/share/bash-completion/, rather + than in /etc/. + * Get rid of BASH_COMPLETION_DIR, BASH_COMPLETION_HELPERS_DIR, BASH_COMPLETION + * Fix autotools to use pkgdatadir instead of redefining datadir, get rid of + helpersdir. + * Implemented a blacklist for unwanted third-parties completions + * New completions: + - epdfview, lpr and lpq (Raphaël Droz), mysql (Raphaël Droz) + * Improved completions: + - ant: handle "extension-point" the same as "target" tag (Petr Kozelka, + Alioth: #313105) + - apt: add 'download' to subcommands (Debian: #625234, Ubuntu: #720541) + - aptitude: add 'versions' command (Debian: #604393) + - dpkg-query: use the 'dpkg' completion (Debian: #642526) + - lintian: remove --unpack-level (Debian: #623680) + - {shadow,coreutils}: fix broken _allowed_groups usage + - rrdtool: complete filenames after commands (Debian: #577933) + - sitecopy: fixed a bug with grep and brackets: use sitecopy -v to fetch + sites (Raphaël Droz). + + [ Freddy Vulto ] + * Improve __reassemble_comp_words_by_ref() (Alioth #313057) + * Testsuite: + - add -unsorted option to _get_hosts() + + [ Guillaume Rousse ] + * Use $() for subshell, instead of backquotes + * Use simple quotes for constant strings + * Drop -o filenames, as suggested by Ville + * New completions: puppet + + [ Igor Murzov ] + * Abort completion file loading earlier if required commands are not + available. + * docs: Improve tester's manual + * Make completions that use _command also work with file names + * _command_offset: Restore compopts used by called command. + * New completions: + - pkgtool, makepkg, rmp2tgz, slapt-get, slapt-src, slackpkg, kcov, feh, + xgamma, fbi, fbgs + * Improved completions: + - file: ddd few missing --exclude arguments completions + - host, nslookup: Remove completions for bind utils from bash_completion. + - {install,upgrade,explode}pkg: use -o plusdirs instead of -o dirnames + - makepkg: should complete filenames + - removepkg, upgradepkg, installpkg: add option completion + - xrandr: Add more option completions. + - overall clean up of different slackware-specific completions + * Testsuite: + - add basic tests for pkgtools, rpm2tgz, slapt, sbopkg, slackpkg + - fix broken tests for finger and xhost + - remove unused -expect-cmd-full option from assert_complete* + + [ Sergey V ] + * New completions: sbopkg + + [ Ville Skyttä ] + * Load completions in separate files dynamically, get rid of have() + * Drop unnecessary $USERLAND checks + * Try /usr/sbin before /sbin in have() + * Try both full path and basename completions for sudo etc (Alioth: #313065) + * Add _init_completion() for common completion initialization and generic + redirection handling + * Replace actual sysconfdir in bash_completion on install (Alioth: #313081) + * Drop support for bash < 4.1 + * Drop no longer needed _compopt_o_filenames() + * Drop no longer needed "type compopt" checks + * docs: Update "simply sourcing" instructions to match new layout, check + $PS1. + * Get rid of bash_completion self-parsing from _filedir_xspec + (RedHat: #479936). + * Provide profile.d hook for per user disabling of bash_completion + (Debian: #593835) + * New completions: + - a2x, arping, asciidoc, base64, cal, chrpath, cppcheck, curl, dmesg, + dot, file, gnome-mplayer, gprof, hddtemp, host, htpasswd, idn, ionice, + jps, lbunzip2, lbzip2, lbzcat, prelink, protoc, pwdx, pwgen, reptyr, + sum (RedHat: #717341), watch + - phing: reuse ant completion (Elan Ruusamäe, Alioth: #312910) + - pinfo: reuse info completion + * Improved completions: + - bluez, e2fsprogs, grpck, java (Mattias Ulbrich), passwd, pwck, route, + rsync, smartctl + - ant: improve -lib, -find/-s, and -D argument completions; rewrite build + target parsing in plain bash, add build file test case + - aspell: add --add-filter|--rem-filter completions; get --mode completions + from 'aspell modes' output + - bzip2, gzip, python, sysbench: quote command argument to _parse_help() + - chsh: use _allowed_users instead of plain compgen -u + - cksfv: add -g argument completion + - cpan2dist: don't hang if no package list files exist + - crontab: use /sys/fs/selinux and /selinux instead of /etc/selinux to + find out if SELinux is around + - cvs: (diff) parse options from cvs diff instead of plain diff; drop -o + default to fix CVS root completions; (commit) complete on entries + instead of default if COMP_CVS_REMOTE is not set; improve CVS + controlled file completions; add CVS controlled file completions for + admin and update; list "primary" command names first in mode switch; + recognize some additional commands and synonyms; add editors/watchers + completion; sort mode completions alphabetically + - freeciv: complete freeciv-* in addition to civclient/civserver + - gdb: improve filename completion + - gendiff: do file completion after output redirection + - getent: add gshadow to known databases; allow multiple completions from + same db, add option completion + - info: add option completion support + - ipsec (Tobias Brunner): drop uname check, add strongSwan specific + completion with fallback, complete connection names for 'up', 'down' and + other commands + - jar: complete on *.sar (JBoss service archive) + - java, javac: add -X* completions + - javadoc: implement -linkoffline two argument completion + - killall: activate completion on Darwin (Alioth: #312350) + - (la)tex (Ted Pavlic): add *.dbj to filename completions (RedHat: #678122) + - man: add option parsing and completion + - modplug*: add more extensions for files supported by libmodplug + - mutt: support tildes when recursively sourcing muttrc files + (Debian: #615134); expand tilde in mutt query command (Alioth: #312759) + - ntpdate: add some option argument (non)completions + - oo{writer,impress,calc,draw} (Matej Cepl): complete on LibreOffice + FlatXML extensions (RedHat: #692548) + - perldoc (Scott Bronson): override MANPAGER when generating perldoc + completions (RedHat: #689180); don't parse man page when we know it'll + produce no completions; use perldoc itself instead of man + - pgrep: add option and option argument completions + - rpm: make rpm --queryformat use more consistent; drop rpm query support + for rpm < 4.1 + - rpmbuild: add --buildpolicy completion + - rpmcheck: drop reference to undefined $files variable (Alioth: #313270) + - screen: add _terms() and -T completion; add commands completion + (Alioth: #312164, RedHat: #547852) + - _services: avoid bogus completions when init or xinetd dirs exist but are + empty; include systemd services + - smartctl: fix short alternative for --tolerance + - ssh, scp, sftp, ssh-copy-id: add some option argument (non)completions + - strace: don't append space for -e *= completions; don't try to extract + syscall names if they're not going to be used; rewrite arch specific + syscall extraction in plain bash + - svn*: don't suggest short options + - tar: fix completion of files inside *.tar.bz2 archives when [Ijy] is not + given; added option completions; improve tar *[cr]*f completions + (Debian: #618734) + - unzip: complete on *.sar (JBoss service archive) + - xmllint, xmlwf: complete on *.tld (tag library descriptor) + - xmlwf: add -v non-completion + - xmms: add some option argument completions + - xz: apply xz completion to pxz too; non-complete + --memlimit{,-compress,-decompress} + * Testsuite: + - add basic tests for gendiff, mdadm, puppet, xzdec, mii-diag, mii-tool, + grpck, passwd, pwck, samba, rdesktop, fusermount, tcpdump, l2ping, + ssh-copy-id, postfix, qemu, ldap*, medusa, mdtool, monodevelop, + msynctool, cfagent, lpr, lpq, mysql, nslookup, compare, conjure, + import, stream + - fix tests for ri + - fix get_hosts option docs. + - add test case for Debian: #622383. + - add chown foo: and :foo test cases, should complete files + (RedHat: #710714) + + -- David Paleino Thu, 03 Nov 2011 09:53:55 +0000 + +bash-completion (1.3) + + [ Guillaume Rousse ] + * added pure-perl perldoc completion helper, using work from Aristotle + Pagaltzis (pagaltzis@gmx.de) + * added completions for xfreerdp and iscsiadm + * updated xm subcommands list + + [ David Paleino ] + * Fixed "service" completion, thanks to John Hedges (Debian: #586210) + * Complete on all files for mplayer's -dvd-device + * Fixed typo in openssl completion (Debian: #609552) + + [ Ville Skyttä ] + * Activate hping2 completion also for hping and hping3. + * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake, + filefrag, gendiff, growisofs, iftop, ip (Debian: #600617), javaws, kid3, + lrzip, lsof, mktemp, portecle, POSIX sh, sha{,224,256,384,512}sum, + sysbench, tune2fs, xmodmap, and xrdb completions. + * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2, + *.awb, and *.iso (Alioth: #311420) to mplayer filename completions. + * Add "short" tarball extensions to unxz, unlzma etc completions. + * Improve /etc/init.d/*, ipmitool, jar, java, javadoc, man, mencoder, mkdir, + mplayer, pack200, povray, python, rpmbuild, sqlite3, tar, wodim, and + general help parsing completions. + * Fix p4 and povray completions (Alioth: #312625). + * Add *.xsd, *.xsl, *.rng, *.wsdl, and *.jnlp to xmllint and xmlwf filename + completions, and *.gz versions of all of the supported ones for xmllint. + * Recognize rpm query mode based on the --file, --group, --package, and + --all long options (RedHat: #630328). + * Improve rpm query option completions. + * Drop bad kompare filename completion (Alioth: #312708). + * Make _filedir and _filedir_xspec complete uppercase versions of their + filename extension arguments in addition to exact case matches. + * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658). + * Fixes to completions for filenames containing tabs (RedHat: #629518). + * Add *.iso (Alioth: #311420), *.m2t and *.m2ts (Alioth: #312770) to + xine-based player filename completions. + * Add /etc/ethers to MAC address completion sources. + * Add *.gem and *.spkg to tar filename completions. + * Complete known hosts from avahi-browse only if $COMP_KNOWN_HOSTS_WITH_AVAHI + is non-empty (Alioth: #312691, RedHat: #630326). + * Improve relevance of many user/group completions, depending on context. + * Remove most "-o filenames" options to "complete", turn "-o filenames" on + dynamically when needed instead. + * Add/improve various autotools completions. + * Add *.apk to unzip and jar filename completions. + * Do not load bash_completion in profile.d script if progcomp is not enabled. + * Ignore muttrc source entries that are not files (Alioth: #312881). + * Re-enable postgresql database and user completion (Alioth: #312914, + Ubuntu: #164772). + * Add *.fdf to various PDF viewer completions. + + [ Freddy Vulto ] + * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) + * Speed up `compopt' availability detection + * Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646) + * Fix __reassemble_comp_words_by_ref (Alioth #312740) + + [ Anton Khirnov ] + * Improve mplayer and mencoder completions. + + [ Paul Walmsley ] + * Add *.webm to mplayer file completions (Debian: #588079). + + [ Miklos Vajna ] + * Add *.amr to mplayer file completions (Alioth: #312634). + + [ Andrej Gelenberg ] + * Add *.part (partially downloaded) to mplayer and xine-based player + completions (Alioth: #312657). + + [ Stephen Gildea ] + * Fix false posives for non-option words in _parse_help (Alioth: #312750). + + [ Andrey G. Grozin ] + * Add *.fb2 to okular filename completions. + + -- David Paleino Sun, 06 Feb 2011 19:03:46 +0100 + +bash-completion (1.2) + + [ David Paleino ] + * Don't use pidof in _known_hosts_real() to detect whether Avahi is + available, since it's not available on MacOS X. Thanks to Rainer + Müller (bash-completion MacPorts maintainer) + * Fixed "freq" and "rate" completion for iwconfig + * contrib/munin-node fixed (Debian: #550943) + * contrib/dpkg fixed -W and --show completing on .?(u)deb's (Debian: #552109) + * contrib/aptitude: add @(add|remove)-user-tag + * Added munindoc completion to contrib/munin-node, thanks to Tom + Feiner (Debian: #553371) + * Added colordiff completion, same as diff + * contrib/cpio: added missing completions for -?, --help, --license, --usage, + --version and (-p) --to-stdout (Debian: #557436) + * Style policy: don't use fancy globbing in case labels + * Added .fdf completion to okular and evince + * Added .okular completion to okular (Debian: #545530) + * Added lintian completion + * Refreshed reportbug completion, added --from-buildd (Debian: #579471) + * Special-case "apt-get source" (Debian: #572000) + * Added lintian completion (Debian: #547361) + * contrib/dpkg: update completion to current API + * Styleguide: establish line wrapping and $() instead of `` + + [ Ville Skyttä ] + * Create bz2 dist tarball too. + * Include CHANGES in dist tarball. + * Include profile snippet in tarball, install it. + * Rename contrib/bluez-utils to contrib/bluez to follow bluez 4.x naming. + * Apply cardctl completion to pccardctl too. + * Apply pine completion to alpine too. + * Remove many unnecessary short option completions where long ones exist. + * Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip, + iconv, lftp, look, lzma, make, man, mdadm, modprobe, mount, mplayer, + mysqladmin, perldoc, rsync, screen, service, scp, ssh, sshfs, unzip, + update-alternatives, vncviewer, wget, yp-tools, xine based players' and + general hostname completions. + * Add abook and wtf completion, based on work by Raphaël Droz. + * Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, modplug123, + pm-utils, rtcwake, pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz, + unpigz, and wol completions. + * Don't overwrite other host completions when completing from multiple + SSH known hosts files. + * Speed up installed rpm package completion on SUSE, based on work by + Marco Poletti (Alioth: #312021). + * Improve sourcing snippets from completion dirs. + * Drop support for bash < 3. The compatibility global variables $bashN, + $default, $dirnames, $filenames, $compopt, $nospace, $bashdefault, and + $plusdirs have been dropped too. 3rd party completions should switch + to using the complete/compgen features directly, and BASH_VERSINFO + for bash version checks. + * Protect various completions from unusual user input by not embedding the + input in external command arguments (Debian: #552631). + * Add /sbin to $PATH when invoking ifconfig and iwconfig. + * Combine dcop and qdbus completions into the latter. + * awk and sed usage portability fixes (Alioth: #311393, Debian: #501479). + * Fix leaking local variables from various completions. + * Turn on -o filenames in _filedir on bash >= 4. + * Deprecate modules completion, upstream modules >= 3.2.7 ships one. + * Protect grep invocations from user aliases (Alioth: #312143). + * Split sshfs completion from contrib/ssh into contrib/sshfs. + * Split mount and umount completion into contrib/mount. + * Split service completion into contrib/service. + * Split chown, chgrp, and id completions into contrib/coreutils. + * Split kill, look, and renice completions into contrib/util-linux. + * Split killall, pkill, pgrep and related completions into contrib/procps. + * Split ipsec completion into contrib/ipsec. + * Split ifup and ifdown completions into contrib/ifupdown. + * Do basic HTML file completion with Firefox and Chrome and friends, + and Epiphany. + * Do basic diff/patch completion with cdiff and kompare. + * Don't install mock completion by default, it's in upstream mock > 1.1.0. + * Do basic text editor completion with xemacs, sxemacs, kate, and kwrite. + * Do meta-command completion for aoss and padsp. + + [ Freddy Vulto ] + * Prevent root PATH expansion prolifering in _root_command (bash >= 4.1.4) + * Only complete xhost if (_)xhost is available. + * Added _get_comp_words_by_ref to replace both _get_cword & _get_pword. + Also additional variables `words' and `cword' can be returned. + * Added _upvar & _upvars helper functions to aid in passing variables + by reference. + * Make _filedir emulate `-o filenames' + * Fixed completion perl modules containing colons. + * Merged __get_cword3 & __get_cword4 to _get_cword. + * Added __expand_tilde_by_ref helper function. + * Added __ltrim_colon_completions to fix completions containing colons + * Improved mutt completion + * Added _get_pword helper function, thanks to Sung Pae (Alioth: #312030) + + [ Ted Stern ] + * Fix modules completion for "(default)" entries. + + [ Jeremie Lasalle Ratelle ] + * Fix rsync remote path completion (Alioth: #312173, Gentoo: #297818). + + [ Leonard Crestez ] + * Improve ssh -o suboption completion (Alioth: #312122). + * Fix NFS mounts completion (Alioth: #312285). + * Fix completion of usernames (Alioth: #311396, Debian: #511788). + * Fix chown test crashing on systems with no root group (Alioth: #312306). + * Fixed tests when BASH_COMPLETION or TESTDIR contain spaces. + * Fix mount handling of escapes (Alioth: #311410, Launchpad: #219971, + Debian: #511149). + * Cleanup scripts to run tests. Make runUnit and runCompletion use test/run. + Make it possible to run tests from any directory. + * Add a --debug-xtrace option to test/run using BASH_XTRACEFD from bash-4.1. + * Add a --timeout option to test/run to override the default expect timeout. + + [ Raphaël Droz ] + * Add xsltproc completion (Alioth: #311843). + + [ Adrian Friedli ] + * Add ipv6calc completion. + + [ Ildar Mulyukov ] + * Add showmount completion (Alioth: #312285). + + [ Neville Gao ] + * Fix mount completion error "bash: [: too many arguments" (Alioth #312381). + + [ Austin English ] + * Make lookup of wine file completions case insensitive. + + [ Igor Murzov ] + * Improve xz completion (Alioth: #312466). + + [ Mario Schwalbe ] + * Update find completion (Alioth: #312491, Launchpad: #570113). + + [ Mark van Rossum ] + * Add basic lyx completion. + + -- David Paleino Wed, 16 Jun 2010 17:44:59 +0200 + +bash-completion (1.1) + + [ David Paleino ] + * Permit .gz files concatenation (Debian: #514377) + * Fix svk completion using $filenames instead of $default (Debian: #524961) + * Really add build-dep to aptitude's completion (Debian: #495883) + * Fix checks for GNUish userland, thanks to Robert Millan (Debian: #529510) + * Fix typo in .ass subtitles completion for mplayer (Debian: #531337) + * Fix regression on man(1) completion: also complete on local .3pm files + (Debian: #531343) + * Split mutt completion to contrib/mutt + * Split iconv completion to contrib/iconv + * Split dict completion to contrib/dict + * Split {update,invoke}-rc.d completions to contrib/sysv-rc + * Don't install _subversion anymore, upstream completion is better than + ours. Added to EXTRA_DIST in Makefile.am + * Split autorpm completion to contrib/autorpm + * Split jar completion to contrib/jar + * Split chkconfig completion to contrib/chkconfig + * Split chsh completion to contrib/chsh + * Split apt_build completion to contrib/apt-build + * Split aptitude-related completions to contrib/aptitude + * Split apt-cache and apt-get completions to contrib/apt + * Split rpm-related completions to contrib/rpm + * Split cvs-related completions to contrib/cvs + * Split man completion to contrib/man + * Split bash builtins completions to contrib/bash-builtins + * Split dpkg-related completions to contrib/dpkg (and re-enable usage + of grep-status if available) + * Split gcc completion to contrib/gcc + * Split dselect completion to contrib/dselect + * Split cardctl completion to contrib/cardctl + * Split pineaddr completion to contrib/pine + * Added avahi-discovered hosts to _known_hosts_real() (Debian: #518561) + * Added m4v completion to mplayer (Debian: #504213) + * Improve qemu completion (Debian: #534901) + * Added sshfs completion (shares the same as scp) (Debian: #545978) + * Fixed obvious brokenness (typos) in contrib/mdadm + * Clean [1.2.3.4]:port format in known_hosts, thanks to + Xuefer (Gentoo: #284563) + * Added --no-generate to "apt-cache pkgnames" calls, make it faster + on certain configurations (Debian: #547550) + * Split okular from evince filename extension completion, needed to add + okular-specific completions: xps, epub, odt, fb, mobi, g3 and chm. + Also, okular can read any of its formats also in .gz/.bz2 compressed + format, so change the regular expression to match this. + * Remove --with-suggests and --without-suggests from aptitude completion + * Patches from PLD Linux (thanks to Elan Ruusamäe): + - avoid sed pipe as ps itself can omit the headers + - improve service(8) completion, also look for "msg_usage" + + [ Ville Skyttä ] + * Split yum completion to contrib/_yum (no longer installed by default, the + intent is to move it to yum upstream soon). + * Split yum-arch completion into contrib/yum-arch, load completion only if + yum-arch is installed. + * Update list of yum commands and options. + * Add yum repolist, --enable/disablerepo, --disableexcludes, -d, -e, --color, + and --enable/disableplugin completions. + * Add chkconfig --override and resetpriorities completions. + * Split mplayer and friends completions to contrib/mplayer. + * Parse top level mplayer and friends option completions from -list-options. + * Fix dir-only completion for make to include only dirs, not files. + * Remove unused variable RELEASE. + * Improve aspell dictionary completion: don't hardcode data-dir, get + canonical dicts from "aspell dicts". + * Always use /etc/shells for chsh -s completion, don't complete on comment + lines in it. + * Fix rpm --whatrequires/--whatprovides completions with spaces and other + unusual characters, add filename based --whatrequires completions. + * Add modplugplay filename completion. + * Add more mod-like audio file extensions for xine-based players and timidity. + * Complete on plain alternatives like update-alternatives. + * Rename installed_alternatives() to _installed_alternatives(). + * Add /etc/pki/tls/openssl.cnf to list of default openssl config files, + search for default ones only if -config is not given. + * Use POSIX compliant arguments to tail in mkisofs completion. + * Protect various completions from unusual user input by not embedding the + input in external command arguments. + * Add _split_longopt() helper for improved handling of long options that + take arguments in both "--foo bar" and "--foo=bar" formats. + * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp, + chown, chkconfig, cpio, dpkg, heimdal, iptables, mailman, make, mc, + mii-diag, mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug, + samba, smartctl, yum, and generic long option completion (Alioth: #311398). + * Add chown --from and --reference value completions. + * Add chgrp --reference value completion. + * Do not assume all --foo= options take filenames in generic long option + completion, assume only that --*file*= does, and that --*dir*= takes dirs. + * Add make --old/new-file, --assume-old/new, --what-if value completions. + * Add smartctl -n/--nocheck completion, add more other value completions. + * Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, service, + and tcpdump completions. + * Split ant completion to contrib/ant, improve the built in one. + * Improve postfix completion. + * Improve samba completion. + * Split lilo completion to contrib/lilo. + * Split reportbug and querybts completions to contrib/reportbug. + * Remove debug output noise from quotaon completion. + * Split Linux wireless tools completion to contrib/wireless-tools. + * Add mock completion. + * Split FreeBSD kld(un)load completion to contrib/kldload. + * Split FreeBSD pkg_* completion to contrib/pkg_install. + * Split FreeBSD portupgrade and friends completion to contrib/portupgrade. + * Split Slackware pkgtools completion to contrib/pkgtools. + * Improve rpm group completion (displayed completions are still wrong). + * Change many completions to load in memory only if the completed commands + are available. + * Invoke the actual mplayer/mencoder command being completed (with full path) + to get various completions instead of simply "mplayer" or "mencoder". + * Associate OOXML/MS Office 2007 extensions with OpenOffice applications. + * Associate .tsv with oocalc. + * Add xmlwf completion. + * Associate *.po with poedit, gtranslator, kbabel, and lokalize. + * Add xz, xzcat, xzdec, and unxz completion. + * Add lzcat, lz*grep, lzless, lzmore, and unlzma completion. + * Load "modules" completion if /etc/profile.d/modules.sh exists even if + the "module" alias has not been defined (yet). + * Add *.ogv to xine-based players (Debian: #540033). + * Add $compopt (":" i.e. no-op with bash < 4, "compopt" with >= 4). + * Complete bzcat and zcat only on compressed files. + * Do not require a dot in bzcmp, bzdiff, bz*grep, zcmp, zdiff, z*grep, zless, + and zmore filename completions. + * Add xz and compress support and more tarball filename extensions to + rpmbuild -t*/--tarbuild completion. + * Don't hardcode path to lsmod. + * Fix sbcl file/dirname completion (Debian: #545743). + * Add /sbin to $PATH when invoking lspci and lsusb. + * Support .xz suffix in info page completions. + * Prevent rpm --define/-D completions from falling through. + * Add more common options to rpm option completions. + + [ Todd Zullinger ] + * Make yum complete on filenames after install, deplist, update and upgrade + when the following argument contains a slash. + + [ Mike Kelly ] + * Fix _filedir on bash 4. + * Add support for xz to tar completion. + * Fix _quote_readline on bash 4 (Debian: #544024). + + [ Guillaume Rousse ] + * Split mkinitrd completion to contrib/mkinitrd, improve it. + * Split smartctl completion to contrib/smartctl. + * Better ssh and sftp completion + * Better xhost completion + * Split _known_hosts completion in two parts, to avoid parsing command line + twice + * Added strace completion + * Added xm completion + * Added rpcdebug completion + * Added msynctool completion + * Added openldap completion + * Added ldapvi completion + * Added heimdal completion + * Added vpnc completion + * Added rpmcheck completion + * Added munin-node completion + * Added bluez-utils completion + * Added samba completion + * Added cfengine completion + * Added xmllint completion, contributed by Ville + * Added shadow completion, contributed by Ville + * Added repomanage completion, contributed by Ville + * Splitted and enhanced openssl completion + * Added rfkill, mdadm and resolvconf completions + + [ Raphaël Droz ] + * Add mount -L and -U completion. + + [ Philipp Weis ] + * Add .dvi.{gz,bz2} completion for evince/okular (Debian: #522656) + + [ Freddy Vulto ] + * Patched _known_hosts() to support multiple {Global,User}KnownHosts in SSH + config files, thanks to Thomas Nilsson (Alioth: #311595) (Debian: #524190) + * Fix leaking $i from info, man and python completions. + * Added setting COMP_KNOWN_HOSTS_WITH_HOSTFILE. _known_hosts_real() will add + hosts from HOSTFILE, unless COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an + empty value (Alioth: #311821) + * Quoted $cur to prevent globbing - thanks to Eric Blake (Alioth #311614) + * Fix leaking $muttcmd from mutt completion + * Fix completing multiple hosts (Debian: #535585) + + [ Michele Ballabio ] + + * Add more extensions to pkgtools completion. + + -- David Paleino Sat, 03 Oct 2009 15:41:49 +0200 + +bash-completion (1.0) + + [ Guillaume Rousse ] + * Make bibtex complete on .aux files + * Add .xvid and .XVID to player completion + * Added cowsay/cowthink completion + * Added brctl completion + * Added cpan2dist completion + * Added qemu completion + * Added net-tools (mii-tool and mii-diag) completions + * Added minicom completion + * Added quota-tools completion + * Added rdesktop completion + * Added tightvncviewer completion + * Cleanup screen completion, and make it completes on options + + [ David Paleino ] + * Added .kar to Timidity completion. + * Fix killall completion, remove trailing ":" on certain process + names + * Fix man -l completing filenames (Debian: #497074) + * (Partly) fixed java classes completion (Debian: #496828). Look for + FIXME in source. + * Dump to /dev/null error message from look(1) with no arguments + (Debian: #495142) + * Set ssh as default for rsync (was rsh) (Debian: #492328) + * Added .oga, .ogv, .ogx to mplayer completion (Debian: #496162) + * Added .epub to unzip|zipinfo completion (Debian: #492476) + * Added ssh-copy-id completion (Debian: #491856) + * Moved ssh completion to separate file (Debian: #360628) + * Bogus completion when mounting subdirs fixed (Debian: #322238) + * Fix `apt-cache showsrc` completing only on source package names + (Debian: #361535) + * Fixed bugs with gdb completion: + - when an empty directory is in $PATH (thanks to Morita Sho) + (Debian: #497597) + - when a non-existing directory is in $PATH (Debian: #499780) + * Fix missing completion for "-n" and "-e" (we were using echo, now + using printf) (thanks to Morita Sho) (Debian: #498105) + * Fixed gpg completion: + - --@(export|@(?(l|nr|nrl)sign|edit)-key)) (Debian: #500316) + - -@(r|-recipient)) + * Fixed .cb[rz] completion for evince (Debian: #502885) + * Added gksudo, gksu, kdesudo completion + * Added apache2ctl completion + * Added gpg2 completion (Debian: #489927) + * Fixed mplayer -skin completion (Debian: #501473) + * Fixed errors with POSIX enabled (Debian: #502804) + * Fixed dpkg-source wrong exit() with return() (Debian: #) + * Added --schedule-only to aptitude's completion (Debian: #502664) + * Added build-dep to aptitude's completion (Debian: #495883) + * Added support for `-F configfile' to _known_hosts(), ssh, scp and + sftp, thanks to Freddy Vulto (Debian: #504141) + * Fixed sed quoting bug in _known_hosts(), thanks to Freddy Vulto + (Debian: #504650) + * Allow `Host(Name)' in ssh config file to be indented + * Allow `Host(Name)' in ssh config file to have trailing comment. + * Allow for comments in known_hosts files (Debian: #511789) + * Fixed perl -I/-x completion, thanks to Freddy Vulto + (Debian: #504547) + * README updated: explain how to use bash-completion correctly. + (Debian: #506560) + * TODO updated: the Alioth team is now upstream. + * Added qdbus completion, thanks to Terence Simpson (Ubuntu: #257903) + * Added monodevelop and mdtool completions. + * Split subversion-related completions to contrib/_subversion + (prefixed with _ to avoid file conflicts with upstream's one) + * Fixed completion of environment variables, thanks to Morita Sho + (Debian: #272660) + * Fix dpkg completion bug: it listed only non-Essential packages + (Debian: #511790) + * Fixed _dpkg_source completion (Debian: #503317) + * Added _parse_help() to try to parse options listed in $command + --help + * Fixed gzip completion to use _parse_help(), since the available + options vary with distributions + * Added to_review/ directory, where completions needing a review would + go. After it gets accepted, the completion would go into contrib/. + * Remove unused UNAME local variable in _info() (Debian: #501843) + * AUTHORS added + * Make _alias() use _get_cword + * Added .zip to jar completions (Debian: #521041) + * Merge from Gentoo: + - fix 'find' completion so that it properly completes on -?(i)whilename. + Patch by Ciaran McCreesh. + - use make -qp to parse the Makefile for us, so we get proper completion + on things like pattern rules. Patch by Mike Kelly . + - complete on gkrellm2 as well. Patch by Aaron Walker. + - fix CVS completion + * Merge from Ubuntu: + - consume error messages in configure completion (Ubuntu: #223882) + (Mika Fischer) + - quote $xspec in _filedir_xspec in case it is empty, which would + cause errors if there was no match under failglob. (Ubuntu: #194419) + (Mika Fischer) + * debian/links fixed (Debian: #494292) + * debian/control: + - fixed typo in the long description + - added Vcs-* fields + * debian/install: + - correctly install contrib/* under /etc/bash_completion.d/ + * debian/copyright updated + * extra/dh_bash-completion: + - updated to support a list of files in debian/.bash-completion + (Debian: #512917) + + [ Ville Skyttä ] + * Added JPEG 2000 files to display completion, thanks to Bastien Nocera + (RedHat: #304771) + * Improved rpm macro completion. + * Added -E to rpm completion. + * Improved rpm backup file avoidance. + * Improved /var/log/rpmpkgs based rpm installed package completion. + * Improved performance of rpm -qa based rpm installed package completion. + * Improved features and performance of yum completion. + * Added support for p (POSIX) and x (x.org) man sections. + * Improved filename based man page completion. + * Added minimal sqlite3 completion. + * Improved getent completion (Ville Skyttä, Guillaume Rousse). + * (Re)fix gzip and bzip2 options completion. + * Improved svn filename completion (RedHat: #430059). + * Add lzma completion (Per Øyvind Karlsen, Ville Skyttä). + * Add .mp2 and .vdr to mplayer completion (RedHat: #444467). + * Add .mkv, .mp2 and .vdr to *xine completion (RedHat: #444467). + * Added lzop completion. + * Fix scp metacharacter escaping. + * Remove duplicate cpio completion, thanks to Freddy Vulto (Debian: #512823) + * Fix awk error in "modprobe -r /" completion (Debian: #512556). + * Expand ~foo to dir name more eagerly to avoid quoting issues. + * Fix -sourcepath handling in javadoc packages completion. + * Extract process name completion from _killall to _pnames, make it work + for others than Linux and FreeBSD. + * Fix process name completion with relative paths (RedHat: #484578). + * Use improved process name completion in pgrep in addition to killall. + * Enable pgrep and pkill completion if the commands are available, not just + on Linux and FreeBSD. + * Drop hg completion, an improved version is shipped with Mercurial + (contrib/bash_completion in the tarball). + * Make okular complete on same files as evince, thanks to Mary Ellen Foster + (RedHat: #486998). + * Apply ps2pdf completion to ps2pdf{12,13,14,wr} too. + * Simplify bash_completion.sh, return earlier in non-applicable environments. + * Remove obsolete --buildarch and --buildos rpm(build) completions. + * Add rpmbuild --target completion. + * Use "-profile help" to get mplayer and friends -profile completions. + * Fix local array initialization under bash 3.0, prevents "()" occurring in + file and dir name completions. + + [ Freddy Vulto ] + * Restored `_display()' completion for `display' by removing + completion-by-extension for `display' (Alioth#311429) + * Removed duplicate completion option `-borderwidth' for `display' + * Prevent completion dir from being sourced twice if + BASH_COMPLETION_DIR and BASH_COMPLETION_COMPAT_DIR are equal (Alioth#311433) + * Make `_mii-tool()' and `_mii-diag()' POSIX-compliant + * Fix _isql completion waiting for grep input if $ODBCINI not set; handle + whitespace in $ODBCINI. + * Split vncviewer completion in _tightvncviewer() and _xvnc4viewer() + Added _realcommand() global function. + + [ Jakob Unterwurzacher ] + * ps2pdf can run on .pdf files as well. (Debian: #516614, Ubuntu: #316943) + + [ Santiago M. Mola ] + * Add .ape to mplayer supported extensions (Alioth#311510). + + -- David Paleino Wed, 25 Mar 2009 23:18:24 +0100 + +bash-completion (20080705) unstable; urgency=low + + [ David Paleino ] + * Added more completions to imagemagick (thanks to Nelson A. de + Oliveira) (Debian: #487786) + * Added xrandr completion (thanks to Anton Khirnov) (Debian: #487825) + * Improving _gdb completion: + - $filenames to $default (Debian: #463969) + - also show directory names (i.e. compgen -d) in COMPREPLY. + - added . to $PATH, to allow debugging "local" executables. + - do not complete Bash's builtins (thanks to Morita Sho) + + [ Luk Claes ] + * Remove use of ucf for /etc/bash-completion (Debian: #488171). + + -- Luk Claes Sat, 05 Jul 2008 16:14:15 +0200 + +bash-completion (20080617.5) unstable; urgency=medium + + * Revert way of setting environment variables (Debian: #487774). + * Add equals sign to _get_cword for mutt_aliases (Debian: #482635). + * Enhance mlayer completion (Debian: #487826, #487838). + + -- Luk Claes Tue, 24 Jun 2008 19:50:57 +0200 + +bash-completion (20080617.4) experimental; urgency=low + + [ David Paleino ] + * Merged Ubuntu changes: + - added quote(), quote_readline(), dequote() helper functions. + - added _remove_word() + - fixed _get_cword() + - refactored _filedir using quote_readline() + - refactored _filedir_xspec using quote_readline() + - fixed COMPREPLY's in _iwconfig + - fixed _cvs() + - _known_hosts(): use files from UserKnownHostsFile options in + addition to standard ones. + - fixed _command() to correctly prune the command line + - disabled completion of PostgreSQL users and databases (Ubuntu: #164772) + - fixed _java_packages() + - fixed _muttquery() + - added flv/FLV completion to mplayer + - added --installed to apt-cache + - only complete on filenames for aspell + - fixed code for exclusions compspecs + - added code to gracefully handle debug options (set +/-v) + + -- Luk Claes Mon, 23 Jun 2008 19:25:25 +0200 + +bash-completion (20080617.3) unstable; urgency=low + + [ David Paleino ] + * Fixed IFS for filedir_xspec - Thanks to Stefan Lippers-Hollmann + (Debian: #487571) + + [ Luk Claes ] + * Install dh-bash-completion to ease installation of completions. + + -- Luk Claes Mon, 23 Jun 2008 07:24:21 +0200 + +bash-completion (20080617.2) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - provide a manpage for extra/dh_bash-completion + - fix semi-serious problem with _filedir() (Debian: #487449) + * debian/rules: + - added rule to generate dh_bash-completion's manpage + * debian/install, debian/dirs: + - installing dh_bash-completion into /usr/bin + * debian/control: + - new package dh-bash-completion + + [ Luk Claes ] + * Comment new package to make sure current fix gets in the archive first. + * Add compression completion for vi(m). + + -- Luk Claes Sun, 22 Jun 2008 19:47:23 +0200 + +bash-completion (20080617.1) unstable; urgency=medium + + [ David Paleino ] + * Urgency set to medium because the package is currently unusable. + * New upstream sub-release + - fixed some typos here and there which prevented bash completions + at all (Debian: #487441). + - really closing Debian bug #455510. + + -- Luk Claes Sun, 22 Jun 2008 00:22:53 +0200 + +bash-completion (20080617) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - add more completions to aptitude (Debian: #432289) + - fixed UTF-8 problem with _get_cword(), thanks to + Andrei Paskevich (Debian: #472132) + - fixed autoremove completion, thanks to Flavio Visentin + (Debian: #474974) + - cmf and CMF added to playmidi completion (Debian: #365658) + - added rrdtool completion, thanks to Justin Pryzby (Debian: #428641) + - added OpenDocument completion for unzip/zipinfo (.od{f,g,p,s,t}) + (Debian: #472940) + - fixed escaping problems with job control (i.e. disown, jobs, bg, + fg): the argument is now surrounded by "" (Debian: #347316) + - make mkdir complete also on filenames (Debian: #376433) + - {bz,z}{cat,cmp,diff,egrep,fgrep,grep,less,more} now should complete + on all filenames, not just compressed archives (just commented out) + (Debian: #455510) + - fixes Perl completion (Debian: #470742) + - fixes get_cword -> _get_cword typo (Debian: #478596) + - fixes _get_cword() function to properly handle filenames with + whitespaces (Debian: #394636, #468254, #474094) + - added .pdf.bz2 completion to evince (Debian: #424736) + - added .svg completion to display (Debian: #441017) + - added .m2ts completion to mplayer (Debian: #480879) + - added extra/dh_bash-completion to ease future rewrite of bc. + * debian/copyright - now in a fancier machine-parsable format. + * debian/control: + - added myself to Uploaders + - debhelper Build-Depends updated to >= 6. + * debian/watch: + - improved current watch line regex + - added (commented out) probable future watch line + * debian/compat bumped to 6 + * debian/dirs, debian/install and debian/links added + * debian/rules: + - refactored to make use of debian/{dirs,install,links} + + [ Steve Kemp ] + * Applied patch to fix completion of umount command. + (Debian: #470539) + * Fixed the completion of Perl manpages. + (Debian: #404976) + * Added 'aif' to the filenames offed for completion for mplayer. + (Debian: #474517) + * Allow tsocks completion. + (Debian: #409423) + * Update mutt completion to handle local usernames. + (Debian: #416655) + * Update apt-get completion to include the flag "--no-install-recommends" + (Debian: #475242) + + -- Luk Claes Sat, 21 Jun 2008 21:59:43 +0200 + +bash-completion (20060301-4) unstable; urgency=low + + * Add some fixes from Ubuntu: + * Fix completion of filenames with spaces (Debian: #468254). + * Fix parsing of SSH config files (Debian: #435117). + * Change priority to standard (Debian: #471666). + * Add some more completions for xine (Debian: #452083, #471249). + * Fix completion of gzip (Debian: #351913). + * Also use $HOSTFILE in hostname completion (Debian: #400380). + + -- Luk Claes Sat, 22 Mar 2008 23:10:30 +0000 + +bash-completion (20060301-3) unstable; urgency=low + + * Fix kpdf completion (Debian: #468163, #413374). + * Fix completion of - or -- with _command (Debian: #415276). + * Add sux to the complete -u list (Debian: #466089). + * Add dvipdfm to the list of dvi programs (Debian: #396644). + * Add --purge-unused option completion for aptitude (Debian: #438471). + * Add divx extension completion for mplayer (Debian: #444294). + * Add pdf.gz completion for evince (Debian: #456887). + * Add --remove-all completion for update-alternatives (Debian: #269173). + + -- Luk Claes Wed, 05 Mar 2008 22:57:27 +0100 + +bash-completion (20060301-2) unstable; urgency=low + + * Take over the package. + + -- Luk Claes Wed, 27 Feb 2008 19:22:03 +0100 + +bash-completion (20060301-1) unstable; urgency=low + + * Upload to unstable. + + -- Matthias Klose Sat, 09 Feb 2008 23:18:20 +0100 + +bash-completion (20060301-0ubuntu2) hardy; urgency=low + + * Replace bash (<< 3.1dfsg-9), handle upgrade in preinst. + * Exclude hashed hostnames from ssh host completion results. Debian: #428085. + * Fix: ifup/down don't really complete. Debian: #463756. + * Allow perl completion to complete filenames, complete -I and -x arguments. + Debian: #443394. + * Add find -wholename completion. Debian: #431220. + * Handle whitespaces in $HOME for _known_hosts() completion. Debian: #414821. + * dpkg -L: complete for removed-but-not-purged packages. Debian: #372156. + * Complete for apt-get autoremove. Debian: #433542, #443816, #445332. + * Update completion for mplayer (mka/flac). Debian: #340452. + * Add ping6/fping6 completion. Debian: #413170. + * Handle whitespace in paths for mount/umount completion. Debian: #367957. + * apt-get: Support --auto-remove. Ubuntu: #60666. + + -- Matthias Klose Sat, 09 Feb 2008 23:11:32 +0100 + +bash-completion (20060301-0ubuntu1) hardy; urgency=low + + * Initial release, split out from the bash package. + The software currently is unsupported upstream. + * Don't try to set a readonly variable. Ubuntu: #149527. + * Support purge in apt-get auto completion (Mathias Gug). Ubuntu: #151677. + * evince: Autocomplete on cbr/cbz/djvu files. Ubuntu: #156200, #175220. + Debian: #400678. + * kdvi: complete .*\.dvi\.(gz|bz2). Ubuntu: #128234. + * kpdf: Complete postscript files. Ubuntu: #162319. + * Make completion working in the middle of a word (Adam Simpkins). + Ubuntu: #139666. + + -- Matthias Klose Fri, 08 Feb 2008 16:46:34 +0100 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4128736 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,147 @@ +# Contributing to bash-completion + +Contributions to the bash completion project are more than +welcome. Fixes, clean-ups and improvements of existing code are much +appreciated, as are completion functions for new commands. + +If you wish to contribute code, please bare the following coding +guidelines in mind: + +- Do not use Perl, Ruby, Python etc. to do text processing unless the + command for which you are writing the completion code implies the + presence of one of those languages. + + For example, if you were writing completion code for perldoc(1), the + use of Perl to achieve your goal would be acceptable. irb(1) + completion would similarly make the use of Ruby acceptable. + + Even so, please consider alternatives to these large and slow to + start interpreters. Use lightweight programs such as grep(1), awk(1) + and sed(1). + +- Use the full power of bash >= 4.1. We no longer support earlier bash + versions, so you may as well use all the features of that version of + bash to optimise your code. However, be careful when using features + added since bash 4.1, since not everyone will be able to use them. + + For example, extended globs often enable you to avoid the use of + external programs, which are expensive to fork and execute, so do + make full use of those: + + `?(pattern-list)` - match zero or one occurrences of patterns + `*(pattern-list)` - match zero or more occurrences of patterns + `+(pattern-list)` - match one or more occurrences of patterns + `@(pattern-list)` - match exactly one of the given patterns + `!(pattern-list)` - match anything except one of the given patterns + +- Following on from the last point, be sparing with the use of + external processes whenever you can. Completion functions need to be + fast, so sacrificing some code legibility for speed is acceptable. + + For example, judicious use of sed(1) can save you from having to + call grep(1) and pipe the output to cut(1), which saves a fork(2) + and exec(3). + + Sometimes you don't even need sed(1) or other external programs at + all, though. Use of constructs such as `${parameter#word}`, + `${parameter%word}` and `${parameter/pattern/string}` can provide + you a lot of power without having to leave the shell. + + For example, if `$foo` contains the path to an executable, + `${foo##*/}` will give you the basename of the program, without + having to call basename(1). Similarly, `${foo%/*}` will give you the + dirname, without having to call dirname(1). + + As another example, + + ```shell + bar=$( echo $foo | sed -e 's/bar/baz/g' ) + ``` + + can be replaced by: + + ```shell + bar=${foo//bar/baz} + ``` + + These forms of parameter substitutions can also be used on arrays, + which makes them very powerful (if a little slow). + +- Prefer `compgen -W '...' -- $cur` over embedding `$cur` in external + command arguments (often e.g. sed, grep etc) unless there's a good + reason to embed it. Embedding user input in command lines can result + in syntax errors and other undesired behavior, or messy quoting + requirements when the input contains unusual characters. Good + reasons for embedding include functionality (if the thing does not + sanely work otherwise) or performance (if it makes a big difference + in speed), but all embedding cases should be documented with + rationale in comments in the code. + +- When completing available options, offer only the most descriptive + ones as completion results if there are multiple options that do the + same thing. Usually this means that long options should be preferred + over the corresponding short ones. This way the user is more likely + to find what she's looking for and there's not too much noise to + choose from, and there are less situations where user choice would + be needed in the first place. Note that this concerns only display + of available completions; argument processing/completion for options + that take an argument should be made to work with all known variants + for the functionality at hand. For example if `-s`, `-S`, and + `--something` do the same thing and require an argument, offer only + `--something` as a completion when completing option names starting + with a dash, but do implement required argument processing for all + `-s`, `-S`, and `--something`. Note that GNU versions of various + standard commands tend to have long options while other userland + implementations of the same commands may not have them, and it would + be good to have the completions work for as many userlands as + possible so things aren't always that simple. + +- Do not write to the file-system under any circumstances. This can + create race conditions, is inefficient, violates the principle of + least surprise and lacks robustness. + +- Use printf(1) instead of echo(1) for portability reasons, and be + sure to invoke commands that are often found aliased (such as `ls` + or `grep` etc) using the `command` (or `builtin`) command as + appropriate. + +- Make small, incremental commits that do one thing. Don't cram + unrelated changes into a single commit. + +- If your code was written for a particular platform, try to make it + portable to other platforms, so that everyone may enjoy it. If your + code works only with the version of a binary on a particular + platform, ensure that it will not be loaded on other platforms that + have a command with the same name. + + In particular, do not use GNU extensions to commands like sed and + awk if you can write your code another way. If you really, REALLY must + use them, do so if there's no other sane way to do what you're doing. + The "Shell and Utilities" volume of the POSIX specification is a good + starting reference for portable use of various utilities, see + http://pubs.opengroup.org/onlinepubs/9699919799/ + +- Use an editor that supports EditorConfig, see http://editorconfig.org/, + and format source code according to our settings. + +- Read the existing source code for examples of how to solve + particular problems. Read the bash man page for details of all the + programming tools available to you within the shell. + +- Please test your code thoroughly before sending it to us. We don't + have access to all the commands for which we are sent completion + functions, so we are unable to test them all personally. If your + code is accepted into the distribution, a lot of people will try it + out, so try to do a thorough job of eradicating all the bugs before + you send it to us. If at all practical, **add test cases** to our + test suite (in the test/ dir) that verify that the code does what it + is intended to do, fixes issues it intends to fix, etc. + +- File bugs, enhancement, and pull requests at GitHub, + https://github.com/scop/bash-completion + Sending them to the developers might work too, but is really + discouraged as bits are more likely to fall through the cracks that + way compared to the tracker. Just use GitHub. If that's not an + option for some reason and you want to use email to send patches, + send them as attachments formatted by `git format-patch` or directly + with `git send-email`. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1df73ae --- /dev/null +++ b/Makefile.am @@ -0,0 +1,36 @@ +SUBDIRS = completions doc helpers test + +pkgdata_DATA = bash_completion + +# Empty, but here just to get the compat dir created with install +compat_DATA = + +profiledir = $(sysconfdir)/profile.d +profile_DATA = bash_completion.sh + +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = bash-completion.pc + +cmakeconfigdir = $(datadir)/cmake/$(PACKAGE)/ +cmakeconfig_DATA = bash-completion-config.cmake \ + bash-completion-config-version.cmake + +bash_completion.sh: bash_completion.sh.in Makefile + sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@ + +CLEANFILES = bash_completion.sh bash-completion.pc + +EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ + .editorconfig README.md CONTRIBUTING.md + +install-data-hook: + tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ + sed -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ + $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ + cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ + sed -e 's|\$${prefix}|$(prefix)|' \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \ + > $$tmpfile && \ + cat $$tmpfile > \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \ + rm $$tmpfile diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..30016a8 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,925 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = bash-completion.pc bash-completion-config.cmake \ + bash-completion-config-version.cmake +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(cmakeconfigdir)" \ + "$(DESTDIR)$(compatdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)" +DATA = $(cmakeconfig_DATA) $(compat_DATA) $(pkgconfig_DATA) \ + $(pkgdata_DATA) $(profile_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/bash-completion-config-version.cmake.in \ + $(srcdir)/bash-completion-config.cmake.in \ + $(srcdir)/bash-completion.pc.in AUTHORS COPYING install-sh \ + missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.xz +DIST_TARGETS = dist-xz +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +compatdir = @compatdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = completions doc helpers test +pkgdata_DATA = bash_completion + +# Empty, but here just to get the compat dir created with install +compat_DATA = +profiledir = $(sysconfdir)/profile.d +profile_DATA = bash_completion.sh +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = bash-completion.pc +cmakeconfigdir = $(datadir)/cmake/$(PACKAGE)/ +cmakeconfig_DATA = bash-completion-config.cmake \ + bash-completion-config-version.cmake + +CLEANFILES = bash_completion.sh bash-completion.pc +EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ + .editorconfig README.md CONTRIBUTING.md + +all: all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): +bash-completion.pc: $(top_builddir)/config.status $(srcdir)/bash-completion.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +bash-completion-config.cmake: $(top_builddir)/config.status $(srcdir)/bash-completion-config.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +bash-completion-config-version.cmake: $(top_builddir)/config.status $(srcdir)/bash-completion-config-version.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-cmakeconfigDATA: $(cmakeconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(cmakeconfig_DATA)'; test -n "$(cmakeconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cmakeconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cmakeconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(cmakeconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(cmakeconfigdir)" || exit $$?; \ + done + +uninstall-cmakeconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(cmakeconfig_DATA)'; test -n "$(cmakeconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cmakeconfigdir)'; $(am__uninstall_files_from_dir) +install-compatDATA: $(compat_DATA) + @$(NORMAL_INSTALL) + @list='$(compat_DATA)'; test -n "$(compatdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(compatdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(compatdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(compatdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(compatdir)" || exit $$?; \ + done + +uninstall-compatDATA: + @$(NORMAL_UNINSTALL) + @list='$(compat_DATA)'; test -n "$(compatdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(compatdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-pkgdataDATA: $(pkgdata_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ + done + +uninstall-pkgdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) +install-profileDATA: $(profile_DATA) + @$(NORMAL_INSTALL) + @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(profiledir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(profiledir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(profiledir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(profiledir)" || exit $$?; \ + done + +uninstall-profileDATA: + @$(NORMAL_UNINSTALL) + @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(profiledir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(cmakeconfigdir)" "$(DESTDIR)$(compatdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-cmakeconfigDATA install-compatDATA \ + install-pkgconfigDATA install-pkgdataDATA install-profileDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-cmakeconfigDATA uninstall-compatDATA \ + uninstall-pkgconfigDATA uninstall-pkgdataDATA \ + uninstall-profileDATA + +.MAKE: $(am__recursive_targets) install-am install-data-am \ + install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am \ + install-cmakeconfigDATA install-compatDATA install-data \ + install-data-am install-data-hook install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-pkgdataDATA \ + install-profileDATA install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-cmakeconfigDATA uninstall-compatDATA \ + uninstall-pkgconfigDATA uninstall-pkgdataDATA \ + uninstall-profileDATA + +.PRECIOUS: Makefile + + +bash_completion.sh: bash_completion.sh.in Makefile + sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@ + +install-data-hook: + tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ + sed -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ + $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ + cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ + sed -e 's|\$${prefix}|$(prefix)|' \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \ + > $$tmpfile && \ + cat $$tmpfile > \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \ + rm $$tmpfile + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/README.md b/README.md new file mode 100644 index 0000000..71e9aad --- /dev/null +++ b/README.md @@ -0,0 +1,335 @@ +# bash-completion + +[![Build Status](https://travis-ci.org/scop/bash-completion.svg?branch=master)](https://travis-ci.org/scop/bash-completion) + +## Installation + +The easiest way to install this software is to use a package; it is +available in many operating system distributions. The package's name +is usually bash-completion. Depending on the package, you may still +need to source it from either `/etc/bashrc` or `~/.bashrc` (or any +other file sourcing those). You can do this by simply using: + +```shell +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion +``` + +(if you happen to have *only* bash >= 4.1 installed, see further if not) + +If you don't have the package readily available for your distribution, or +you simply don't want to use one, you can install bash completion using the +standard commands for GNU autotools packages: + +```shell +autoreconf -i # if not installing from prepared release tarball +./configure +make +make check # optional, requires dejagnu and tcllib +make install # as root +``` + +These commands install the completions and helpers, as well as a +`profile.d` script that loads `bash_completion` where appropriate. + +If your system does not use the `profile.d` directory (usually below +`/etc`) mechanism—i.e. does not automatically source shell scripts in +it—you can source the `$sysconfdir/profile.d/bash_completion.sh` +script in `/etc/bashrc` or `~/.bashrc`. + +The `profile.d` script provides a configuration file hook that can be +used to prevent loading `bash_completion` on per user basis when it's +installed system wide. To do this: + +1. Turn off programmable completion with `shopt -u progcomp` in + `$XDG_CONFIG_HOME/bash_completion` (or `~/.config/bash_completion` + if `$XDG_CONFIG_HOME` is not set) +2. Turn it back on (for example in `~/.bashrc`) if you want to use + programmable completion for other purposes. + +### macOS (OS X) + +If you're using macOS (formerly OS X), `/etc/bashrc` is apparently not sourced at +all. In that case, you can put the `bash_completion` file in `/sw/etc` +and add the following code to `~/.bash_profile`: + +```shell +if [ -f /sw/etc/bash_completion ]; then + . /sw/etc/bash_completion +fi +``` + + +## Troubleshooting + +If you find that a given function is producing errors or does not work +as it should under certain circumstances when you attempt completion, +try running `set -v` or `set -x` prior to attempting the completion +again. This will produce useful debugging output that will aid us in +fixing the problem if you are unable to do so yourself. Turn off the +trace output by running either `set +v` or `set +x`. + +To debug dynamic loading of a completion, tracing needs to be turned +on before the debugged completion is attempted the first time. The +easiest way to do this is to start a new shell session, and to turn +tracing on in it before doing anything else there. + + +## Known problems + +1. There seems to be some issue with using the bash built-in `cd` within + Makefiles. When invoked as `/bin/sh` within `Makefile`s, bash seems + to have a problem changing directory via the `cd` command. A + work-around for this is to define `SHELL=/bin/bash` within your + `Makefile`. This is believed to be a bug in bash. + +2. Many of the completion functions assume GNU versions of the various + text utilities that they call (e.g. `grep`, `sed`, and `awk`). Your + mileage may vary. + +3. If you are seeing 'unbound variable' warnings from bash when + hitting <Tab>, this is because you have either `set -u` + or `set -o nounset` somewhere in your start-up files. This causes bash + to flag the use of any uninitialised shell variables as an error. + + Whilst we try to avoid references to uninitialised variables in the + code, there seem to be at least some cases where bash issues this + warning even though the variable in question has been initialised. + + One place this appears to occur is within the `_muttconffiles()` + helper function used by `mutt` completion, where the function calls + itself recursively. This seems to confuse bash and it issues + spurious warnings if `nounset` is set. + + +## FAQ + +**Q. The bash completion code inhibits some commands from completing on + files with extensions that are legitimate in my environment. Do I + have to disable completion for that command in order to complete on + the files that I need to?** + +A. No. Use `M-/` to (in the words of the bash man page) attempt file + name completion on the text to the left of the cursor. This will + circumvent any file type restrictions put in place by the bash + completion code. + +**Q. How can I insert my own local completions without having to + reinsert them every time you issue a new release?** + +A. Put them in `~/.bash_completion`, which is parsed at the end of the + main completion script. See also the next question. + +**Q. I author/maintain package X and would like to maintain my own + completion code for this package. Where should I put it to be sure + that interactive bash shells will find it and source it?** + +A. Install it in one of the directories pointed to by + bash-completion's `pkgconfig` file variables. There are two + alternatives: + + - The recommended directory is `completionsdir`, which you can get with + `pkg-config --variable=completionsdir bash-completion`. From this + directory, completions are loaded on-demand based on invoked commands' names, + so be sure to name your completion file accordingly, and to include + (for example) symbolic links in case the file provides completions + for more than one command. + - The other directory (which only present for backwards compatibility) + is `compatdir` (get it with + `pkg-config --variable=compatdir bash-completion`) from which files + are loaded when `bash_completion` is loaded. + + For packages using GNU autotools the installation can be handled + for example like this in `configure.ac`: + + ``` + PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , + bashcompdir="${sysconfdir}/bash_completion.d") + AC_SUBST(bashcompdir) + ``` + + ...accompanied by this in `Makefile.am`: + + ```makefile + bashcompdir = @bashcompdir@ + dist_bashcomp_DATA = # completion files go here + ``` + + For cmake we ship the `bash-completion-config.cmake` and + `bash-completion-config-version.cmake` files. Example usage: + + ``` + find_package(bash-completion) + if(BASH_COMPLETION_FOUND) + message(STATUS + "Using bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + else() + set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d") + message (STATUS + "Using fallback bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + endif() + + install(FILES your-completion-file DESTINATION + ${BASH_COMPLETION_COMPLETIONSDIR}) + ``` + +**Q. I use CVS in combination with passwordless SSH access to my remote + repository. How can I have the `cvs` command complete on remotely + checked-out files where relevant?** + +A. Define `$COMP_CVS_REMOTE`. Setting this to anything will result in + the behaviour you would like. + +**Q. When I'm running a `./configure` script and completion returns a list + of long options to me, some of these take a parameter, + e.g. `--this-option=DESCRIPTION`.** + + **Running `./configure --help` lists these descriptions, but + everything after the `=` is stripped when returning completions, so + I don't know what kind of data is expected as a given option's + parameter.** + + **Is there a way of getting `./configure` completion to return the + entire option string, so that I can see what kind of data is + required and then simply delete the descriptive text and add my own + data?** + +A. Define `$COMP_CONFIGURE_HINTS`. Setting this to anything will + result in the behaviour you would like. + +**Q. When doing tar completion on a file within a tar file like this:** + + ``` + tar tzvf foo.tar.gz + ``` + + **the pathnames contained in the tar file are not displayed + correctly. The slashes are removed, and everything looks like it's + in a single directory. Why is this?** + +A. It's a choice we had to make. bash's programmable completion is + limited in how it handles the list of possible completions it + returns. + + Because the paths returned from within the tar file are likely not + existing paths on the file system, `-o dirnames` must be passed to + the `complete` built-in to make it treat them as such. However, + then bash will append a space when completing on directories during + pathname completion to the tar files themselves. + + It's more important to have proper completion of paths to tar files + than it is to have completion for their contents, so this sacrifice + was made and `-o filenames` is used with complete instead. + + If you would rather have correct path completion for tar file + contents, define `$COMP_TAR_INTERNAL_PATHS` *before* sourcing + `bash_completion`. + +**Q. When completing on a symlink to a directory, bash does not append + the trailing `/` and I have to hit <Tab> again. + I don't like this.** + +A. This has nothing to do with `bash_completion`. It's the default for + completing symlinks to directories since bash 2.05a, and was added + because sometimes you want to operate on the symlink itself, rather + than what it points to. + + You can get the pre-2.05a behaviour back by putting `set + mark-symlinked-directories on` in your `/etc/inputrc` or + `~/.inputrc` file. + +**Q. Completion goes awry when I try to complete on something that contains + a colon.** + +A. This is actually a 'feature' of bash. bash recognises a colon as + starting a new completion token, which is often what you want when + completing something like a `PATH` variable: + + ```shell + export PATH=/bin:/sbin:/usr + ``` + + Without the special treatment of the colon, the above wouldn't work + without programmable completion, so it has long been a feature of + the shell. + + Unfortunately, you don't want the colon to be treated as a special + case when doing something like: + + ```shell + man File::B + ``` + + Here, the colons make bash think that it's completing a new token + that begins with 'B'. + + Unfortunately, there's no way to turn this off. The only thing you + can do is escape the colons with a backslash. + +**Q. Why is `rpm` completion so slow with `-q`?** + +A. Probably because the database is being queried every time and this uses a + lot of memory. + + You can make this faster by pregenerating the list of installed + packages on the system. Make sure you have a readable file called + `/var/log/rpmpkgs`. It's generated by `/etc/cron.daily/rpm` on + some Red Hat and Mandrake and derivative Linux systems. + + If you don't have such a cron job, make one: + + ```shell + #!/bin/sh + + rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ + | sort > /var/log/rpmpkgs + ``` + + rpm completion will use this flat text file instead of the RPM database, + unless it detects that the database has changed since the file was created, + in which case it will still use the database to ensure accuracy. + +**Q. bash-completion interferes with my `command_not_found_handler` function!** + +A. If your `command_not_found_handler` function is not intended to + address (possibly missing) commands invoked during bash + programmable completion functions, you can account for this + by, for example, testing if the `$COMP_`\* variables are set and + taking appropriate bypass or other action. + +**Q. Can tab completion be made even easier?** + +A. The `readline(3)` library offers a few settings that can make tab + completion easier (or at least different) to use. + + For example, try putting the following in either `/etc/inputrc` or + `~/.inputrc`: + + ``` + set show-all-if-ambiguous on + ``` + + This will allow single tab completion as opposed to requiring a + double tab. This makes things much more pleasant, in our opinion. + + ``` + set visible-stats on + ``` + + This will suffix each returned file completion with a character + denoting its type, in a similar way to `ls(1)` with `-F` or `--classify`. + + ``` + set page-completions off + ``` + + This turns off the use of the internal pager when returning long + completion lists. + +**Q. Is bash the be-all-and-end-all of completion as far as shells go?** + +A. Absolutely not. zsh has an extremely sophisticated completion system + that offers many features absent from the bash implementation. Its + users often cannot resist pointing this out. More information can + be found at: http://www.zsh.org/ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..433d545 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,740 @@ +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.15' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.15], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/bash-completion-config-version.cmake.in b/bash-completion-config-version.cmake.in new file mode 100644 index 0000000..265e075 --- /dev/null +++ b/bash-completion-config-version.cmake.in @@ -0,0 +1,7 @@ +set (PACKAGE_VERSION "@VERSION@") +if (NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_COMPATIBLE 1) + if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_EXACT 1) + endif () +endif () diff --git a/bash-completion-config.cmake.in b/bash-completion-config.cmake.in new file mode 100644 index 0000000..ccc6e05 --- /dev/null +++ b/bash-completion-config.cmake.in @@ -0,0 +1,11 @@ +# config file for bash-completion +# https://github.com/scop/bash-completion + +set (BASH_COMPLETION_VERSION "@VERSION@") + +set (BASH_COMPLETION_PREFIX "@prefix@") +set (BASH_COMPLETION_COMPATDIR "@compatdir@") +set (BASH_COMPLETION_COMPLETIONSDIR "@datarootdir@/@PACKAGE@/completions") +set (BASH_COMPLETION_HELPERSDIR "@datarootdir@/@PACKAGE@/helpers") + +set (BASH_COMPLETION_FOUND "TRUE") diff --git a/bash-completion.pc.in b/bash-completion.pc.in new file mode 100644 index 0000000..bde217d --- /dev/null +++ b/bash-completion.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +compatdir=@compatdir@ +completionsdir=@datarootdir@/@PACKAGE@/completions +helpersdir=@datarootdir@/@PACKAGE@/helpers + +Name: bash-completion +Description: programmable completion for the bash shell +URL: https://github.com/scop/bash-completion +Version: @VERSION@ diff --git a/bash_completion b/bash_completion new file mode 100644 index 0000000..d16b10a --- /dev/null +++ b/bash_completion @@ -0,0 +1,2092 @@ +# -*- shell-script -*- +# +# bash_completion - programmable completion functions for bash 4.1+ +# +# Copyright © 2006-2008, Ian Macdonald +# © 2009-2017, Bash Completion Maintainers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# The latest version of this software can be obtained here: +# +# https://github.com/scop/bash-completion + +BASH_COMPLETION_VERSINFO=(2 7) + +if [[ $- == *v* ]]; then + BASH_COMPLETION_ORIGINAL_V_VALUE="-v" +else + BASH_COMPLETION_ORIGINAL_V_VALUE="+v" +fi + +if [[ ${BASH_COMPLETION_DEBUG-} ]]; then + set -v +else + set +v +fi + +# Blacklisted completions, causing problems with our code. +# +_blacklist_glob='@(acroread.sh)' + +# Turn on extended globbing and programmable completion +shopt -s extglob progcomp + +# A lot of the following one-liners were taken directly from the +# completion examples provided with the bash 2.04 source distribution + +# start of section containing compspecs that can be handled within bash + +# user commands see only users +complete -u groups slay w sux + +# bg completes with stopped jobs +complete -A stopped -P '"%' -S '"' bg + +# other job commands +complete -j -P '"%' -S '"' fg jobs disown + +# readonly and unset complete with shell variables +complete -v readonly unset + +# set completes with set options +complete -A setopt set + +# shopt completes with shopt options +complete -A shopt shopt + +# helptopics +complete -A helptopic help + +# unalias completes with aliases +complete -a unalias + +# type and which complete on commands +complete -c command type which + +# builtin completes on builtins +complete -b builtin + +# start of section containing completion functions called by other functions + +# Check if we're running on the given userland +# @param $1 userland to check for +_userland() +{ + local userland=$( uname -s ) + [[ $userland == @(Linux|GNU/*) ]] && userland=GNU + [[ $userland == $1 ]] +} + +# This function sets correct SysV init directories +# +_sysvdirs() +{ + sysvdirs=( ) + [[ -d /etc/rc.d/init.d ]] && sysvdirs+=( /etc/rc.d/init.d ) + [[ -d /etc/init.d ]] && sysvdirs+=( /etc/init.d ) + # Slackware uses /etc/rc.d + [[ -f /etc/slackware-version ]] && sysvdirs=( /etc/rc.d ) +} + +# This function checks whether we have a given program on the system. +# +_have() +{ + # Completions for system administrator commands are installed as well in + # case completion is attempted via `sudo command ...'. + PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null +} + +# Backwards compatibility for compat completions that use have(). +# @deprecated should no longer be used; generally not needed with dynamically +# loaded completions, and _have is suitable for runtime use. +have() +{ + unset -v have + _have $1 && have=yes +} + +# This function checks whether a given readline variable +# is `on'. +# +_rl_enabled() +{ + [[ "$( bind -v )" == *$1+([[:space:]])on* ]] +} + +# This function shell-quotes the argument +quote() +{ + local quoted=${1//\'/\'\\\'\'} + printf "'%s'" "$quoted" +} + +# @see _quote_readline_by_ref() +quote_readline() +{ + local quoted + _quote_readline_by_ref "$1" ret + printf %s "$ret" +} # quote_readline() + + +# This function shell-dequotes the argument +dequote() +{ + eval printf %s "$1" 2> /dev/null +} + + +# Assign variable one scope above the caller +# Usage: local "$1" && _upvar $1 "value(s)" +# Param: $1 Variable name to assign value to +# Param: $* Value(s) to assign. If multiple values, an array is +# assigned, otherwise a single value is assigned. +# NOTE: For assigning multiple variables, use '_upvars'. Do NOT +# use multiple '_upvar' calls, since one '_upvar' call might +# reassign a variable to be used by another '_upvar' call. +# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference +_upvar() +{ + if unset -v "$1"; then # Unset & validate varname + if (( $# == 2 )); then + eval $1=\"\$2\" # Return single value + else + eval $1=\(\"\${@:2}\"\) # Return array + fi + fi +} + + +# Assign variables one scope above the caller +# Usage: local varname [varname ...] && +# _upvars [-v varname value] | [-aN varname [value ...]] ... +# Available OPTIONS: +# -aN Assign next N values to varname as array +# -v Assign single value to varname +# Return: 1 if error occurs +# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference +_upvars() +{ + if ! (( $# )); then + echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\ + "value] | [-aN varname [value ...]] ..." 1>&2 + return 2 + fi + while (( $# )); do + case $1 in + -a*) + # Error checking + [[ ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing"\ + "number specifier" 1>&2; return 1; } + printf %d "${1#-a}" &> /dev/null || { echo "bash:"\ + "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2 + return 1; } + # Assign array of -aN elements + [[ "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && + shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:"\ + "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1; } + ;; + -v) + # Assign single value + [[ "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && + shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing"\ + "argument(s)" 1>&2; return 1; } + ;; + *) + echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2 + return 1 ;; + esac + done +} + + +# Reassemble command line words, excluding specified characters from the +# list of word completion separators (COMP_WORDBREAKS). +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 here. +# @param $2 words Name of variable to return words to +# @param $3 cword Name of variable to return cword to +# +__reassemble_comp_words_by_ref() +{ + local exclude i j line ref + # Exclude word separator characters? + if [[ $1 ]]; then + # Yes, exclude word separator characters; + # Exclude only those characters, which were really included + exclude="${1//[^$COMP_WORDBREAKS]}" + fi + + # Default to cword unchanged + printf -v "$3" %s "$COMP_CWORD" + # Are characters excluded which were former included? + if [[ $exclude ]]; then + # Yes, list of word completion separators has shrunk; + line=$COMP_LINE + # Re-assemble words to complete + for (( i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Is current word not word 0 (the command itself) and is word not + # empty and is word made up of just word separator characters to + # be excluded and is current word not preceded by whitespace in + # original line? + while [[ $i -gt 0 && ${COMP_WORDS[$i]} == +([$exclude]) ]]; do + # Is word separator not preceded by whitespace in original line + # and are we not going to append to word 0 (the command + # itself), then append to current word. + [[ $line != [[:blank:]]* ]] && (( j >= 2 )) && ((j--)) + # Append word separator to current or new word + ref="$2[$j]" + printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}" + # Indicate new cword + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" + # Remove optional whitespace + word separator from line copy + line=${line#*"${COMP_WORDS[$i]}"} + # Start new word if word separator in original line is + # followed by whitespace. + [[ $line == [[:blank:]]* ]] && ((j++)) + # Indicate next word if available, else end *both* while and + # for loop + (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2 + done + # Append word to current word + ref="$2[$j]" + printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}" + # Remove optional whitespace + word from line copy + line=${line#*"${COMP_WORDS[i]}"} + # Indicate new cword + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" + done + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" + else + # No, list of word completions separators hasn't changed; + for i in ${!COMP_WORDS[@]}; do + printf -v "$2[i]" %s "${COMP_WORDS[i]}" + done + fi +} # __reassemble_comp_words_by_ref() + + +# @param $1 exclude Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 in this case. +# @param $2 words Name of variable to return words to +# @param $3 cword Name of variable to return cword to +# @param $4 cur Name of variable to return current word to complete to +# @see __reassemble_comp_words_by_ref() +__get_cword_at_cursor_by_ref() +{ + local cword words=() + __reassemble_comp_words_by_ref "$1" words cword + + local i cur index=$COMP_POINT lead=${COMP_LINE:0:$COMP_POINT} + # Cursor not at position 0 and not leaded by just space(s)? + if [[ $index -gt 0 && ( $lead && ${lead//[[:space:]]} ) ]]; then + cur=$COMP_LINE + for (( i = 0; i <= cword; ++i )); do + while [[ + # Current word fits in $cur? + ${#cur} -ge ${#words[i]} && + # $cur doesn't match cword? + "${cur:0:${#words[i]}}" != "${words[i]}" + ]]; do + # Strip first character + cur="${cur:1}" + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) + done + + # Does found word match cword? + if [[ $i -lt $cword ]]; then + # No, cword lies further; + local old_size=${#cur} + cur="${cur#"${words[i]}"}" + local new_size=${#cur} + index=$(( index - old_size + new_size )) + fi + done + # Clear $cur if just space(s) + [[ $cur && ! ${cur//[[:space:]]} ]] && cur= + # Zero $index if negative + [[ $index -lt 0 ]] && index=0 + fi + + local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 "${words[@]}" \ + -v $3 "$cword" -v $4 "${cur:0:$index}" +} + + +# Get the word to complete and optional previous words. +# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases +# where the user is completing in the middle of a word. +# (For example, if the line is "ls foobar", +# and the cursor is here --------> ^ +# Also one is able to cross over possible wordbreak characters. +# Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES] +# Available VARNAMES: +# cur Return cur via $cur +# prev Return prev via $prev +# words Return words via $words +# cword Return cword via $cword +# +# Available OPTIONS: +# -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp +# where we want to return host:path and not only path, so we +# would pass the colon (:) as -n option in this case. +# -c VARNAME Return cur via $VARNAME +# -p VARNAME Return prev via $VARNAME +# -w VARNAME Return words via $VARNAME +# -i VARNAME Return cword via $VARNAME +# +# Example usage: +# +# $ _get_comp_words_by_ref -n : cur prev +# +_get_comp_words_by_ref() +{ + local exclude flag i OPTIND=1 + local cur cword words=() + local upargs=() upvars=() vcur vcword vprev vwords + + while getopts "c:i:n:p:w:" flag "$@"; do + case $flag in + c) vcur=$OPTARG ;; + i) vcword=$OPTARG ;; + n) exclude=$OPTARG ;; + p) vprev=$OPTARG ;; + w) vwords=$OPTARG ;; + esac + done + while [[ $# -ge $OPTIND ]]; do + case ${!OPTIND} in + cur) vcur=cur ;; + prev) vprev=prev ;; + cword) vcword=cword ;; + words) vwords=words ;; + *) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" \ + 1>&2; return 1 + esac + let "OPTIND += 1" + done + + __get_cword_at_cursor_by_ref "$exclude" words cword cur + + [[ $vcur ]] && { upvars+=("$vcur" ); upargs+=(-v $vcur "$cur" ); } + [[ $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword"); } + [[ $vprev && $cword -ge 1 ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev + "${words[cword - 1]}"); } + [[ $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords + "${words[@]}"); } + + (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}" +} + + +# Get the word to complete. +# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases +# where the user is completing in the middle of a word. +# (For example, if the line is "ls foobar", +# and the cursor is here --------> ^ +# @param $1 string Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 in this case. +# @param $2 integer Index number of word to return, negatively offset to the +# current word (default is 0, previous is 1), respecting the exclusions +# given at $1. For example, `_get_cword "=:" 1' returns the word left of +# the current word, respecting the exclusions "=:". +# @deprecated Use `_get_comp_words_by_ref cur' instead +# @see _get_comp_words_by_ref() +_get_cword() +{ + local LC_CTYPE=C + local cword words + __reassemble_comp_words_by_ref "$1" words cword + + # return previous word offset by $2 + if [[ ${2//[^0-9]/} ]]; then + printf "%s" "${words[cword-$2]}" + elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then + printf "%s" "${words[cword]}" + else + local i + local cur="$COMP_LINE" + local index="$COMP_POINT" + for (( i = 0; i <= cword; ++i )); do + while [[ + # Current word fits in $cur? + "${#cur}" -ge ${#words[i]} && + # $cur doesn't match cword? + "${cur:0:${#words[i]}}" != "${words[i]}" + ]]; do + # Strip first character + cur="${cur:1}" + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) + done + + # Does found word matches cword? + if [[ "$i" -lt "$cword" ]]; then + # No, cword lies further; + local old_size="${#cur}" + cur="${cur#${words[i]}}" + local new_size="${#cur}" + index=$(( index - old_size + new_size )) + fi + done + + if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then + # We messed up! At least return the whole word so things + # keep working + printf "%s" "${words[cword]}" + else + printf "%s" "${cur:0:$index}" + fi + fi +} # _get_cword() + + +# Get word previous to the current word. +# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4 +# will properly return the previous word with respect to any given exclusions to +# COMP_WORDBREAKS. +# @deprecated Use `_get_comp_words_by_ref cur prev' instead +# @see _get_comp_words_by_ref() +# +_get_pword() +{ + if [[ $COMP_CWORD -ge 1 ]]; then + _get_cword "${@:-}" 1 + fi +} + + +# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with +# word-to-complete. +# With a colon in COMP_WORDBREAKS, words containing +# colons are always completed as entire words if the word to complete contains +# a colon. This function fixes this, by removing the colon-containing-prefix +# from COMPREPLY items. +# The preferred solution is to remove the colon (:) from COMP_WORDBREAKS in +# your .bashrc: +# +# # Remove colon (:) from list of word completion separators +# COMP_WORDBREAKS=${COMP_WORDBREAKS//:} +# +# See also: Bash FAQ - E13) Why does filename completion misbehave if a colon +# appears in the filename? - http://tiswww.case.edu/php/chet/bash/FAQ +# @param $1 current word to complete (cur) +# @modifies global array $COMPREPLY +# +__ltrim_colon_completions() +{ + if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then + # Remove colon-word prefix from COMPREPLY items + local colon_word=${1%"${1##*:}"} + local i=${#COMPREPLY[*]} + while [[ $((--i)) -ge 0 ]]; do + COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} + done + fi +} # __ltrim_colon_completions() + + +# This function quotes the argument in a way so that readline dequoting +# results in the original argument. This is necessary for at least +# `compgen' which requires its arguments quoted/escaped: +# +# $ ls "a'b/" +# c +# $ compgen -f "a'b/" # Wrong, doesn't return output +# $ compgen -f "a\'b/" # Good +# a\'b/c +# +# See also: +# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html +# - http://www.mail-archive.com/bash-completion-devel@lists.alioth.\ +# debian.org/msg01944.html +# @param $1 Argument to quote +# @param $2 Name of variable to return result to +_quote_readline_by_ref() +{ + if [[ $1 == \'* ]]; then + # Leave out first character + printf -v $2 %s "${1:1}" + else + printf -v $2 %q "$1" + fi + + # If result becomes quoted like this: $'string', re-evaluate in order to + # drop the additional quoting. See also: http://www.mail-archive.com/ + # bash-completion-devel@lists.alioth.debian.org/msg01942.html + [[ ${!2} == \$* ]] && eval $2=${!2} +} # _quote_readline_by_ref() + + +# This function performs file and directory completion. It's better than +# simply using 'compgen -f', because it honours spaces in filenames. +# @param $1 If `-d', complete only on directories. Otherwise filter/pick only +# completions with `.$1' and the uppercase version of it as file +# extension. +# +_filedir() +{ + local IFS=$'\n' + + _tilde "$cur" || return + + local -a toks + local x tmp + + x=$( compgen -d -- "$cur" ) && + while read -r tmp; do + toks+=( "$tmp" ) + done <<< "$x" + + if [[ "$1" != -d ]]; then + local quoted + _quote_readline_by_ref "$cur" quoted + + # Munge xspec to contain uppercase version too + # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 + local xspec=${1:+"!*.@($1|${1^^})"} + x=$( compgen -f -X "$xspec" -- $quoted ) && + while read -r tmp; do + toks+=( "$tmp" ) + done <<< "$x" + + # Try without filter if it failed to produce anything and configured to + [[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && \ + x=$( compgen -f -- $quoted ) && + while read -r tmp; do + toks+=( "$tmp" ) + done <<< "$x" + fi + + if [[ ${#toks[@]} -ne 0 ]]; then + # 2>/dev/null for direct invocation, e.g. in the _filedir unit test + compopt -o filenames 2>/dev/null + COMPREPLY+=( "${toks[@]}" ) + fi +} # _filedir() + + +# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it +# easier to support both "--foo bar" and "--foo=bar" style completions. +# `=' should have been removed from COMP_WORDBREAKS when setting $cur for +# this to be useful. +# Returns 0 if current option was split, 1 otherwise. +# +_split_longopt() +{ + if [[ "$cur" == --?*=* ]]; then + # Cut also backslash before '=' in case it ended up there + # for some reason. + prev="${cur%%?(\\)=*}" + cur="${cur#*=}" + return 0 + fi + + return 1 +} + +# Complete variables. +# @return True (0) if variables were completed, +# False (> 0) if not. +_variables() +{ + if [[ $cur =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]; then + # Completing $var / ${var / ${!var / ${#var + if [[ $cur == \${* ]]; then + local arrs vars + vars=( $( compgen -A variable -P ${BASH_REMATCH[1]} -S '}' -- ${BASH_REMATCH[3]} ) ) && \ + arrs=( $( compgen -A arrayvar -P ${BASH_REMATCH[1]} -S '[' -- ${BASH_REMATCH[3]} ) ) + if [[ ${#vars[@]} -eq 1 && $arrs ]]; then + # Complete ${arr with ${array[ if there is only one match, and that match is an array variable + compopt -o nospace + COMPREPLY+=( ${arrs[*]} ) + else + # Complete ${var with ${variable} + COMPREPLY+=( ${vars[*]} ) + fi + else + # Complete $var with $variable + COMPREPLY+=( $( compgen -A variable -P '$' -- "${BASH_REMATCH[3]}" ) ) + fi + return 0 + elif [[ $cur =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]; then + # Complete ${array[i with ${array[idx]} + local IFS=$'\n' + COMPREPLY+=( $( compgen -W '$(printf %s\\n "${!'${BASH_REMATCH[2]}'[@]}")' \ + -P "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[" -S ']}' -- "${BASH_REMATCH[3]}" ) ) + # Complete ${arr[@ and ${arr[* + if [[ ${BASH_REMATCH[3]} == [@*] ]]; then + COMPREPLY+=( "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[${BASH_REMATCH[3]}]}" ) + fi + __ltrim_colon_completions "$cur" # array indexes may have colons + return 0 + elif [[ $cur =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*\]$ ]]; then + # Complete ${array[idx] with ${array[idx]} + COMPREPLY+=( "$cur}" ) + __ltrim_colon_completions "$cur" + return 0 + else + case $prev in + TZ) + cur=/usr/share/zoneinfo/$cur + _filedir + for i in ${!COMPREPLY[@]}; do + if [[ ${COMPREPLY[i]} == *.tab ]]; then + unset 'COMPREPLY[i]' + continue + elif [[ -d ${COMPREPLY[i]} ]]; then + COMPREPLY[i]+=/ + compopt -o nospace + fi + COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/} + done + return 0 + ;; + esac + fi + return 1 +} + +# Initialize completion and deal with various general things: do file +# and variable completion where appropriate, and adjust prev, words, +# and cword as if no redirections exist so that completions do not +# need to deal with them. Before calling this function, make sure +# cur, prev, words, and cword are local, ditto split if you use -s. +# +# Options: +# -n EXCLUDE Passed to _get_comp_words_by_ref -n with redirection chars +# -e XSPEC Passed to _filedir as first arg for stderr redirections +# -o XSPEC Passed to _filedir as first arg for other output redirections +# -i XSPEC Passed to _filedir as first arg for stdin redirections +# -s Split long options with _split_longopt, implies -n = +# @return True (0) if completion needs further processing, +# False (> 0) no further processing is necessary. +# +_init_completion() +{ + local exclude= flag outx errx inx OPTIND=1 + + while getopts "n:e:o:i:s" flag "$@"; do + case $flag in + n) exclude+=$OPTARG ;; + e) errx=$OPTARG ;; + o) outx=$OPTARG ;; + i) inx=$OPTARG ;; + s) split=false ; exclude+== ;; + esac + done + + # For some reason completion functions are not invoked at all by + # bash (at least as of 4.1.7) after the command line contains an + # ampersand so we don't get a chance to deal with redirections + # containing them, but if we did, hopefully the below would also + # do the right thing with them... + + COMPREPLY=() + local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)" + _get_comp_words_by_ref -n "$exclude<>&" cur prev words cword + + # Complete variable names. + _variables && return 1 + + # Complete on files if current is a redirect possibly followed by a + # filename, e.g. ">foo", or previous is a "bare" redirect, e.g. ">". + if [[ $cur == $redir* || $prev == $redir ]]; then + local xspec + case $cur in + 2'>'*) xspec=$errx ;; + *'>'*) xspec=$outx ;; + *'<'*) xspec=$inx ;; + *) + case $prev in + 2'>'*) xspec=$errx ;; + *'>'*) xspec=$outx ;; + *'<'*) xspec=$inx ;; + esac + ;; + esac + cur="${cur##$redir}" + _filedir $xspec + return 1 + fi + + # Remove all redirections so completions don't have to deal with them. + local i skip + for (( i=1; i < ${#words[@]}; )); do + if [[ ${words[i]} == $redir* ]]; then + # If "bare" redirect, remove also the next word (skip=2). + [[ ${words[i]} == $redir ]] && skip=2 || skip=1 + words=( "${words[@]:0:i}" "${words[@]:i+skip}" ) + [[ $i -le $cword ]] && cword=$(( cword - skip )) + else + i=$(( ++i )) + fi + done + + [[ $cword -le 0 ]] && return 1 + prev=${words[cword-1]} + + [[ ${split-} ]] && _split_longopt && split=true + + return 0 +} + +# Helper function for _parse_help and _parse_usage. +__parse_options() +{ + local option option2 i IFS=$' \t\n,/|' + + # Take first found long option, or first one (short) if not found. + option= + local -a array + read -a array <<<"$1" + for i in "${array[@]}"; do + case "$i" in + ---*) break ;; + --?*) option=$i ; break ;; + -?*) [[ $option ]] || option=$i ;; + *) break ;; + esac + done + [[ $option ]] || return + + IFS=$' \t\n' # affects parsing of the regexps below... + + # Expand --[no]foo to --foo and --nofoo etc + if [[ $option =~ (\[((no|dont)-?)\]). ]]; then + option2=${option/"${BASH_REMATCH[1]}"/} + option2=${option2%%[<{().[]*} + printf '%s\n' "${option2/=*/=}" + option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"} + fi + + option=${option%%[<{().[]*} + printf '%s\n' "${option/=*/=}" +} + +# Parse GNU style help output of the given command. +# @param $1 command; if "-", read from stdin and ignore rest of args +# @param $2 command options (default: --help) +# +_parse_help() +{ + eval local cmd=$( quote "$1" ) + local line + { case $cmd in + -) cat ;; + *) LC_ALL=C "$( dequote "$cmd" )" ${2:---help} 2>&1 ;; + esac } \ + | while read -r line; do + + [[ $line == *([[:blank:]])-* ]] || continue + # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc + while [[ $line =~ \ + ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do + line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"} + done + __parse_options "${line// or /, }" + + done +} + +# Parse BSD style usage output (options in brackets) of the given command. +# @param $1 command; if "-", read from stdin and ignore rest of args +# @param $2 command options (default: --usage) +# +_parse_usage() +{ + eval local cmd=$( quote "$1" ) + local line match option i char + { case $cmd in + -) cat ;; + *) LC_ALL=C "$( dequote "$cmd" )" ${2:---usage} 2>&1 ;; + esac } \ + | while read -r line; do + + while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do + match=${BASH_REMATCH[0]} + option=${BASH_REMATCH[1]} + case $option in + -?(\[)+([a-zA-Z0-9?])) + # Treat as bundled short options + for (( i=1; i < ${#option}; i++ )); do + char=${option:i:1} + [[ $char != '[' ]] && printf '%s\n' -$char + done + ;; + *) + __parse_options "$option" + ;; + esac + line=${line#*"$match"} + done + + done +} + +# This function completes on signal names (minus the SIG prefix) +# @param $1 prefix +_signals() +{ + local -a sigs=( $( compgen -P "$1" -A signal "SIG${cur#$1}" ) ) + COMPREPLY+=( "${sigs[@]/#${1}SIG/${1}}" ) +} + +# This function completes on known mac addresses +# +_mac_addresses() +{ + local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}' + local PATH="$PATH:/sbin:/usr/sbin" + + # Local interfaces + # - ifconfig on Linux: HWaddr or ether + # - ifconfig on FreeBSD: ether + # - ip link: link/ether + COMPREPLY+=( $( \ + { LC_ALL=C ifconfig -a || ip link show; } 2>/dev/null | command sed -ne \ + "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne \ + "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne \ + "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne \ + "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$|\2|p" + ) ) + + # ARP cache + COMPREPLY+=( $( { arp -an || ip neigh show; } 2>/dev/null | command sed -ne \ + "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \ + "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) ) + + # /etc/ethers + COMPREPLY+=( $( command sed -ne \ + "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) ) + + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + __ltrim_colon_completions "$cur" +} + +# This function completes on configured network interfaces +# +_configured_interfaces() +{ + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=( $( compgen -W "$( command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ + /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null )" \ + -- "$cur" ) ) + elif [[ -f /etc/SuSE-release ]]; then + # SuSE system + COMPREPLY=( $( compgen -W "$( printf '%s\n' \ + /etc/sysconfig/network/ifcfg-* | \ + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) + elif [[ -f /etc/pld-release ]]; then + # PLD Linux + COMPREPLY=( $( compgen -W "$( command ls -B \ + /etc/sysconfig/interfaces | \ + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) + else + # Assume Red Hat + COMPREPLY=( $( compgen -W "$( printf '%s\n' \ + /etc/sysconfig/network-scripts/ifcfg-* | \ + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) + fi +} + +# Local IP addresses. +# +_ip_addresses() +{ + local PATH=$PATH:/sbin + COMPREPLY+=( $( compgen -W \ + "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | command sed -ne \ + 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne \ + 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ + -- "$cur" ) ) +} + +# This function completes on available kernels +# +_kernel_versions() +{ + COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) ) +} + +# This function completes on all available network interfaces +# -a: restrict to active interfaces only +# -w: restrict to wireless interfaces only +# +_available_interfaces() +{ + local cmd PATH=$PATH:/sbin + + if [[ ${1:-} == -w ]]; then + cmd="iwconfig" + elif [[ ${1:-} == -a ]]; then + cmd="{ ifconfig || ip link show up; }" + else + cmd="{ ifconfig -a || ip link show; }" + fi + + COMPREPLY=( $( eval $cmd 2>/dev/null | awk \ + '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) ) +} + +# Echo number of CPUs, falling back to 1 on failure. +_ncpus() +{ + local var=NPROCESSORS_ONLN + [[ $OSTYPE == *linux* ]] && var=_$var + local n=$( getconf $var 2>/dev/null ) + printf %s ${n:-1} +} + +# Perform tilde (~) completion +# @return True (0) if completion needs further processing, +# False (> 0) if tilde is followed by a valid username, completions +# are put in COMPREPLY and no further processing is necessary. +_tilde() +{ + local result=0 + if [[ $1 == \~* && $1 != */* ]]; then + # Try generate ~username completions + COMPREPLY=( $( compgen -P '~' -u -- "${1#\~}" ) ) + result=${#COMPREPLY[@]} + # 2>/dev/null for direct invocation, e.g. in the _tilde unit test + [[ $result -gt 0 ]] && compopt -o filenames 2>/dev/null + fi + return $result +} + + +# Expand variable starting with tilde (~) +# We want to expand ~foo/... to /home/foo/... to avoid problems when +# word-to-complete starting with a tilde is fed to commands and ending up +# quoted instead of expanded. +# Only the first portion of the variable from the tilde up to the first slash +# (~../) is expanded. The remainder of the variable, containing for example +# a dollar sign variable ($) or asterisk (*) is not expanded. +# Example usage: +# +# $ v="~"; __expand_tilde_by_ref v; echo "$v" +# +# Example output: +# +# v output +# -------- ---------------- +# ~ /home/user +# ~foo/bar /home/foo/bar +# ~foo/$HOME /home/foo/$HOME +# ~foo/a b /home/foo/a b +# ~foo/* /home/foo/* +# +# @param $1 Name of variable (not the value of the variable) to expand +__expand_tilde_by_ref() +{ + # Does $1 start with tilde (~)? + if [[ ${!1} == \~* ]]; then + # Does $1 contain slash (/)? + if [[ ${!1} == */* ]]; then + # Yes, $1 contains slash; + # 1: Remove * including and after first slash (/), i.e. "~a/b" + # becomes "~a". Double quotes allow eval. + # 2: Remove * before the first slash (/), i.e. "~a/b" + # becomes "b". Single quotes prevent eval. + # +-----1----+ +---2----+ + eval $1="${!1/%\/*}"/'${!1#*/}' + else + # No, $1 doesn't contain slash + eval $1="${!1}" + fi + fi +} # __expand_tilde_by_ref() + + +# This function expands tildes in pathnames +# +_expand() +{ + # FIXME: Why was this here? + #[ "$cur" != "${cur%\\}" ] && cur+="\\" + + # Expand ~username type directory specifications. We want to expand + # ~foo/... to /home/foo/... to avoid problems when $cur starting with + # a tilde is fed to commands and ending up quoted instead of expanded. + + if [[ "$cur" == \~*/* ]]; then + eval cur=$cur 2>/dev/null + elif [[ "$cur" == \~* ]]; then + cur=${cur#\~} + COMPREPLY=( $( compgen -P '~' -u -- "$cur" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && eval COMPREPLY[0]=${COMPREPLY[0]} + return ${#COMPREPLY[@]} + fi +} + +# This function completes on process IDs. +# AIX and Solaris ps prefers X/Open syntax. +[[ $OSTYPE == *@(solaris|aix)* ]] && +_pids() +{ + COMPREPLY=( $( compgen -W '$( command ps -efo pid | command sed 1d )' -- "$cur" )) +} || +_pids() +{ + COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- "$cur" ) ) +} + +# This function completes on process group IDs. +# AIX and SunOS prefer X/Open, all else should be BSD. +[[ $OSTYPE == *@(solaris|aix)* ]] && +_pgids() +{ + COMPREPLY=( $( compgen -W '$( command ps -efo pgid | command sed 1d )' -- "$cur" )) +} || +_pgids() +{ + COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- "$cur" )) +} + +# This function completes on process names. +# AIX and SunOS prefer X/Open, all else should be BSD. +# @param $1 if -s, don't try to avoid truncated command names +[[ $OSTYPE == *@(solaris|aix)* ]] && +_pnames() +{ + COMPREPLY=( $( compgen -X '' -W '$( command ps -efo comm | \ + command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) +} || +_pnames() +{ + if [[ "$1" == -s ]]; then + COMPREPLY=( $( compgen -X '' \ + -W '$( command ps axo comm | command sed -e 1d )' -- "$cur" ) ) + else + # FIXME: completes "[kblockd/0]" to "0". Previously it was completed + # to "kblockd" which isn't correct either. "kblockd/0" would be + # arguably most correct, but killall from psmisc 22 treats arguments + # containing "/" specially unless -r is given so that wouldn't quite + # work either. Perhaps it'd be best to not complete these to anything + # for now. + COMPREPLY=( $( compgen -X '' -W '$( command ps axo command= | command sed -e \ + "s/ .*//" -e \ + "s:.*/::" -e \ + "s/:$//" -e \ + "s/^[[(-]//" -e \ + "s/[])]$//" | sort -u )' -- "$cur" ) ) + fi +} + +# This function completes on user IDs +# +_uids() +{ + if type getent &>/dev/null; then + COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" ) ) + elif type perl &>/dev/null; then + COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" ) ) + else + # make do with /etc/passwd + COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" ) ) + fi +} + +# This function completes on group IDs +# +_gids() +{ + if type getent &>/dev/null; then + COMPREPLY=( $( compgen -W '$( getent group | cut -d: -f3 )' \ + -- "$cur" ) ) + elif type perl &>/dev/null; then + COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" ) ) + else + # make do with /etc/group + COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/group )' -- "$cur" ) ) + fi +} + +# Glob for matching various backup files. +# +_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))' + +# Complete on xinetd services +# +_xinetd_services() +{ + local xinetddir=/etc/xinetd.d + if [[ -d $xinetddir ]]; then + local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob + local -a svcs=( $( printf '%s\n' $xinetddir/!($_backup_glob) ) ) + $restore_nullglob + COMPREPLY+=( $( compgen -W '${svcs[@]#$xinetddir/}' -- "$cur" ) ) + fi +} + +# This function completes on services +# +_services() +{ + local sysvdirs + _sysvdirs + + local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob + COMPREPLY=( \ + $( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README) ) ) + $restore_nullglob + + COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \ + awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) ) + + if [[ -x /sbin/upstart-udev-bridge ]]; then + COMPREPLY+=( $( initctl list 2>/dev/null | cut -d' ' -f1 ) ) + fi + + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur" ) ) +} + +# This completes on a list of all available service scripts for the +# 'service' command and/or the SysV init.d directory, followed by +# that script's available commands +# +_service() +{ + local cur prev words cword + _init_completion || return + + # don't complete past 2nd token + [[ $cword -gt 2 ]] && return + + if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then + _services + [[ -e /etc/mandrake-release ]] && _xinetd_services + else + local sysvdirs + _sysvdirs + COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ + -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ + ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) ) + fi +} && +complete -F _service service +_sysvdirs +for svcdir in ${sysvdirs[@]}; do + for svc in $svcdir/!($_backup_glob); do + [[ -x $svc ]] && complete -F _service $svc + done +done +unset svc svcdir sysvdirs + +# This function completes on modules +# +_modules() +{ + local modpath + modpath=/lib/modules/$1 + COMPREPLY=( $( compgen -W "$( command ls -RL $modpath 2>/dev/null | \ + command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) +} + +# This function completes on installed modules +# +_installed_modules() +{ + COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" lsmod | \ + awk '{if (NR != 1) print $1}' )" -- "$1" ) ) +} + +# This function completes on user or user:group format; as for chown and cpio. +# +# The : must be added manually; it will only complete usernames initially. +# The legacy user.group format is not supported. +# +# @param $1 If -u, only return users/groups the user has access to in +# context of current completion. +_usergroup() +{ + if [[ $cur == *\\\\* || $cur == *:*:* ]]; then + # Give up early on if something seems horribly wrong. + return + elif [[ $cur == *\\:* ]]; then + # Completing group after 'user\:gr'. + # Reply with a list of groups prefixed with 'user:', readline will + # escape to the colon. + local prefix + prefix=${cur%%*([^:])} + prefix=${prefix//\\} + local mycur="${cur#*[:]}" + if [[ $1 == -u ]]; then + _allowed_groups "$mycur" + else + local IFS=$'\n' + COMPREPLY=( $( compgen -g -- "$mycur" ) ) + fi + COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) ) + elif [[ $cur == *:* ]]; then + # Completing group after 'user:gr'. + # Reply with a list of unprefixed groups since readline with split on : + # and only replace the 'gr' part + local mycur="${cur#*:}" + if [[ $1 == -u ]]; then + _allowed_groups "$mycur" + else + local IFS=$'\n' + COMPREPLY=( $( compgen -g -- "$mycur" ) ) + fi + else + # Completing a partial 'usernam'. + # + # Don't suffix with a : because readline will escape it and add a + # slash. It's better to complete into 'chown username ' than 'chown + # username\:'. + if [[ $1 == -u ]]; then + _allowed_users "$cur" + else + local IFS=$'\n' + COMPREPLY=( $( compgen -u -- "$cur" ) ) + fi + fi +} + +_allowed_users() +{ + if _complete_as_root; then + local IFS=$'\n' + COMPREPLY=( $( compgen -u -- "${1:-$cur}" ) ) + else + local IFS=$'\n ' + COMPREPLY=( $( compgen -W \ + "$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" ) ) + fi +} + +_allowed_groups() +{ + if _complete_as_root; then + local IFS=$'\n' + COMPREPLY=( $( compgen -g -- "$1" ) ) + else + local IFS=$'\n ' + COMPREPLY=( $( compgen -W \ + "$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" ) ) + fi +} + +# This function completes on valid shells +# +_shells() +{ + local shell rest + while read -r shell rest; do + [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=( $shell ) + done 2>/dev/null < /etc/shells +} + +# This function completes on valid filesystem types +# +_fstypes() +{ + local fss + + if [[ -e /proc/filesystems ]]; then + # Linux + fss="$( cut -d$'\t' -f2 /proc/filesystems ) + $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )" + else + # Generic + fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null ) + $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) + $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) + $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) + $( [[ -d /etc/fs ]] && command ls /etc/fs )" + fi + + [[ -n $fss ]] && COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) ) +} + +# Get real command. +# - arg: $1 Command +# - stdout: Filename of command in PATH with possible symbolic links resolved. +# Empty string if command not found. +# - return: True (0) if command found, False (> 0) if not. +_realcommand() +{ + type -P "$1" > /dev/null && { + if type -p realpath > /dev/null; then + realpath "$(type -P "$1")" + elif type -p greadlink > /dev/null; then + greadlink -f "$(type -P "$1")" + elif type -p readlink > /dev/null; then + readlink -f "$(type -P "$1")" + else + type -P "$1" + fi + } +} + +# This function returns the first argument, excluding options +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. See __reassemble_comp_words_by_ref. +_get_first_arg() +{ + local i + + arg= + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" != -* ]]; then + arg=${COMP_WORDS[i]} + break + fi + done +} + + +# This function counts the number of args, excluding options +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. See __reassemble_comp_words_by_ref. +_count_args() +{ + local i cword words + __reassemble_comp_words_by_ref "$1" words cword + + args=1 + for i in "${words[@]:1:cword-1}"; do + [[ "$i" != -* ]] && args=$(($args+1)) + done +} + +# This function completes on PCI IDs +# +_pci_ids() +{ + COMPREPLY+=( $( compgen -W \ + "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) ) +} + +# This function completes on USB IDs +# +_usb_ids() +{ + COMPREPLY+=( $( compgen -W \ + "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) ) +} + +# CD device names +_cd_devices() +{ + COMPREPLY+=( $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) ) +} + +# DVD device names +_dvd_devices() +{ + COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) ) +} + +# TERM environment variable values +_terms() +{ + COMPREPLY+=( $( compgen -W \ + "$( command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ + 2>/dev/null )" -- "$cur" ) ) + COMPREPLY+=( $( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } \ + | awk '{ print $1 }' | sort -u )" -- "$cur" ) ) +} + +# a little help for FreeBSD ports users +[[ $OSTYPE == *freebsd* ]] && complete -W 'index search fetch fetch-list + extract patch configure build install reinstall deinstall clean + clean-depends kernel buildworld' make + +# This function provides simple user@host completion +# +_user_at_host() +{ + local cur prev words cword + _init_completion -n : || return + + if [[ $cur == *@* ]]; then + _known_hosts_real "$cur" + else + COMPREPLY=( $( compgen -u -S @ -- "$cur" ) ) + compopt -o nospace + fi +} +shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger + +# NOTE: Using this function as a helper function is deprecated. Use +# `_known_hosts_real' instead. +_known_hosts() +{ + local cur prev words cword + _init_completion -n : || return + + # NOTE: Using `_known_hosts' as a helper function and passing options + # to `_known_hosts' is deprecated: Use `_known_hosts_real' instead. + local options + [[ "$1" == -a || "$2" == -a ]] && options=-a + [[ "$1" == -c || "$2" == -c ]] && options+=" -c" + _known_hosts_real $options -- "$cur" +} # _known_hosts() + +# Helper function to locate ssh included files in configs +# This function look for the "Include" keyword in ssh config files and include +# them recursively adding each result to the config variable +_included_ssh_config_files() +{ + [[ $# -lt 1 ]] && echo "error: $FUNCNAME: missing mandatory argument CONFIG" + local configfile i f + configfile=$1 + local included=$( command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\{1,\}\([^#%]*\)\(#.*\)\{0,1\}$/\1/p' "${configfile}" ) + for i in ${included[@]}; do + # Check the origin of $configfile to complete relative included paths on included + # files according to ssh_config(5): + # "[...] Files without absolute paths are assumed to be in ~/.ssh if included in a user + # configuration file or /etc/ssh if included from the system configuration file.[...]" + if ! [[ "$i" =~ ^\~.*|^\/.* ]]; then + if [[ "$configfile" =~ ^\/etc\/ssh.* ]]; then + i="/etc/ssh/$i" + else + i="$HOME/.ssh/$i" + fi + fi + __expand_tilde_by_ref i + # In case the expanded variable contains multiple paths + for f in ${i}; do + if [ -r $f ]; then + config+=( "$f" ) + # The Included file is processed to look for Included files in itself + _included_ssh_config_files $f + fi + done + done +} # _included_ssh_config_files() + +# Helper function for completing _known_hosts. +# This function performs host completion based on ssh's config and known_hosts +# files, as well as hostnames reported by avahi-browse if +# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from +# HOSTFILE (compgen -A hostname) are added, unless +# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value. +# Usage: _known_hosts_real [OPTIONS] CWORD +# Options: -a Use aliases +# -c Use `:' suffix +# -F configfile Use `configfile' for configuration settings +# -p PREFIX Use PREFIX +# Return: Completions, starting with CWORD, are added to COMPREPLY[] +_known_hosts_real() +{ + local configfile flag prefix + local cur curd awkcur user suffix aliases i host + local -a kh khd config + + local OPTIND=1 + while getopts "acF:p:" flag "$@"; do + case $flag in + a) aliases='yes' ;; + c) suffix=':' ;; + F) configfile=$OPTARG ;; + p) prefix=$OPTARG ;; + esac + done + [[ $# -lt $OPTIND ]] && echo "error: $FUNCNAME: missing mandatory argument CWORD" + cur=${!OPTIND}; let "OPTIND += 1" + [[ $# -ge $OPTIND ]] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\ + $(while [[ $# -ge $OPTIND ]]; do printf '%s\n' ${!OPTIND}; shift; done) + + [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@} + kh=() + + # ssh config files + if [[ -n $configfile ]]; then + [[ -r $configfile ]] && config+=( "$configfile" ) + else + for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; do + [[ -r $i ]] && config+=( "$i" ) + done + fi + + # "Include" keyword in ssh config files + for i in "${config[@]}"; do + _included_ssh_config_files "$i" + done + + # Known hosts files from configs + if [[ ${#config[@]} -gt 0 ]]; then + local OIFS=$IFS IFS=$'\n' j + local -a tmpkh + # expand paths (if present) to global and user known hosts files + # TODO(?): try to make known hosts files with more than one consecutive + # spaces in their name work (watch out for ~ expansion + # breakage! Alioth#311595) + tmpkh=( $( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u ) ) + IFS=$OIFS + for i in "${tmpkh[@]}"; do + # First deal with quoted entries... + while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do + i=${BASH_REMATCH[1]}${BASH_REMATCH[3]} + j=${BASH_REMATCH[2]} + __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' + [[ -r $j ]] && kh+=( "$j" ) + done + # ...and then the rest. + for j in $i; do + __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' + [[ -r $j ]] && kh+=( "$j" ) + done + done + fi + + if [[ -z $configfile ]]; then + # Global and user known_hosts files + for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \ + /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \ + ~/.ssh/known_hosts2; do + [[ -r $i ]] && kh+=( "$i" ) + done + for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do + [[ -d $i ]] && khd+=( "$i"/*pub ) + done + fi + + # If we have known_hosts files to use + if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then + # Escape slashes and dots in paths for awk + awkcur=${cur//\//\\\/} + awkcur=${awkcur//\./\\\.} + curd=$awkcur + + if [[ "$awkcur" == [0-9]*[.:]* ]]; then + # Digits followed by a dot or a colon - just search for that + awkcur="^$awkcur[.:]*" + elif [[ "$awkcur" == [0-9]* ]]; then + # Digits followed by no dot or colon - search for digits followed + # by a dot or a colon + awkcur="^$awkcur.*[.:]" + elif [[ -z $awkcur ]]; then + # A blank - search for a dot, a colon, or an alpha character + awkcur="[a-z.:]" + else + awkcur="^$awkcur" + fi + + if [[ ${#kh[@]} -gt 0 ]]; then + # FS needs to look for a comma separated list + COMPREPLY+=( $( awk 'BEGIN {FS=","} + /^\s*[^|\#]/ { + sub("^@[^ ]+ +", ""); \ + sub(" .*$", ""); \ + for (i=1; i<=NF; ++i) { \ + sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ + if ($i !~ /[*?]/ && $i ~ /'"$awkcur"'/) {print $i} \ + }}' "${kh[@]}" 2>/dev/null ) ) + fi + if [[ ${#khd[@]} -gt 0 ]]; then + # Needs to look for files called + # .../.ssh2/key_22_.pub + # dont fork any processes, because in a cluster environment, + # there can be hundreds of hostkeys + for i in "${khd[@]}" ; do + if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then + host=${i/#*key_22_/} + host=${host/%.pub/} + COMPREPLY+=( $host ) + fi + done + fi + + # apply suffix and prefix + for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do + COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix + done + fi + + # append any available aliases from config files + if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then + local hosts=$( command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" ) + COMPREPLY+=( $( compgen -P "$prefix$user" \ + -S "$suffix" -W "$hosts" -- "$cur" ) ) + fi + + # Add hosts reported by avahi-browse, if desired and it's available. + if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \ + type avahi-browse &>/dev/null; then + # The original call to avahi-browse also had "-k", to avoid lookups + # into avahi's services DB. We don't need the name of the service, and + # if it contains ";", it may mistify the result. But on Gentoo (at + # least), -k wasn't available (even if mentioned in the manpage) some + # time ago, so... + COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \ + "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \ + awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) + fi + + # Add hosts reported by ruptime. + COMPREPLY+=( $( compgen -W \ + "$( ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }' )" \ + -- "$cur" ) ) + + # Add results of normal hostname completion, unless + # `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value. + if [[ -n ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then + COMPREPLY+=( + $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) ) + fi + + __ltrim_colon_completions "$prefix$user$cur" + +} # _known_hosts_real() +complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \ + fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount + +# This meta-cd function observes the CDPATH variable, so that cd additionally +# completes on directories under those specified in CDPATH. +# +_cd() +{ + local cur prev words cword + _init_completion || return + + local IFS=$'\n' i j k + + compopt -o filenames + + # Use standard dir completion if no CDPATH or parameter starts with /, + # ./ or ../ + if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then + _filedir -d + return + fi + + local -r mark_dirs=$(_rl_enabled mark-directories && echo y) + local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y) + + # we have a CDPATH, so loop on its contents + for i in ${CDPATH//:/$'\n'}; do + # create an array of matched subdirs + k="${#COMPREPLY[@]}" + for j in $( compgen -d -- $i/$cur ); do + if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then + j+="/" + fi + COMPREPLY[k++]=${j#$i/} + done + done + + _filedir -d + + if [[ ${#COMPREPLY[@]} -eq 1 ]]; then + i=${COMPREPLY[0]} + if [[ "$i" == "$cur" && $i != "*/" ]]; then + COMPREPLY[0]="${i}/" + fi + fi + + return +} +if shopt -q cdable_vars; then + complete -v -F _cd -o nospace cd pushd +else + complete -F _cd -o nospace cd pushd +fi + +# a wrapper method for the next one, when the offset is unknown +_command() +{ + local offset i + + # find actual offset, as position of the first non-option + offset=1 + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" != -* ]]; then + offset=$i + break + fi + done + _command_offset $offset +} + +# A meta-command completion function for commands like sudo(8), which need to +# first complete on a command, then complete according to that command's own +# completion definition. +# +_command_offset() +{ + # rewrite current completion context before invoking + # actual command completion + + # find new first word position, then + # rewrite COMP_LINE and adjust COMP_POINT + local word_offset=$1 i j + for (( i=0; i < $word_offset; i++ )); do + for (( j=0; j <= ${#COMP_LINE}; j++ )); do + [[ "$COMP_LINE" == "${COMP_WORDS[i]}"* ]] && break + COMP_LINE=${COMP_LINE:1} + ((COMP_POINT--)) + done + COMP_LINE=${COMP_LINE#"${COMP_WORDS[i]}"} + ((COMP_POINT-=${#COMP_WORDS[i]})) + done + + # shift COMP_WORDS elements and adjust COMP_CWORD + for (( i=0; i <= COMP_CWORD - $word_offset; i++ )); do + COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]} + done + for (( i; i <= COMP_CWORD; i++ )); do + unset 'COMP_WORDS[i]' + done + ((COMP_CWORD -= $word_offset)) + + COMPREPLY=() + local cur + _get_comp_words_by_ref cur + + if [[ $COMP_CWORD -eq 0 ]]; then + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + else + local cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]} + local cspec=$( complete -p $cmd 2>/dev/null ) + + # If we have no completion for $cmd yet, see if we have for basename + if [[ ! $cspec && $cmd == */* ]]; then + cspec=$( complete -p ${cmd##*/} 2>/dev/null ) + [[ $cspec ]] && compcmd=${cmd##*/} + fi + # If still nothing, just load it for the basename + if [[ ! $cspec ]]; then + compcmd=${cmd##*/} + _completion_loader $compcmd + cspec=$( complete -p $compcmd 2>/dev/null ) + fi + + if [[ -n $cspec ]]; then + if [[ ${cspec#* -F } != $cspec ]]; then + # complete -F + + # get function name + local func=${cspec#*-F } + func=${func%% *} + + if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then + $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}" + else + $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" + fi + + # restore initial compopts + local opt + while [[ $cspec == *" -o "* ]]; do + # FIXME: should we take "+o opt" into account? + cspec=${cspec#*-o } + opt=${cspec%% *} + compopt -o $opt + cspec=${cspec#$opt} + done + else + cspec=${cspec#complete} + cspec=${cspec%%$compcmd} + COMPREPLY=( $( eval compgen "$cspec" -- '$cur' ) ) + fi + elif [[ ${#COMPREPLY[@]} -eq 0 ]]; then + # XXX will probably never happen as long as completion loader loads + # *something* for every command thrown at it ($cspec != empty) + _minimal + fi + fi +} +complete -F _command aoss command do else eval exec ltrace nice nohup padsp \ + then time tsocks vsound xargs + +_root_command() +{ + local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin + local root_command=$1 + _command +} +complete -F _root_command fakeroot gksu gksudo kdesudo really + +# Return true if the completion should be treated as running as root +_complete_as_root() +{ + [[ $EUID -eq 0 || ${root_command:-} ]] +} + +_longopt() +{ + local cur prev words cword split + _init_completion -s || return + + case "${prev,,}" in + --help|--usage|--version) + return + ;; + --*dir*) + _filedir -d + return + ;; + --*file*|--*path*) + _filedir + return + ;; + --+([-a-z0-9_])) + local argtype=$( LC_ALL=C $1 --help 2>&1 | command sed -ne \ + "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" ) + case ${argtype,,} in + *dir*) + _filedir -d + return + ;; + *file*|*path*) + _filedir + return + ;; + esac + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \ + command sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + elif [[ "$1" == @(@(mk|rm)dir|chroot) ]]; then + _filedir -d + else + _filedir + fi +} +# makeinfo and texi2dvi are defined elsewhere. +complete -F _longopt a2ps awk base64 bash bc bison cat chroot colordiff cp \ + csplit cut date df diff dir du enscript env expand fmt fold gperf \ + grep grub head irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \ + mv netstat nl nm objcopy objdump od paste pr ptx readelf rm rmdir \ + sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \ + texindex touch tr uname unexpand uniq units vdir wc who + +declare -A _xspecs +_filedir_xspec() +{ + local cur prev words cword + _init_completion || return + + _tilde "$cur" || return + + local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp + local -a toks + + toks=( $( + compgen -d -- "$(quote_readline "$cur")" | { + while read -r tmp; do + printf '%s\n' $tmp + done + } + )) + + # Munge xspec to contain uppercase version too + # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 + eval xspec="${xspec}" + local matchop=! + if [[ $xspec == !* ]]; then + xspec=${xspec#!} + matchop=@ + fi + xspec="$matchop($xspec|${xspec^^})" + + toks+=( $( + eval compgen -f -X "'!$xspec'" -- "\$(quote_readline "\$cur")" | { + while read -r tmp; do + [[ -n $tmp ]] && printf '%s\n' $tmp + done + } + )) + + if [[ ${#toks[@]} -ne 0 ]]; then + compopt -o filenames + COMPREPLY=( "${toks[@]}" ) + fi +} + +_install_xspec() +{ + local xspec=$1 cmd + shift + for cmd in $@; do + _xspecs[$cmd]=$xspec + done + complete -F _filedir_xspec $@ +} +# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510 +_install_xspec '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat lbunzip2 lbzcat +_install_xspec '!*.@(zip|[ejsw]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz)' unzip zipinfo +_install_xspec '*.Z' compress znew +# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510 +_install_xspec '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat +_install_xspec '!*.@(Z|[gGdz]z|t[ag]z)' unpigz +_install_xspec '!*.Z' uncompress +# lzcmp, lzdiff intentionally not here, see Debian: #455510 +_install_xspec '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma +_install_xspec '!*.@(?(t)xz|tlz|lzma)' unxz xzcat +_install_xspec '!*.lrz' lrunzip +_install_xspec '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee +_install_xspec '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|svg)' qiv +_install_xspec '!*.@(gif|jp?(e)g?(2)|j2[ck]|jp[2f]|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)' xv +_install_xspec '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview +_install_xspec '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi +_install_xspec '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx +_install_xspec '!*.[pf]df' acroread gpdf xpdf +_install_xspec '!*.@(?(e)ps|pdf)' kpdf +_install_xspec '!*.@(okular|@(?(e|x)ps|?(E|X)PS|[pf]df|[PF]DF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2)))' okular +_install_xspec '!*.pdf' epdfview pdfunite +_install_xspec '!*.@(cb[rz7t]|djv?(u)|?(e)ps|pdf)' zathura +_install_xspec '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr +_install_xspec '!*.texi*' makeinfo texi2html +_install_xspec '!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi xetex xelatex luatex lualatex +_install_xspec '!*.mp3' mpg123 mpg321 madplay +_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine +_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon +_install_xspec '!*.@(avi|asf|wmv)' aviplay +_install_xspec '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay +_install_xspec '!*.@(mpg|mpeg|avi|mov|qt)' xanim +_install_xspec '!*.@(ogg|m3u|flac|spx)' ogg123 +_install_xspec '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp +_install_xspec '!*.fig' xfig +_install_xspec '!*.@(mid?(i)|cmf)' playmidi +_install_xspec '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity +_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123 +_install_xspec '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite +_install_xspec '!*.@(zip|z|gz|tgz)' bzme +# konqueror not here on purpose, it's more than a web/html browser +_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx galeon dillo elinks amaya epiphany +_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL])|[pP][dD][fF])' firefox mozilla-firefox iceweasel google-chrome chromium-browser +_install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)' oowriter +_install_xspec '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)' ooimpress +_install_xspec '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)' oocalc +_install_xspec '!*.@(sxd|std|sda|sdd|?(f)odg|otg)' oodraw +_install_xspec '!*.@(sxm|smf|mml|odf)' oomath +_install_xspec '!*.odb' oobase +_install_xspec '!*.[rs]pm' rpm2cpio +_install_xspec '!*.aux' bibtex +_install_xspec '!*.po' poedit gtranslator kbabel lokalize +_install_xspec '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp +_install_xspec '!*.[Hh][Rr][Bb]' hbrun +_install_xspec '!*.ly' lilypond ly2dvi +_install_xspec '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff +_install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)' portecle +_install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt +unset -f _install_xspec + +# Minimal completion to use as fallback in _completion_loader. +_minimal() +{ + local cur prev words cword split + _init_completion -s || return + $split && return + _filedir +} +# Complete the empty string to allow completion of '>', '>>', and '<' on < 4.3 +# http://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html +complete -F _minimal '' + + +__load_completion() +{ + local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions ) + local OIFS=$IFS IFS=: dir cmd="$1" compfile + for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do + dirs+=( $dir/bash-completion/completions ) + done + IFS=$OIFS + + if [[ $BASH_SOURCE == */* ]]; then + dirs+=( "${BASH_SOURCE%/*}/completions" ) + else + dirs+=( ./completions ) + fi + + for dir in "${dirs[@]}"; do + for compfile in "${cmd##*/}" "${cmd##*/}".bash _"${cmd##*/}"; do + compfile="$dir/$compfile" + # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 + [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 0 + done + done + + return 1 +} + +# set up dynamic completion loading +_completion_loader() +{ + # $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier + local cmd="${1:-_EmptycmD_}" + + __load_completion "$cmd" && return 124 + + # Need to define *something*, otherwise there will be no completion at all. + complete -F _minimal -- "$cmd" && return 124 +} && +complete -D -F _completion_loader + +# Function for loading and calling functions from dynamically loaded +# completion files that may not have been sourced yet. +# @param $1 completion file to load function from in case it is missing +# @param $2... function and its arguments +_xfunc() +{ + set -- "$@" + local srcfile=$1 + shift + declare -F $1 &>/dev/null || { + __load_completion "$srcfile" + } + "$@" +} + +# source compat completion directory definitions +compat_dir=${BASH_COMPLETION_COMPAT_DIR:-/etc/bash_completion.d} +if [[ -d $compat_dir && -r $compat_dir && -x $compat_dir ]]; then + for i in "$compat_dir"/*; do + [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \ + && -f $i && -r $i ]] && . "$i" + done +fi +unset compat_dir i _blacklist_glob + +# source user completion file +user_completion=${BASH_COMPLETION_USER_FILE:-~/.bash_completion} +[[ ${BASH_SOURCE[0]} != $user_completion && -r $user_completion ]] \ + && . $user_completion +unset user_completion + +unset -f have +unset have + +set $BASH_COMPLETION_ORIGINAL_V_VALUE +unset BASH_COMPLETION_ORIGINAL_V_VALUE + +# ex: filetype=sh diff --git a/bash_completion.sh.in b/bash_completion.sh.in new file mode 100644 index 0000000..4e410d4 --- /dev/null +++ b/bash_completion.sh.in @@ -0,0 +1,15 @@ +# Check for interactive bash and that we haven't already been sourced. +if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then + + # Check for recent enough version of bash. + if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ + [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then + [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ + . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" + if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then + # Source completion code. + . @pkgdatadir@/bash_completion + fi + fi + +fi diff --git a/completions/2to3 b/completions/2to3 new file mode 100644 index 0000000..4dd29bf --- /dev/null +++ b/completions/2to3 @@ -0,0 +1,39 @@ +# bash completion for 2to3 -*- shell-script -*- + +_2to3() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--add-suffix) + return + ;; + -f|--fix|-x|--nofix) + COMPREPLY=( $( compgen -W \ + "$( $1 --list-fixes 2>/dev/null | command sed -e 1d )" -- "$cur" ) ) + return + ;; + -j|--processes) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + -o|--output-dir) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _2to3 2to3 + +# ex: filetype=sh diff --git a/completions/7z b/completions/7z new file mode 100644 index 0000000..5599b70 --- /dev/null +++ b/completions/7z @@ -0,0 +1,119 @@ +# 7z(1) completion -*- shell-script -*- + +_7z() +{ + local cur prev words cword + _init_completion -n = || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'a b d e l t u x' -- "$cur" ) ) + return + fi + + local mode + [[ ${words[1]} == [adu] ]] && mode=w || mode=r + + case $cur in + -ao*) + COMPREPLY=( $( compgen -P${cur:0:3} -W 'a s t u' -- "${cur:3}" ) ) + return + ;; + -?(a)[ix]*) + local opt + if [[ $cur == -a[ix]* ]]; then + opt=${cur:0:3} cur=${cur:3} + else + opt=${cur:0:2} cur=${cur:2} + fi + if [[ $cur != *[@\!]* ]]; then + COMPREPLY=( $( compgen -P$opt -W '@ ! r@ r-@ r0@ r! r-! r0!' \ + -- "$cur" ) ) + elif [[ $cur == ?(r@(-|0|))@* ]]; then + local x tmp + x=$( compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}" ) && + while read -r tmp; do + COMPREPLY+=( "$tmp" ) + done <<< "$x" + compopt -o filenames + fi + return + ;; + -mhe=*|-mhc=*|-ms=*|-mt=*) + COMPREPLY=( $( compgen -W 'on off' -- "${cur#*=}" ) ) + return + ;; + -mx=*) + COMPREPLY=( $( compgen -W '0 1 3 5 7 9' -- "${cur#*=}" ) ) + return + ;; + -o*|-w?*) + local x tmp + x=$( compgen -P${cur:0:2} -S/ -d -- "${cur:2}" ) && + while read -r tmp; do + COMPREPLY+=( "$tmp" ) + done <<< "$x" + compopt -o nospace -o filenames + return + ;; + -r?*) + COMPREPLY=( $( compgen -P${cur:0:2} -W '- 0' -- "${cur:2}" ) ) + return + ;; + -scs*) + COMPREPLY=( $( compgen -P${cur:0:4} -W 'UTF-8 WIN DOS' \ + -- "${cur:4}" ) ) + return + ;; + -ssc?*) + COMPREPLY=( $( compgen -P${cur:0:4} -W '-' -- "${cur:4}" ) ) + return + ;; + -t*) + if [[ $mode == w ]]; then + COMPREPLY=( $( compgen -P${cur:0:2} -W '7z bzip2 gzip swfc + tar wim xz zip' -- "${cur:2}" ) ) + else + COMPREPLY=( $( compgen -P${cur:0:2} -W '7z apm arj bzip2 cab + chm cpio cramfs deb dmg elf fat flv gzip hfs iso lzh lzma + lzma86 macho mbr mslz mub nsis ntfs pe ppmd rar rpm + squashfs swf swfc tar udf vhd wim xar xz z zip' \ + -- "${cur:2}" ) ) + fi + return + ;; + -m*=*|-p*|-u*|-v*) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-ai -an -ao -ax -bd -i -m{x,s,f,he,hc,mt}= + -o -p -r -scs -sfx -si -slp -slt -so -ssc -t -u -v -w -x -y' \ + -- "$cur" ) ) + [[ $COMPREPLY == -@(an|bd|sfx|si|slt|so|ssc|[rwy]) ]] || + compopt -o nospace + return + fi + + local args + _count_args = + if [[ $args -eq 2 ]]; then + _filedir_xspec unzip + [[ $mode == w ]] && + _filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' || + _filedir '@(7z|arj|bz2|cab|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)' + else + if [[ ${words[1]} == d ]]; then + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$( printf '%s\n' $( $1 l ${words[2]} \ + -slt 2>/dev/null | command sed -n '/^Path =/s/^Path = \(.*\)$/\1/p' \ + 2>/dev/null | tail -n+2 ) )" -- "$cur" ) ) + compopt -o filenames + else + _filedir + fi + fi +} && +complete -F _7z 7z 7za + +# ex: filetype=sh diff --git a/completions/Makefile.am b/completions/Makefile.am new file mode 100644 index 0000000..f04d7c3 --- /dev/null +++ b/completions/Makefile.am @@ -0,0 +1,974 @@ +bashcompdir = $(pkgdatadir)/completions +bashcomp_DATA = 2to3 \ + 7z \ + a2x \ + abook \ + aclocal \ + acpi \ + adb \ + add_members \ + alias \ + ant \ + apache2ctl \ + appdata-validate \ + apt-build \ + apt-cache \ + apt-get \ + aptitude \ + arch \ + arping \ + arpspoof \ + asciidoc \ + aspell \ + autoconf \ + automake \ + autoreconf \ + autorpm \ + autoscan \ + avctrl \ + badblocks \ + bind \ + bk \ + brctl \ + btdownloadheadless.py \ + bts \ + bzip2 \ + _cal \ + cancel \ + cardctl \ + ccache \ + cfagent \ + cfrun \ + chage \ + change_pw \ + check_db \ + check_perms \ + checksec \ + _chfn \ + chgrp \ + chkconfig \ + chown \ + chpasswd \ + chronyc \ + chrpath \ + _chsh \ + cksfv \ + cleanarch \ + clisp \ + clone_member \ + complete \ + config_list \ + configure \ + convert \ + cowsay \ + cpan2dist \ + cpio \ + cppcheck \ + crontab \ + cryptsetup \ + curl \ + cvs \ + cvsps \ + dd \ + deja-dup \ + desktop-file-validate \ + dhclient \ + dict \ + _dmesg \ + dnsspoof \ + dot \ + dpkg \ + dpkg-source \ + dselect \ + dsniff \ + dumpdb \ + dumpe2fs \ + e2freefrag \ + e2label \ + _eject \ + eog \ + ether-wake \ + evince \ + explodepkg \ + export \ + faillog \ + fbgs \ + fbi \ + feh \ + file \ + file-roller \ + filefrag \ + filesnarf \ + find \ + find_member \ + flake8 \ + freebsd-update \ + freeciv-gtk2 \ + freeciv-server \ + function \ + fusermount \ + gcc \ + gcl \ + gdb \ + genaliases \ + gendiff \ + genisoimage \ + getent \ + gkrellm \ + gm \ + gnatmake \ + gnokii \ + gnome-mplayer \ + gpasswd \ + gpg \ + gpg2 \ + gphoto2 \ + gprof \ + groupadd \ + groupdel \ + groupmems \ + groupmod \ + growisofs \ + grpck \ + gzip \ + hcitool \ + hddtemp \ + _hexdump \ + hid2hci \ + hostname \ + hping2 \ + htop \ + htpasswd \ + _hwclock \ + iconv \ + id \ + idn \ + iftop \ + ifup \ + info \ + inject \ + insmod \ + installpkg \ + interdiff \ + invoke-rc.d \ + _ionice \ + ip \ + iperf \ + ipmitool \ + ipsec \ + iptables \ + ipv6calc \ + iscsiadm \ + isql \ + iwconfig \ + iwlist \ + iwpriv \ + iwspy \ + jar \ + jarsigner \ + java \ + javaws \ + jpegoptim \ + jps \ + jshint \ + k3b \ + kcov \ + kill \ + killall \ + kldload \ + kldunload \ + koji \ + ktutil \ + larch \ + lastlog \ + ldapsearch \ + ldapvi \ + lftp \ + lftpget \ + lilo \ + links \ + lintian \ + lisp \ + list_admins \ + list_lists \ + list_members \ + list_owners \ + _look \ + lpq \ + lpr \ + lrzip \ + lsof \ + lua \ + luac \ + luseradd \ + luserdel \ + lvm \ + lz4 \ + lzip \ + lzma \ + lzop \ + macof \ + mailmanctl \ + make \ + makepkg \ + man \ + mc \ + mcrypt \ + mdadm \ + mdtool \ + medusa \ + mii-diag \ + mii-tool \ + minicom \ + mkinitrd \ + mktemp \ + mmsitepass \ + _mock \ + modinfo \ + modprobe \ + _modules \ + monodevelop \ + mount \ + mount.linux \ + mplayer \ + mr \ + msynctool \ + mtx \ + munindoc \ + munin-node-configure \ + munin-run \ + munin-update \ + mussh \ + mutt \ + mysql \ + mysqladmin \ + nc \ + ncftp \ + nethogs \ + _newgrp \ + newlist \ + newusers \ + ngrep \ + nmap \ + _nmcli \ + nslookup \ + ntpdate \ + openssl \ + opera \ + optipng \ + p4 \ + pack200 \ + passwd \ + patch \ + pdftotext \ + perl \ + pgrep \ + pidof \ + pine \ + ping \ + pkg-config \ + pkg-get \ + pkg_delete \ + pkgadd \ + pkgrm \ + pkgtool \ + pkgutil \ + plague-client \ + pm-hibernate \ + pm-is-supported \ + pm-powersave \ + pngfix \ + portinstall \ + portsnap \ + portupgrade \ + postcat \ + postconf \ + postfix \ + postmap \ + postsuper \ + povray \ + prelink \ + protoc \ + psql \ + puppet \ + pwck \ + pwd \ + pwdx \ + pwgen \ + py.test \ + pydoc \ + pyflakes \ + pylint \ + python \ + pyvenv \ + qdbus \ + qemu \ + qrunner \ + querybts \ + quota \ + rcs \ + rdesktop \ + remove_members \ + removepkg \ + _renice \ + _repomanage \ + reportbug \ + _reptyr \ + resolvconf \ + rfkill \ + ri \ + rmlist \ + rmmod \ + route \ + rpcdebug \ + rpm \ + rpm2tgz \ + rpmcheck \ + rrdtool \ + rsync \ + _rtcwake \ + _runuser \ + sbcl \ + sbopkg \ + screen \ + sh \ + sitecopy \ + slackpkg \ + slapt-get \ + slapt-src \ + smartctl \ + smbclient \ + snownews \ + sqlite3 \ + ss \ + ssh \ + ssh-add \ + ssh-copy-id \ + ssh-keygen \ + sshfs \ + sshmitm \ + sshow \ + strace \ + strings \ + _su \ + sudo \ + svcadm \ + svk \ + _svn \ + _svnadmin \ + _svnlook \ + sync_members \ + synclient \ + sysbench \ + sysctl \ + tar \ + tcpdump \ + tcpkill \ + tcpnice \ + timeout \ + tipc \ + tracepath \ + tshark \ + tune2fs \ + _udevadm \ + umount \ + umount.linux \ + unace \ + unpack200 \ + unrar \ + unshunt \ + update-alternatives \ + update-rc.d \ + upgradepkg \ + urlsnarf \ + useradd \ + userdel \ + usermod \ + valgrind \ + vipw \ + vmstat \ + vncviewer \ + vpnc \ + watch \ + webmitm \ + wget \ + wine \ + withlist \ + wodim \ + wol \ + _write \ + wsimport \ + wtf \ + wvdial \ + xfreerdp \ + xgamma \ + xhost \ + xm \ + xmllint \ + xmlwf \ + xmms \ + xmodmap \ + xrandr \ + xrdb \ + xsltproc \ + xxd \ + xz \ + xzdec \ + ypmatch \ + _yum \ + yum-arch \ + zopfli \ + zopflipng + +EXTRA_DIST = $(bashcomp_DATA) + +CLEANFILES = \ + 7za \ + aclocal-1.10 \ + aclocal-1.11 \ + aclocal-1.12 \ + aclocal-1.13 \ + aclocal-1.14 \ + aclocal-1.15 \ + alpine \ + alternatives \ + animate \ + apropos \ + arm-koji \ + asciidoc.py \ + autoheader \ + automake-1.10 \ + automake-1.11 \ + automake-1.12 \ + automake-1.13 \ + automake-1.14 \ + automake-1.15 \ + autossh \ + autoupdate \ + bsdtar \ + btdownloadcurses.py \ + btdownloadgui.py \ + c++ \ + cc \ + cdrecord \ + ci \ + ciptool \ + civclient \ + civserver \ + clzip \ + co \ + colormake \ + compare \ + compgen \ + composite \ + conjure \ + cowthink \ + createdb \ + createuser \ + dcop \ + declare \ + dfutool \ + display \ + dpkg-deb \ + dpkg-query \ + dpkg-reconfigure \ + dropdb \ + dropuser \ + edquota \ + f77 \ + f95 \ + filebucket \ + freeciv-sdl \ + freeciv-xaw \ + g++ \ + g4 \ + g77 \ + g95 \ + gcj \ + gfortran \ + gkrellm2 \ + gmake \ + gmplayer \ + gnumake \ + gpc \ + hciattach \ + hciconfig \ + hd \ + host \ + hping \ + hping3 \ + identify \ + ifdown \ + ifstatus \ + import \ + insmod.static \ + javac \ + javadoc \ + kplayer \ + l2ping \ + lbzip2 \ + ldapadd \ + ldapcompare \ + ldapdelete \ + ldapmodify \ + ldapmodrdn \ + ldappasswd \ + ldapwhoami \ + lintian-info \ + lusermod \ + lvchange \ + lvcreate \ + lvdisplay \ + lvextend \ + lvmdiskscan \ + lvreduce \ + lvremove \ + lvrename \ + lvresize \ + lvs \ + lvscan \ + lz4c \ + mailsnarf \ + mdecrypt \ + mencoder \ + micropython \ + mkisofs \ + mogrify \ + montage \ + mplayer2 \ + msgsnarf \ + muttng \ + ncal \ + pbzip2 \ + pccardctl \ + pdlzip \ + perldoc \ + phing \ + pigz \ + pinfo \ + ping6 \ + pkg_deinstall \ + pkg_info \ + pkill \ + plzip \ + pm-suspend \ + pm-suspend-hybrid \ + pmake \ + postalias \ + ppc-koji \ + puppetca \ + puppetd \ + puppetdoc \ + puppetmasterd \ + puppetqd \ + puppetrun \ + pvchange \ + pvcreate \ + pvdisplay \ + pvmove \ + pvremove \ + pvs \ + pvscan \ + pxz \ + py.test-2 \ + py.test-3 \ + pydoc3 \ + pypy \ + pypy3 \ + python2 \ + python3 \ + pyvenv-3.4 \ + pyvenv-3.5 \ + qemu-kvm \ + qemu-system-i386 \ + qemu-system-x86_64 \ + quotacheck \ + quotaoff \ + quotaon \ + ralsh \ + rcsdiff \ + rdict \ + repquota \ + rfcomm \ + rlog \ + rpm2targz \ + rpm2txz \ + rpmbuild \ + rpmbuild-md5 \ + s390-koji \ + sbcl-mt \ + scp \ + sdptool \ + setquota \ + sftp \ + sidedoor \ + slogin \ + smbcacls \ + smbcquotas \ + smbget \ + smbpasswd \ + smbtar \ + smbtree \ + sparc-koji \ + spovray \ + star \ + stream \ + sudoedit \ + tightvncviewer \ + tracepath6 \ + typeset \ + vgcfgbackup \ + vgcfgrestore \ + vgchange \ + vgck \ + vgconvert \ + vgcreate \ + vgdisplay \ + vgexport \ + vgextend \ + vgimport \ + vgmerge \ + vgmknodes \ + vgreduce \ + vgremove \ + vgrename \ + vgs \ + vgscan \ + vgsplit \ + vigr \ + whatis \ + xpovray \ + xvnc4viewer \ + ypcat + +symlinks: $(targetdir) $(DATA) + for file in 7za ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) 7z $(targetdir)/$$file ; \ + done + for file in aclocal-1.10 aclocal-1.11 aclocal-1.12 aclocal-1.13 \ + aclocal-1.14 aclocal-1.15 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) aclocal $(targetdir)/$$file ; \ + done + for file in phing ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ant $(targetdir)/$$file ; \ + done + for file in asciidoc.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) asciidoc $(targetdir)/$$file ; \ + done + for file in automake-1.10 automake-1.11 automake-1.12 automake-1.13 \ + automake-1.14 automake-1.15 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) automake $(targetdir)/$$file ; \ + done + for file in autoheader ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoreconf $(targetdir)/$$file ; \ + done + for file in autoupdate ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoscan $(targetdir)/$$file ; \ + done + for file in btdownloadcurses.py btdownloadgui.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) btdownloadheadless.py $(targetdir)/$$file ; \ + done + for file in lbzip2 pbzip2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) bzip2 $(targetdir)/$$file ; \ + done + for file in ncal ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) _cal $(targetdir)/$$file ; \ + done + for file in pccardctl ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cardctl $(targetdir)/$$file ; \ + done + for file in compgen ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) complete $(targetdir)/$$file ; \ + done + for file in mogrify display animate identify montage composite \ + compare conjure import stream ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) convert $(targetdir)/$$file ; \ + done + for file in cowthink ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cowsay $(targetdir)/$$file ; \ + done + for file in rdict ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dict $(targetdir)/$$file ; \ + done + for file in dpkg-deb dpkg-query dpkg-reconfigure ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dpkg $(targetdir)/$$file ; \ + done + for file in mailsnarf msgsnarf ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) filesnarf $(targetdir)/$$file ; \ + done + for file in civclient freeciv-sdl freeciv-xaw ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-gtk2 $(targetdir)/$$file ; \ + done + for file in civserver ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-server $(targetdir)/$$file ; \ + done + for file in declare typeset ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) function $(targetdir)/$$file ; \ + done + for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gcc $(targetdir)/$$file ; \ + done + for file in mkisofs ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) genisoimage $(targetdir)/$$file ; \ + done + for file in gkrellm2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gkrellm $(targetdir)/$$file ; \ + done + for file in pigz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gzip $(targetdir)/$$file ; \ + done + for file in sdptool l2ping rfcomm ciptool dfutool hciconfig \ + hciattach ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hcitool $(targetdir)/$$file ; \ + done + for file in hd ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) _hexdump $(targetdir)/$$file ; \ + done + for file in hping hping3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hping2 $(targetdir)/$$file ; \ + done + for file in ifdown ifstatus ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ifup $(targetdir)/$$file ; \ + done + for file in pinfo ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) info $(targetdir)/$$file ; \ + done + for file in insmod.static ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) insmod $(targetdir)/$$file ; \ + done + for file in javac javadoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) java $(targetdir)/$$file ; \ + done + for file in arm-koji ppc-koji s390-koji sparc-koji ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) koji $(targetdir)/$$file ; \ + done + for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \ + ldapwhoami ldappasswd ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ldapsearch $(targetdir)/$$file ; \ + done + for file in lintian-info ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lintian $(targetdir)/$$file ; \ + done + for file in lusermod ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) luseradd $(targetdir)/$$file ; \ + done + for file in lvmdiskscan pvscan pvs pvdisplay pvchange pvcreate pvmove \ + pvremove vgscan vgs vgdisplay vgchange vgremove vgrename \ + vgreduce vgextend vgimport vgexport vgck vgconvert vgcreate \ + vgcfgbackup vgcfgrestore vgmerge vgsplit vgmknodes lvscan lvs \ + lvdisplay lvchange lvcreate lvremove lvrename lvreduce \ + lvresize lvextend ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lvm $(targetdir)/$$file ; \ + done + for file in lz4c ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lz4 $(targetdir)/$$file ; \ + done + for file in clzip pdlzip plzip ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lzip $(targetdir)/$$file ; \ + done + for file in colormake gmake gnumake pmake ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) make $(targetdir)/$$file ; \ + done + for file in apropos whatis ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) man $(targetdir)/$$file ; \ + done + for file in mdecrypt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mcrypt $(targetdir)/$$file ; \ + done + for file in mplayer2 mencoder gmplayer kplayer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mplayer $(targetdir)/$$file ; \ + done + for file in muttng ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mutt $(targetdir)/$$file ; \ + done + for file in host ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) nslookup $(targetdir)/$$file ; \ + done + for file in g4 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) p4 $(targetdir)/$$file ; \ + done + for file in perldoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) perl $(targetdir)/$$file ; \ + done + for file in alpine ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pine $(targetdir)/$$file ; \ + done + for file in ping6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ping $(targetdir)/$$file ; \ + done + for file in pkg_info pkg_deinstall ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pkg_delete $(targetdir)/$$file ; \ + done + for file in pkill ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pgrep $(targetdir)/$$file ; \ + done + for file in pm-suspend pm-suspend-hybrid ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pm-hibernate $(targetdir)/$$file ; \ + done + for file in createdb createuser dropdb dropuser ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) psql $(targetdir)/$$file ; \ + done + for file in postalias ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) postmap $(targetdir)/$$file ; \ + done + for file in xpovray spovray ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) povray $(targetdir)/$$file ; \ + done + for file in puppetmasterd puppetd puppetca ralsh puppetrun puppetqd \ + filebucket puppetdoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) puppet $(targetdir)/$$file ; \ + done + for file in py.test-2 py.test-3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) py.test $(targetdir)/$$file ; \ + done + for file in pydoc3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pydoc $(targetdir)/$$file ; \ + done + for file in pypy pypy3 python2 python3 micropython ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) python $(targetdir)/$$file ; \ + done + for file in pyvenv-3.4 pyvenv-3.5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pyvenv $(targetdir)/$$file ; \ + done + for file in dcop ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qdbus $(targetdir)/$$file ; \ + done + for file in qemu-kvm qemu-system-i386 qemu-system-x86_64 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qemu $(targetdir)/$$file ; \ + done + for file in setquota edquota quotacheck repquota quotaon quotaoff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) quota $(targetdir)/$$file ; \ + done + for file in ci co rlog rcsdiff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rcs $(targetdir)/$$file ; \ + done + for file in rpmbuild rpmbuild-md5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm $(targetdir)/$$file ; \ + done + for file in rpm2txz rpm2targz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm2tgz $(targetdir)/$$file ; \ + done + for file in smbget smbcacls smbcquotas smbpasswd smbtar smbtree ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) smbclient $(targetdir)/$$file ; \ + done + for file in sbcl-mt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sbcl $(targetdir)/$$file ; \ + done + for file in slogin autossh sftp scp sidedoor ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ssh $(targetdir)/$$file ; \ + done + for file in sudoedit ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sudo $(targetdir)/$$file ; \ + done + for file in tracepath6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) tracepath $(targetdir)/$$file ; \ + done + for file in alternatives ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) update-alternatives $(targetdir)/$$file ; \ + done + for file in vigr ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vipw $(targetdir)/$$file ; \ + done + for file in tightvncviewer xvnc4viewer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vncviewer $(targetdir)/$$file ; \ + done + for file in cdrecord ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) wodim $(targetdir)/$$file ; \ + done + for file in pxz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) xz $(targetdir)/$$file ; \ + done + for file in ypcat ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ypmatch $(targetdir)/$$file ; \ + done +.PHONY: symlinks + +all-local: targetdir = . +all-local: symlinks + +install-data-local: targetdir = $(DESTDIR)$(bashcompdir) +install-data-local: symlinks + +check-local: + ret=0 + for file in $(bashcomp_DATA) ; do \ + $${bashcomp_bash:-$${BASH:-bash}} \ + -O extglob -n $$file || ret=$$? ; \ + done ; \ + exit $$ret diff --git a/completions/Makefile.in b/completions/Makefile.in new file mode 100644 index 0000000..0529fb7 --- /dev/null +++ b/completions/Makefile.in @@ -0,0 +1,1413 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = completions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bashcompdir)" +DATA = $(bashcomp_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +compatdir = @compatdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +bashcompdir = $(pkgdatadir)/completions +bashcomp_DATA = 2to3 \ + 7z \ + a2x \ + abook \ + aclocal \ + acpi \ + adb \ + add_members \ + alias \ + ant \ + apache2ctl \ + appdata-validate \ + apt-build \ + apt-cache \ + apt-get \ + aptitude \ + arch \ + arping \ + arpspoof \ + asciidoc \ + aspell \ + autoconf \ + automake \ + autoreconf \ + autorpm \ + autoscan \ + avctrl \ + badblocks \ + bind \ + bk \ + brctl \ + btdownloadheadless.py \ + bts \ + bzip2 \ + _cal \ + cancel \ + cardctl \ + ccache \ + cfagent \ + cfrun \ + chage \ + change_pw \ + check_db \ + check_perms \ + checksec \ + _chfn \ + chgrp \ + chkconfig \ + chown \ + chpasswd \ + chronyc \ + chrpath \ + _chsh \ + cksfv \ + cleanarch \ + clisp \ + clone_member \ + complete \ + config_list \ + configure \ + convert \ + cowsay \ + cpan2dist \ + cpio \ + cppcheck \ + crontab \ + cryptsetup \ + curl \ + cvs \ + cvsps \ + dd \ + deja-dup \ + desktop-file-validate \ + dhclient \ + dict \ + _dmesg \ + dnsspoof \ + dot \ + dpkg \ + dpkg-source \ + dselect \ + dsniff \ + dumpdb \ + dumpe2fs \ + e2freefrag \ + e2label \ + _eject \ + eog \ + ether-wake \ + evince \ + explodepkg \ + export \ + faillog \ + fbgs \ + fbi \ + feh \ + file \ + file-roller \ + filefrag \ + filesnarf \ + find \ + find_member \ + flake8 \ + freebsd-update \ + freeciv-gtk2 \ + freeciv-server \ + function \ + fusermount \ + gcc \ + gcl \ + gdb \ + genaliases \ + gendiff \ + genisoimage \ + getent \ + gkrellm \ + gm \ + gnatmake \ + gnokii \ + gnome-mplayer \ + gpasswd \ + gpg \ + gpg2 \ + gphoto2 \ + gprof \ + groupadd \ + groupdel \ + groupmems \ + groupmod \ + growisofs \ + grpck \ + gzip \ + hcitool \ + hddtemp \ + _hexdump \ + hid2hci \ + hostname \ + hping2 \ + htop \ + htpasswd \ + _hwclock \ + iconv \ + id \ + idn \ + iftop \ + ifup \ + info \ + inject \ + insmod \ + installpkg \ + interdiff \ + invoke-rc.d \ + _ionice \ + ip \ + iperf \ + ipmitool \ + ipsec \ + iptables \ + ipv6calc \ + iscsiadm \ + isql \ + iwconfig \ + iwlist \ + iwpriv \ + iwspy \ + jar \ + jarsigner \ + java \ + javaws \ + jpegoptim \ + jps \ + jshint \ + k3b \ + kcov \ + kill \ + killall \ + kldload \ + kldunload \ + koji \ + ktutil \ + larch \ + lastlog \ + ldapsearch \ + ldapvi \ + lftp \ + lftpget \ + lilo \ + links \ + lintian \ + lisp \ + list_admins \ + list_lists \ + list_members \ + list_owners \ + _look \ + lpq \ + lpr \ + lrzip \ + lsof \ + lua \ + luac \ + luseradd \ + luserdel \ + lvm \ + lz4 \ + lzip \ + lzma \ + lzop \ + macof \ + mailmanctl \ + make \ + makepkg \ + man \ + mc \ + mcrypt \ + mdadm \ + mdtool \ + medusa \ + mii-diag \ + mii-tool \ + minicom \ + mkinitrd \ + mktemp \ + mmsitepass \ + _mock \ + modinfo \ + modprobe \ + _modules \ + monodevelop \ + mount \ + mount.linux \ + mplayer \ + mr \ + msynctool \ + mtx \ + munindoc \ + munin-node-configure \ + munin-run \ + munin-update \ + mussh \ + mutt \ + mysql \ + mysqladmin \ + nc \ + ncftp \ + nethogs \ + _newgrp \ + newlist \ + newusers \ + ngrep \ + nmap \ + _nmcli \ + nslookup \ + ntpdate \ + openssl \ + opera \ + optipng \ + p4 \ + pack200 \ + passwd \ + patch \ + pdftotext \ + perl \ + pgrep \ + pidof \ + pine \ + ping \ + pkg-config \ + pkg-get \ + pkg_delete \ + pkgadd \ + pkgrm \ + pkgtool \ + pkgutil \ + plague-client \ + pm-hibernate \ + pm-is-supported \ + pm-powersave \ + pngfix \ + portinstall \ + portsnap \ + portupgrade \ + postcat \ + postconf \ + postfix \ + postmap \ + postsuper \ + povray \ + prelink \ + protoc \ + psql \ + puppet \ + pwck \ + pwd \ + pwdx \ + pwgen \ + py.test \ + pydoc \ + pyflakes \ + pylint \ + python \ + pyvenv \ + qdbus \ + qemu \ + qrunner \ + querybts \ + quota \ + rcs \ + rdesktop \ + remove_members \ + removepkg \ + _renice \ + _repomanage \ + reportbug \ + _reptyr \ + resolvconf \ + rfkill \ + ri \ + rmlist \ + rmmod \ + route \ + rpcdebug \ + rpm \ + rpm2tgz \ + rpmcheck \ + rrdtool \ + rsync \ + _rtcwake \ + _runuser \ + sbcl \ + sbopkg \ + screen \ + sh \ + sitecopy \ + slackpkg \ + slapt-get \ + slapt-src \ + smartctl \ + smbclient \ + snownews \ + sqlite3 \ + ss \ + ssh \ + ssh-add \ + ssh-copy-id \ + ssh-keygen \ + sshfs \ + sshmitm \ + sshow \ + strace \ + strings \ + _su \ + sudo \ + svcadm \ + svk \ + _svn \ + _svnadmin \ + _svnlook \ + sync_members \ + synclient \ + sysbench \ + sysctl \ + tar \ + tcpdump \ + tcpkill \ + tcpnice \ + timeout \ + tipc \ + tracepath \ + tshark \ + tune2fs \ + _udevadm \ + umount \ + umount.linux \ + unace \ + unpack200 \ + unrar \ + unshunt \ + update-alternatives \ + update-rc.d \ + upgradepkg \ + urlsnarf \ + useradd \ + userdel \ + usermod \ + valgrind \ + vipw \ + vmstat \ + vncviewer \ + vpnc \ + watch \ + webmitm \ + wget \ + wine \ + withlist \ + wodim \ + wol \ + _write \ + wsimport \ + wtf \ + wvdial \ + xfreerdp \ + xgamma \ + xhost \ + xm \ + xmllint \ + xmlwf \ + xmms \ + xmodmap \ + xrandr \ + xrdb \ + xsltproc \ + xxd \ + xz \ + xzdec \ + ypmatch \ + _yum \ + yum-arch \ + zopfli \ + zopflipng + +EXTRA_DIST = $(bashcomp_DATA) +CLEANFILES = \ + 7za \ + aclocal-1.10 \ + aclocal-1.11 \ + aclocal-1.12 \ + aclocal-1.13 \ + aclocal-1.14 \ + aclocal-1.15 \ + alpine \ + alternatives \ + animate \ + apropos \ + arm-koji \ + asciidoc.py \ + autoheader \ + automake-1.10 \ + automake-1.11 \ + automake-1.12 \ + automake-1.13 \ + automake-1.14 \ + automake-1.15 \ + autossh \ + autoupdate \ + bsdtar \ + btdownloadcurses.py \ + btdownloadgui.py \ + c++ \ + cc \ + cdrecord \ + ci \ + ciptool \ + civclient \ + civserver \ + clzip \ + co \ + colormake \ + compare \ + compgen \ + composite \ + conjure \ + cowthink \ + createdb \ + createuser \ + dcop \ + declare \ + dfutool \ + display \ + dpkg-deb \ + dpkg-query \ + dpkg-reconfigure \ + dropdb \ + dropuser \ + edquota \ + f77 \ + f95 \ + filebucket \ + freeciv-sdl \ + freeciv-xaw \ + g++ \ + g4 \ + g77 \ + g95 \ + gcj \ + gfortran \ + gkrellm2 \ + gmake \ + gmplayer \ + gnumake \ + gpc \ + hciattach \ + hciconfig \ + hd \ + host \ + hping \ + hping3 \ + identify \ + ifdown \ + ifstatus \ + import \ + insmod.static \ + javac \ + javadoc \ + kplayer \ + l2ping \ + lbzip2 \ + ldapadd \ + ldapcompare \ + ldapdelete \ + ldapmodify \ + ldapmodrdn \ + ldappasswd \ + ldapwhoami \ + lintian-info \ + lusermod \ + lvchange \ + lvcreate \ + lvdisplay \ + lvextend \ + lvmdiskscan \ + lvreduce \ + lvremove \ + lvrename \ + lvresize \ + lvs \ + lvscan \ + lz4c \ + mailsnarf \ + mdecrypt \ + mencoder \ + micropython \ + mkisofs \ + mogrify \ + montage \ + mplayer2 \ + msgsnarf \ + muttng \ + ncal \ + pbzip2 \ + pccardctl \ + pdlzip \ + perldoc \ + phing \ + pigz \ + pinfo \ + ping6 \ + pkg_deinstall \ + pkg_info \ + pkill \ + plzip \ + pm-suspend \ + pm-suspend-hybrid \ + pmake \ + postalias \ + ppc-koji \ + puppetca \ + puppetd \ + puppetdoc \ + puppetmasterd \ + puppetqd \ + puppetrun \ + pvchange \ + pvcreate \ + pvdisplay \ + pvmove \ + pvremove \ + pvs \ + pvscan \ + pxz \ + py.test-2 \ + py.test-3 \ + pydoc3 \ + pypy \ + pypy3 \ + python2 \ + python3 \ + pyvenv-3.4 \ + pyvenv-3.5 \ + qemu-kvm \ + qemu-system-i386 \ + qemu-system-x86_64 \ + quotacheck \ + quotaoff \ + quotaon \ + ralsh \ + rcsdiff \ + rdict \ + repquota \ + rfcomm \ + rlog \ + rpm2targz \ + rpm2txz \ + rpmbuild \ + rpmbuild-md5 \ + s390-koji \ + sbcl-mt \ + scp \ + sdptool \ + setquota \ + sftp \ + sidedoor \ + slogin \ + smbcacls \ + smbcquotas \ + smbget \ + smbpasswd \ + smbtar \ + smbtree \ + sparc-koji \ + spovray \ + star \ + stream \ + sudoedit \ + tightvncviewer \ + tracepath6 \ + typeset \ + vgcfgbackup \ + vgcfgrestore \ + vgchange \ + vgck \ + vgconvert \ + vgcreate \ + vgdisplay \ + vgexport \ + vgextend \ + vgimport \ + vgmerge \ + vgmknodes \ + vgreduce \ + vgremove \ + vgrename \ + vgs \ + vgscan \ + vgsplit \ + vigr \ + whatis \ + xpovray \ + xvnc4viewer \ + ypcat + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign completions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign completions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-bashcompDATA: $(bashcomp_DATA) + @$(NORMAL_INSTALL) + @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bashcompdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompdir)" || exit $$?; \ + done + +uninstall-bashcompDATA: + @$(NORMAL_UNINSTALL) + @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(bashcompdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(DATA) all-local +installdirs: + for dir in "$(DESTDIR)$(bashcompdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-bashcompDATA install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-bashcompDATA + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am all-local check check-am check-local clean \ + clean-generic cscopelist-am ctags-am distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-bashcompDATA install-data \ + install-data-am install-data-local install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am \ + uninstall-bashcompDATA + +.PRECIOUS: Makefile + + +symlinks: $(targetdir) $(DATA) + for file in 7za ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) 7z $(targetdir)/$$file ; \ + done + for file in aclocal-1.10 aclocal-1.11 aclocal-1.12 aclocal-1.13 \ + aclocal-1.14 aclocal-1.15 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) aclocal $(targetdir)/$$file ; \ + done + for file in phing ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ant $(targetdir)/$$file ; \ + done + for file in asciidoc.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) asciidoc $(targetdir)/$$file ; \ + done + for file in automake-1.10 automake-1.11 automake-1.12 automake-1.13 \ + automake-1.14 automake-1.15 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) automake $(targetdir)/$$file ; \ + done + for file in autoheader ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoreconf $(targetdir)/$$file ; \ + done + for file in autoupdate ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoscan $(targetdir)/$$file ; \ + done + for file in btdownloadcurses.py btdownloadgui.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) btdownloadheadless.py $(targetdir)/$$file ; \ + done + for file in lbzip2 pbzip2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) bzip2 $(targetdir)/$$file ; \ + done + for file in ncal ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) _cal $(targetdir)/$$file ; \ + done + for file in pccardctl ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cardctl $(targetdir)/$$file ; \ + done + for file in compgen ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) complete $(targetdir)/$$file ; \ + done + for file in mogrify display animate identify montage composite \ + compare conjure import stream ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) convert $(targetdir)/$$file ; \ + done + for file in cowthink ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cowsay $(targetdir)/$$file ; \ + done + for file in rdict ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dict $(targetdir)/$$file ; \ + done + for file in dpkg-deb dpkg-query dpkg-reconfigure ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dpkg $(targetdir)/$$file ; \ + done + for file in mailsnarf msgsnarf ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) filesnarf $(targetdir)/$$file ; \ + done + for file in civclient freeciv-sdl freeciv-xaw ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-gtk2 $(targetdir)/$$file ; \ + done + for file in civserver ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-server $(targetdir)/$$file ; \ + done + for file in declare typeset ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) function $(targetdir)/$$file ; \ + done + for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gcc $(targetdir)/$$file ; \ + done + for file in mkisofs ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) genisoimage $(targetdir)/$$file ; \ + done + for file in gkrellm2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gkrellm $(targetdir)/$$file ; \ + done + for file in pigz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gzip $(targetdir)/$$file ; \ + done + for file in sdptool l2ping rfcomm ciptool dfutool hciconfig \ + hciattach ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hcitool $(targetdir)/$$file ; \ + done + for file in hd ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) _hexdump $(targetdir)/$$file ; \ + done + for file in hping hping3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hping2 $(targetdir)/$$file ; \ + done + for file in ifdown ifstatus ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ifup $(targetdir)/$$file ; \ + done + for file in pinfo ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) info $(targetdir)/$$file ; \ + done + for file in insmod.static ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) insmod $(targetdir)/$$file ; \ + done + for file in javac javadoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) java $(targetdir)/$$file ; \ + done + for file in arm-koji ppc-koji s390-koji sparc-koji ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) koji $(targetdir)/$$file ; \ + done + for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \ + ldapwhoami ldappasswd ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ldapsearch $(targetdir)/$$file ; \ + done + for file in lintian-info ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lintian $(targetdir)/$$file ; \ + done + for file in lusermod ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) luseradd $(targetdir)/$$file ; \ + done + for file in lvmdiskscan pvscan pvs pvdisplay pvchange pvcreate pvmove \ + pvremove vgscan vgs vgdisplay vgchange vgremove vgrename \ + vgreduce vgextend vgimport vgexport vgck vgconvert vgcreate \ + vgcfgbackup vgcfgrestore vgmerge vgsplit vgmknodes lvscan lvs \ + lvdisplay lvchange lvcreate lvremove lvrename lvreduce \ + lvresize lvextend ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lvm $(targetdir)/$$file ; \ + done + for file in lz4c ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lz4 $(targetdir)/$$file ; \ + done + for file in clzip pdlzip plzip ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lzip $(targetdir)/$$file ; \ + done + for file in colormake gmake gnumake pmake ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) make $(targetdir)/$$file ; \ + done + for file in apropos whatis ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) man $(targetdir)/$$file ; \ + done + for file in mdecrypt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mcrypt $(targetdir)/$$file ; \ + done + for file in mplayer2 mencoder gmplayer kplayer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mplayer $(targetdir)/$$file ; \ + done + for file in muttng ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mutt $(targetdir)/$$file ; \ + done + for file in host ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) nslookup $(targetdir)/$$file ; \ + done + for file in g4 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) p4 $(targetdir)/$$file ; \ + done + for file in perldoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) perl $(targetdir)/$$file ; \ + done + for file in alpine ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pine $(targetdir)/$$file ; \ + done + for file in ping6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ping $(targetdir)/$$file ; \ + done + for file in pkg_info pkg_deinstall ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pkg_delete $(targetdir)/$$file ; \ + done + for file in pkill ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pgrep $(targetdir)/$$file ; \ + done + for file in pm-suspend pm-suspend-hybrid ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pm-hibernate $(targetdir)/$$file ; \ + done + for file in createdb createuser dropdb dropuser ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) psql $(targetdir)/$$file ; \ + done + for file in postalias ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) postmap $(targetdir)/$$file ; \ + done + for file in xpovray spovray ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) povray $(targetdir)/$$file ; \ + done + for file in puppetmasterd puppetd puppetca ralsh puppetrun puppetqd \ + filebucket puppetdoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) puppet $(targetdir)/$$file ; \ + done + for file in py.test-2 py.test-3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) py.test $(targetdir)/$$file ; \ + done + for file in pydoc3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pydoc $(targetdir)/$$file ; \ + done + for file in pypy pypy3 python2 python3 micropython ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) python $(targetdir)/$$file ; \ + done + for file in pyvenv-3.4 pyvenv-3.5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pyvenv $(targetdir)/$$file ; \ + done + for file in dcop ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qdbus $(targetdir)/$$file ; \ + done + for file in qemu-kvm qemu-system-i386 qemu-system-x86_64 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qemu $(targetdir)/$$file ; \ + done + for file in setquota edquota quotacheck repquota quotaon quotaoff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) quota $(targetdir)/$$file ; \ + done + for file in ci co rlog rcsdiff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rcs $(targetdir)/$$file ; \ + done + for file in rpmbuild rpmbuild-md5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm $(targetdir)/$$file ; \ + done + for file in rpm2txz rpm2targz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm2tgz $(targetdir)/$$file ; \ + done + for file in smbget smbcacls smbcquotas smbpasswd smbtar smbtree ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) smbclient $(targetdir)/$$file ; \ + done + for file in sbcl-mt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sbcl $(targetdir)/$$file ; \ + done + for file in slogin autossh sftp scp sidedoor ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ssh $(targetdir)/$$file ; \ + done + for file in sudoedit ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sudo $(targetdir)/$$file ; \ + done + for file in tracepath6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) tracepath $(targetdir)/$$file ; \ + done + for file in alternatives ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) update-alternatives $(targetdir)/$$file ; \ + done + for file in vigr ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vipw $(targetdir)/$$file ; \ + done + for file in tightvncviewer xvnc4viewer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vncviewer $(targetdir)/$$file ; \ + done + for file in cdrecord ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) wodim $(targetdir)/$$file ; \ + done + for file in pxz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) xz $(targetdir)/$$file ; \ + done + for file in ypcat ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ypmatch $(targetdir)/$$file ; \ + done +.PHONY: symlinks + +all-local: targetdir = . +all-local: symlinks + +install-data-local: targetdir = $(DESTDIR)$(bashcompdir) +install-data-local: symlinks + +check-local: + ret=0 + for file in $(bashcomp_DATA) ; do \ + $${bashcomp_bash:-$${BASH:-bash}} \ + -O extglob -n $$file || ret=$$? ; \ + done ; \ + exit $$ret + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/completions/_cal b/completions/_cal new file mode 100644 index 0000000..dfe4990 --- /dev/null +++ b/completions/_cal @@ -0,0 +1,37 @@ +# cal(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_cal() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -m) + if [[ $OSTYPE == *bsd* ]]; then + COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) + return + fi + ;; + -s) + [[ $OSTYPE == *bsd* ]] && return + ;; + -A|-B|-d|-H) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + local args + _count_args + [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) +} && +complete -F _cal cal ncal + +# ex: filetype=sh diff --git a/completions/_chfn b/completions/_chfn new file mode 100644 index 0000000..334967f --- /dev/null +++ b/completions/_chfn @@ -0,0 +1,8 @@ +# chfn(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u chfn + +# ex: filetype=sh diff --git a/completions/_chsh b/completions/_chsh new file mode 100644 index 0000000..88e8522 --- /dev/null +++ b/completions/_chsh @@ -0,0 +1,30 @@ +# chsh(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_chsh() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --list-shells|--help|-v|--version) + return + ;; + -s|--shell) + _shells + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + else + _allowed_users + fi + +} && +complete -F _chsh chsh + +# ex: filetype=sh diff --git a/completions/_dmesg b/completions/_dmesg new file mode 100644 index 0000000..2ca7fdf --- /dev/null +++ b/completions/_dmesg @@ -0,0 +1,34 @@ +# dmesg(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_dmesg() +{ + [[ $OSTYPE == *solaris* ]] && return # no args there + + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-s|--buffer-size|-M|-N) + return + ;; + -f|--facility) + COMPREPLY=( $( compgen -W 'kern user mail daemon auth syslog lpr + news' -- "$cur" ) ) + return + ;; + -l|--level|-n|--console-level) + COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) + return + ;; + esac + + local opts=$( _parse_help "$1" ) + [[ $opts ]] || opts=$( _parse_usage "$1" ) + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) +} && +complete -F _dmesg dmesg + +# ex: filetype=sh diff --git a/completions/_eject b/completions/_eject new file mode 100644 index 0000000..8f800f1 --- /dev/null +++ b/completions/_eject @@ -0,0 +1,33 @@ +# bash completion for eject(1) -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_eject() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-c|--changerslot|-x|--cdspeed) + return + ;; + -a|--auto|-i|--manualeject) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + elif [[ $prev == @(-d|--default) ]]; then + return + fi + + _cd_devices + _dvd_devices +} && +complete -F _eject eject + +# ex: filetype=sh diff --git a/completions/_hexdump b/completions/_hexdump new file mode 100644 index 0000000..ed5cb08 --- /dev/null +++ b/completions/_hexdump @@ -0,0 +1,32 @@ +# hexdump(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_hexdump() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -V|-e|-n|-s) + return + ;; + -f) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + local opts="$( _parse_help "$1" )" + [[ $opts ]] || opts="$( _parse_usage "$1" )" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _hexdump hexdump hd + +# ex: filetype=sh diff --git a/completions/_hwclock b/completions/_hwclock new file mode 100644 index 0000000..2d19028 --- /dev/null +++ b/completions/_hwclock @@ -0,0 +1,26 @@ +# hwclock(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_hwclock() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|--date|--epoch) + return + ;; + -f|--rtc|--adjfile) + _filedir + return + ;; + esac + + COMPREPLY=( + $( PATH="$PATH:/sbin" compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _hwclock hwclock + +# ex: filetype=sh diff --git a/completions/_ionice b/completions/_ionice new file mode 100644 index 0000000..9b378ee --- /dev/null +++ b/completions/_ionice @@ -0,0 +1,60 @@ +# ionice(1) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_ionice() +{ + local cur prev words cword + _init_completion || return + + local offset=0 i + for (( i=1; i <= cword; i++ )); do + case ${words[i]} in + -h) + return + ;; + -p) + offset=0 + break + ;; + -c|-n) + (( i++ )) + continue + ;; + -*) + continue + ;; + esac + offset=$i + break + done + + if [[ $offset -gt 0 ]]; then + _command_offset $offset + return + fi + + case $prev in + -c) + COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + return + ;; + -n) + COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + return + ;; + -p) + _pids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + return + fi +} && +complete -F _ionice ionice + +# ex: filetype=sh diff --git a/completions/_look b/completions/_look new file mode 100644 index 0000000..6ea41cc --- /dev/null +++ b/completions/_look @@ -0,0 +1,17 @@ +# look(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_look() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) + fi +} && +complete -F _look -o default look + +# ex: filetype=sh diff --git a/completions/_mock b/completions/_mock new file mode 100644 index 0000000..9649d30 --- /dev/null +++ b/completions/_mock @@ -0,0 +1,69 @@ +# bash completion for mock -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# mock > 1.1.0, use that instead. + +_mock() +{ + local cur prev words cword split + _init_completion -s || return + + local plugins='tmpfs root_cache yum_cache bind_mount ccache' + local cfgdir=/etc/mock count=0 i + + for i in "${words[@]}" ; do + [[ $count -eq $cword ]] && break + if [[ "$i" == --configdir ]] ; then + cfgdir="${words[((count+1))]}" + elif [[ "$i" == --configdir=* ]] ; then + cfgdir=${i/*=/} + fi + count=$((++count)) + done + + case $prev in + -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\ + --uniqueext|--rpmbuild_timeout|--sources|--cwd) + return + ;; + -r|--root) + COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- "$cur" ) ) + COMPREPLY=( ${COMPREPLY[@]/%.cfg/} ) + return + ;; + --configdir|--resultdir) + _filedir -d + return + ;; + --spec) + _filedir spec + return + ;; + --target) + # Yep, compatible archs, not compatible build archs + # (e.g. ix86 chroot builds in x86_64 mock host) + # This would actually depend on what the target root + # can be used to build for... + COMPREPLY=( $( compgen -W "$( command rpm --showrc | \ + command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ + -- "$cur" ) ) + return + ;; + --enable-plugin|--disable-plugin) + COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir '@(?(no)src.r|s)pm' + fi +} && +complete -F _mock mock + +# ex: filetype=sh diff --git a/completions/_modules b/completions/_modules new file mode 100644 index 0000000..9e48589 --- /dev/null +++ b/completions/_modules @@ -0,0 +1,84 @@ +# module completion by Ted Stern -*- shell-script -*- +# +# Use of this file is deprecated, upstream completion is available in +# modules >= 3.2.7, use that instead. +# +# Completion for Environment Modules `module' alias. +# +# See http://sourceforge.net/projects/modules/ +# http://modules.sourceforge.net/ +# +# There are several versions of modules that are commonly used. Older +# Cray UNICOS systems and many other sites use 2.2.2b. The latest GPL'd +# version is 3.1.6. But the module alias is somewhat self-documenting +# via the `module help' command, so use that to print the options. +# +# Programmable completion might be more difficult under tcsh since the +# module command is an alias, and the `module avail' command returns +# its output as stderr. + +# Test for existence of /etc/profile.d/modules.sh too because we may end up +# being sourced before it and thus before the `module' alias has been defined. +[ -f /etc/profile.d/modules.sh ] || return 1 + +_module_list () +{ + local modules="$( command sed 's/:/ /g' <<<$LOADEDMODULES | sort )" + compgen -W "$modules" -- $1 +} + +_module_path () +{ + local modules="$( command sed 's/:/ /g' <<<$MODULEPATH | sort )" + compgen -W "$modules" -- $1 +} + +_module_avail () +{ + local modules="$( \ + module avail 2>&1 | \ + command grep -E -v '^(-|$)' | \ + xargs printf '%s\n' | command sed -e 's/(default)//g' | sort )" + + compgen -W "$modules" -- $1 +} + +# A completion function for the module alias +_module () +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + # First parameter on line -- we expect it to be a mode selection + + local options + options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \ + awk '{print $2}' | command sed -e 's/|/ /g' | sort )" + + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) + + elif [[ $cword -eq 2 ]]; then + case $prev in + add|display|help|load|show|whatis) + COMPREPLY=( $(_module_avail "$cur") ) + ;; + rm|switch|swap|unload|update) + COMPREPLY=( $(_module_list "$cur") ) + ;; + unuse) + COMPREPLY=( $(_module_path "$cur") ) + ;; + esac + elif [[ $cword -eq 3 ]]; then + case ${words[1]} in + swap|switch) + COMPREPLY=( $(_module_avail "$cur") ) + ;; + esac + fi + +} && +complete -F _module -o default module + +# ex: filetype=sh diff --git a/completions/_newgrp b/completions/_newgrp new file mode 100644 index 0000000..0f0d3f9 --- /dev/null +++ b/completions/_newgrp @@ -0,0 +1,19 @@ +# newgrp(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_newgrp() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == "-" ]]; then + COMPREPLY=( - ) + else + _allowed_groups "$cur" + fi +} && +complete -F _newgrp newgrp + +# ex: filetype=sh diff --git a/completions/_nmcli b/completions/_nmcli new file mode 100644 index 0000000..f77f050 --- /dev/null +++ b/completions/_nmcli @@ -0,0 +1,201 @@ +# nmcli completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# NetworkManager >= 0.9.8.0, use that instead. + +_nmcli_list() +{ + COMPREPLY=( $( compgen -W '$1' -- "$cur" ) ) +} + +_nmcli_con_id() +{ + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1 }')" -- "$cur" ) ) +} + +_nmcli_con_uuid() +{ + COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) +} + +_nmcli_ap_ssid() +{ + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1}')" -- "$cur" ) ) +} + +_nmcli_ab_bssid() +{ + COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) +} + +_nmcli() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -m|--mode) + COMPREPLY=( $( compgen -W 'tabular multiline' -- "$cur" ) ) + return + ;; + -f|--fields) + COMPREPLY=( $( compgen -W 'all common' -- "$cur" ) ) + return + ;; + -e|--escape) + _nmcli_list "yes no" + return + ;; + id) + _nmcli_con_id + return + ;; + uuid) + _nmcli_con_uuid + return + ;; + iface) + _available_interfaces + return + ;; + bssid) + _nmcli_ab_bssid + return + ;; + wep-key-type) + _nmcli_list "key phrase" + return + ;; + esac + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--terse --pretty --mode --fields + --escape --version --help' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "nm con dev" -- "$cur" ) ) + fi + else + local object=${words[1]} + local command=${words[2]} + + case $object in + nm) + case $command in + enable) + _nmcli_list "true false" + return + ;; + sleep) + _nmcli_list "true false" + return + ;; + wifi) + _nmcli_list "on off" + return + ;; + wwan) + _nmcli_list "on off" + return + ;; + wimax) + _nmcli_list "on off" + return + ;; + esac + + COMPREPLY=( $( compgen -W 'status permissions enable sleep + wifi wwan wimax' -- "$cur" ) ) + ;; + con) + case $command in + list) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + up) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nowait --timeout' \ + -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'id uuid iface ap nsp' \ + -- "$cur" ) ) + fi + return + ;; + down) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + delete) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + esac + + COMPREPLY=( $( compgen -W 'list status up down delete' \ + -- "$cur" ) ) + ;; + dev) + case $command in + list) + COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + return + ;; + disconnect) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nowait --timeout' \ + -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + fi + return + ;; + wifi) + local subcommand=${words[3]} + + case $subcommand in + list) + COMPREPLY=( $( compgen -W 'iface bssid' \ + -- "$cur" ) ) + return + ;; + connect) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--private + --nowait --timeout' -- "$cur" ) ) + else + if [[ "$prev" == "connect" ]]; then + _nmcli_ap_ssid + else + COMPREPLY=( $( compgen -W 'password + wep-key-type iface bssid name' \ + -- "$cur" ) ) + fi + fi + return + ;; + esac + + COMPREPLY=( $( compgen -W 'list connect' -- "$cur" ) ) + return + ;; + esac + + COMPREPLY=( $( compgen -W 'status list disconnect wifi' \ + -- "$cur" ) ) + ;; + esac + + fi + +} && +complete -F _nmcli nmcli + +# ex: filetype=sh diff --git a/completions/_renice b/completions/_renice new file mode 100644 index 0000000..1f1a610 --- /dev/null +++ b/completions/_renice @@ -0,0 +1,32 @@ +# renice(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_renice() +{ + local cur prev words cword + _init_completion || return + + local command=$1 curopt i=0 + + # walk back through command line and find last option + while [[ $i -le $cword && ${#COMPREPLY[@]} -eq 0 ]]; do + curopt=${words[cword-$i]} + case "$curopt" in + -u) + _allowed_users + ;; + -g) + _pgids + ;; + -p|$command) + _pids + ;; + esac + i=$(( ++i )) + done +} && +complete -F _renice renice + +# ex: filetype=sh diff --git a/completions/_repomanage b/completions/_repomanage new file mode 100644 index 0000000..c1072e7 --- /dev/null +++ b/completions/_repomanage @@ -0,0 +1,24 @@ +# bash completion for repomanage -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# yum-utils >= 1.1.24, use that instead. + +_repomanage() +{ + local cur prev words cword split + _init_completion -s || return + + [[ "$prev" == -@([hk]|-help|-keep) ]] && return + + $split && return + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir -d + fi +} && +complete -F _repomanage repomanage + +# ex: filetype=sh diff --git a/completions/_reptyr b/completions/_reptyr new file mode 100644 index 0000000..4a087b4 --- /dev/null +++ b/completions/_reptyr @@ -0,0 +1,26 @@ +# bash completion for reptyr(1) -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# reptyr > 0.6.2, use that instead. + +_reptyr() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + [[ $prev != +([0-9]) ]] && _pids +} && +complete -F _reptyr reptyr + +# ex: filetype=sh diff --git a/completions/_rtcwake b/completions/_rtcwake new file mode 100644 index 0000000..b03c124 --- /dev/null +++ b/completions/_rtcwake @@ -0,0 +1,32 @@ +# bash completion for rtcwake -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_rtcwake() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V|--seconds|-s|--time|-t) + return + ;; + --mode|-m) + COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) ) + return + ;; + --device|-d) + COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _rtcwake rtcwake + +# ex: filetype=sh diff --git a/completions/_runuser b/completions/_runuser new file mode 100644 index 0000000..95cf930 --- /dev/null +++ b/completions/_runuser @@ -0,0 +1,8 @@ +# runuser(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u runuser + +# ex: filetype=sh diff --git a/completions/_su b/completions/_su new file mode 100644 index 0000000..2b06949 --- /dev/null +++ b/completions/_su @@ -0,0 +1,41 @@ +# bash completion for su(1) -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +if [[ $OSTYPE != *linux* ]]; then + complete -u su # default completion + return +fi + +_su() # linux-specific completion +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -s|--shell) + _shells + return + ;; + -c|--command|--session-command) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _su su + +# ex: filetype=sh diff --git a/completions/_svn b/completions/_svn new file mode 100644 index 0000000..37b6b2b --- /dev/null +++ b/completions/_svn @@ -0,0 +1,212 @@ +# svn completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svn() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='add blame praise annotate ann cat checkout co cleanup commit \ + ci copy cp delete del remove rm diff di export help ? h import \ + info list ls lock log merge mkdir move mv rename ren \ + propdel pdel pd propedit pedit pe propget pget pg \ + proplist plist pl propset pset ps resolved revert \ + status stat st switch sw unlock update up' + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + fi + else + + case $prev in + --config-dir) + _filedir -d + return + ;; + -F|--file|--targets) + _filedir + return + ;; + --encoding) + COMPREPLY=( $( compgen -W '$( iconv --list | \ + command sed -e "s@//@@;" )' -- "$cur" ) ) + return + ;; + --editor-cmd|--diff-cmd|--diff3-cmd) + words=(words[0] $cur) + cword=1 + _command + return + ;; + esac + + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + add) + options='--auto-props --no-auto-props --force --targets + --no-ignore --non-recursive --quiet' + ;; + blame|annotate|ann|praise) + options='--revision --username --password --no-auth-cache + --non-interactive --verbose --incremental --xml' + ;; + cat) + options='--revision --username --password --no-auth-cache + --non-interactive' + ;; + checkout|co) + options='--revision --quiet --non-recursive --username + --password --no-auth-cache --non-interactive + --ignore-externals' + ;; + cleanup) + options='--diff3-cmd' + ;; + commit|ci) + options='--message --file --encoding --force-log --quiet + --non-recursive --targets --editor-cmd --username + --password --no-auth-cache --non-interactive + --no-unlock' + ;; + copy|cp) + options='--message --file --encoding --force-log --revision + --quiet --editor-cmd -username --password + --no-auth-cache --non-interactive' + ;; + delete|del|remove|rm) + options='--force --message --file --encoding --force-log + --quiet --targets --editor-cmd --username + --password --no-auth-cache --non-interactive' + ;; + diff|di) + options='--revision --extensions --diff-cmd + --no-diff-deleted --non-recursive --username + --password --no-auth-cache --non-interactive + --force --old --new --notice-ancestry' + ;; + export) + options='--revision --quiet --username --password + --no-auth-cache --non-interactive --non-recursive + --force --native-eol --ignore-externals' + ;; + import) + options='--auto-props --no-auto-props --message --file + --encoding --force-log --quiet --non-recursive + --no-ignore --editor-cmd --username --password + --no-auth-cache --non-interactive' + ;; + info) + options='--username --password --no-auth-cache + --non-interactive --revision --xml --targets + --recursive --incremental' + ;; + list|ls) + options='--revision --verbose --recursive --username + --password --no-auth-cache --non-interactive + --incremental --xml' + ;; + lock) + options='--message --file --encoding --force-log --targets + --force --username --password --no-auth-cache + --non-interactive' + ;; + log) + options='--revision --verbose --targets --username + --password --no-auth-cache --non-interactive + --stop-on-copy --incremental --xml --quiet + --limit' + ;; + merge) + options='--revision --non-recursive --quiet --force + --dry-run --diff3-cmd --username --password + --no-auth-cache --non-interactive + --ignore-ancestry' + ;; + mkdir) + options='--message --file --encoding --force-log --quiet + --editor-cmd --username --password --no-auth-cache + --non-interactive' + ;; + move|mv|rename|ren) + options='--message --file --encoding --force-log --revision + --quiet --force --editor-cmd --username --password + --no-auth-cache --non-interactive' + ;; + propdel|pdel|pd) + options='--quiet --recursive --revision --revprop + --username --password --no-auth-cache + --non-interactive' + ;; + propedit|pedit|pe) + options='--revision --revprop --encoding --editor-cmd + --username --password --no-auth-cache + --non-interactive --force' + ;; + propget|pget|pg) + options='--recursive --revision --revprop --strict + --username --password --no-auth-cache + --non-interactive' + ;; + proplist|plist|pl) + options='--verbose --recursive --revision --revprop --quiet + --username --password --no-auth-cache + --non-interactive' + ;; + propset|pset|ps) + options='--file --quiet --targets --recursive --revprop + --encoding --username --password --no-auth-cache + --non-interactive --revision --force' + ;; + resolved) + options='--targets --recursive --quiet' + ;; + revert) + options='--targets --recursive --quiet' + ;; + status|stat|st) + options='--show-updates --verbose --non-recursive --quiet + --username --password --no-auth-cache + --non-interactive --no-ignore --ignore-externals + --incremental --xml' + ;; + switch|sw) + options='--relocate --revision --non-recursive --quiet + --username --password --no-auth-cache + --non-interactive --diff3-cmd' + ;; + unlock) + options='--targets --force --username --password + --no-auth-cache --non-interactive' + ;; + update|up) + options='--revision --non-recursive --quiet --username + --password --no-auth-cache --non-interactive + --diff3-cmd --ignore-externals' + ;; + esac + options+=" --help --config-dir" + + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svn svn + +# ex: filetype=sh diff --git a/completions/_svnadmin b/completions/_svnadmin new file mode 100644 index 0000000..395ae11 --- /dev/null +++ b/completions/_svnadmin @@ -0,0 +1,78 @@ +# svnadmin completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svnadmin() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs + load lslocks lstxns recover rmlocks rmtxns setlog verify' + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + fi + else + case $prev in + --config-dir) + _filedir -d + return + ;; + --fs-type) + COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) ) + return + ;; + esac + + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + create) + options='--bdb-txn-nosync --bdb-log-keep --config-dir + --fs-type' + ;; + deltify) + options='--revision --quiet' + ;; + dump) + options='--revision --incremental --quiet --deltas' + ;; + hotcopy) + options='--clean-logs' + ;; + load) + options='--ignore-uuid --force-uuid --parent-dir --quiet + --use-pre-commit-hook --use-post-commit-hook' + ;; + rmtxns) + options='--quiet' + ;; + setlog) + options='--revision --bypass-hooks' + ;; + esac + + options+=" --help" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svnadmin -o default svnadmin + +# ex: filetype=sh diff --git a/completions/_svnlook b/completions/_svnlook new file mode 100644 index 0000000..a4f3424 --- /dev/null +++ b/completions/_svnlook @@ -0,0 +1,63 @@ +# svnlook completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svnlook() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='author cat changed date diff dirs-changed help ? h history info + lock log propget pget pg proplist plist pl tree uuid youngest' + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + fi + else + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + author|cat|date|dirs-changed|info|log) + options='--revision --transaction' + ;; + changed) + options='--revision --transaction --copy-info' + ;; + diff) + options='--revision --transaction --no-diff-deleted + --no-diff-added --diff-copy-from' + ;; + history) + options='--revision --show-ids' + ;; + propget|proplist) + options='--revision --transaction --revprop' + ;; + tree) + options='--revision --transaction --show-ids --full-paths' + ;; + esac + + options+=" --help" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svnlook -o default svnlook + +# ex: filetype=sh diff --git a/completions/_udevadm b/completions/_udevadm new file mode 100644 index 0000000..80424dc --- /dev/null +++ b/completions/_udevadm @@ -0,0 +1,79 @@ +# udevadm(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# systemd >= 196, use that instead. + +_udevadm() +{ + local cur prev words cword split + _init_completion -s || return + + local i udevcmd + for (( i=1; i < cword; i++ )); do + if [[ ${words[i]} != -* ]]; then + udevcmd=${words[i]} + break + fi + done + + case $prev in + --help|--version|--property|--children-max|--timeout|--seq-start|\ + --seq-end|--attr-match|--attr-nomatch|--parent-match|--property-match|\ + --tag-match|--subsystem-match|--subsystem-nomatch|--sysname-match|\ + --path) + return + ;; + --log-priority) + COMPREPLY=( $( compgen -W 'err info debug' -- "$cur" ) ) + return + ;; + --query) + COMPREPLY=( $( compgen -W 'name symlink path property all' \ + -- "$cur" ) ) + return + ;; + --name) + cur=${cur:=/dev/} + _filedir + return + ;; + --device-id-of-file|--exit-if-exists) + _filedir + return + ;; + --action) + COMPREPLY=( $( compgen -W 'add change remove' -- "$cur" ) ) + return + ;; + --type) + COMPREPLY=( $( compgen -W 'devices subsystems failed' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ -z $udevcmd ]]; then + case $cur in + -*) + COMPREPLY=( $( compgen -W '--help --version --debug' -- \ + "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$( "$1" --help 2>/dev/null | + awk '/^[ \t]/ { print $1 }' )" -- "$cur" ) ) + ;; + esac + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( "$1" $udevcmd --help 2>/dev/null | _parse_help - )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _udevadm udevadm + +# ex: filetype=sh diff --git a/completions/_write b/completions/_write new file mode 100644 index 0000000..49e56ff --- /dev/null +++ b/completions/_write @@ -0,0 +1,8 @@ +# write(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u write + +# ex: filetype=sh diff --git a/completions/_yum b/completions/_yum new file mode 100644 index 0000000..f3a104b --- /dev/null +++ b/completions/_yum @@ -0,0 +1,144 @@ +# yum(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# yum > 3.2.25, use that instead. + +_yum_list() +{ + if [[ "$1" == all ]] ; then + # Try to strip in between headings like "Available Packages" + # This will obviously only work for English :P + COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + command sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ + -e 's/[[:space:]].*//p' ) ) + else + # Drop first line (e.g. "Updated Packages") + COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + command sed -ne 1d -e 's/[[:space:]].*//p' ) ) + fi +} + +_yum_repolist() +{ + # -d 0 causes repolist to output nothing as of yum 3.2.22: + # http://yum.baseurl.org/ticket/83 + # Drop first ("repo id repo name") and last ("repolist: ...") rows + yum --noplugins -C repolist $1 2>/dev/null | \ + command sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' +} + +_yum_plugins() +{ + command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \ + | command sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u +} + +_yum() +{ + local cur prev words cword split + _init_completion -s || return + + local special i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then + special=${words[i]} + fi + done + + if [[ -n $special ]]; then + # TODO: install|update|upgrade should not match *src.rpm + if [[ "$cur" == @(*/|[.~])* && \ + "$special" == @(deplist|install|update|upgrade) ]]; then + _filedir rpm + return + fi + case $special in + install) + _yum_list available + return + ;; + deplist|info) + _yum_list all + return + ;; + upgrade|update) + _yum_list updates + return + ;; + remove|erase) + # _rpm_installed_packages is not arch-qualified + _yum_list installed + return + ;; + esac + fi + + case $prev in + list) + COMPREPLY=( $( compgen -W 'all available updates installed extras + obsoletes recent' -- "$cur" ) ) + ;; + clean) + COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache + all' -- "$cur" ) ) + ;; + repolist) + COMPREPLY=( $( compgen -W 'all enabled disabled' -- "$cur" ) ) + ;; + localinstall|localupdate) + # TODO: should not match *src.rpm + _filedir rpm + ;; + -d|-e) + COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) ) + ;; + -c) + _filedir + ;; + --installroot) + _filedir -d + ;; + --enablerepo) + COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' \ + -- "$cur" ) ) + ;; + --disablerepo) + COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- "$cur" ) ) + ;; + --disableexcludes) + COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \ + -- "$cur" ) ) + ;; + --enableplugin|--disableplugin) + COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- "$cur" ) ) + ;; + --color) + COMPREPLY=( $( compgen -W 'always auto never' -- "$cur" ) ) + ;; + -R|-x|--exclude) + # argument required but no completions available + return + ;; + -h|--help|--version) + # no other options useful with these + return + ;; + *) + COMPREPLY=( $( compgen -W 'install update check-update upgrade + remove erase list info provides whatprovides clean makecache + groupinstall groupupdate grouplist groupremove groupinfo + search shell resolvedep localinstall localupdate deplist + repolist help' -- "$cur" ) ) + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _yum yum + +# ex: filetype=sh diff --git a/completions/a2x b/completions/a2x new file mode 100644 index 0000000..06c7c3a --- /dev/null +++ b/completions/a2x @@ -0,0 +1,40 @@ +# a2x(1) completion -*- shell-script -*- + +_a2x() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -a|--attribute|--asciidoc-opts|--dblatex-opts|--fop-opts|-h|--help|\ + --version|--xsltproc-opts) + return + ;; + -D|--destination-dir|--icons-dir) + _filedir -d + return + ;; + --doctype|-d) + _xfunc asciidoc _asciidoc_doctype + return + ;; + --stylesheet) + _filedir css + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _a2x a2x + +# ex: filetype=sh diff --git a/completions/abook b/completions/abook new file mode 100644 index 0000000..4bb0e8e --- /dev/null +++ b/completions/abook @@ -0,0 +1,49 @@ +# abook(1) completion -*- shell-script -*- + +_abook() +{ + local cur prev words cword + _init_completion || return + + # abook only takes options, tabbing after command name adds a single dash + [[ $cword -eq 1 && -z "$cur" ]] && + { + compopt -o nospace + COMPREPLY=( "-" ) + return + } + + case $cur in + -*) + _longopt "$1" + return + ;; + esac + + case $prev in + --informat) + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ + -- "$cur" ) ) + ;; + --outformat) + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ + -- "$cur" ) ) + ;; + --infile) + COMPREPLY=( $( compgen -W stdin -- "$cur" ) ) + _filedir + ;; + --outfile) + COMPREPLY=( $( compgen -W stdout -- "$cur" ) ) + _filedir + ;; + --config|--datafile) + _filedir + ;; + esac +} && +complete -F _abook abook + +# ex: filetype=sh diff --git a/completions/aclocal b/completions/aclocal new file mode 100644 index 0000000..7a3d646 --- /dev/null +++ b/completions/aclocal @@ -0,0 +1,35 @@ +# aclocal(1) completion -*- shell-script -*- + +_aclocal() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|--print-ac-dir|--version) + return + ;; + --acdir|-I) + _filedir -d + return + ;; + --output) + _filedir + return + ;; + --warnings|-W) + local cats=( syntax unsupported ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _aclocal aclocal aclocal-1.1{0..5} + +# ex: filetype=sh diff --git a/completions/acpi b/completions/acpi new file mode 100644 index 0000000..b748cbd --- /dev/null +++ b/completions/acpi @@ -0,0 +1,22 @@ +# acpi(1) completion -*- shell-script -*- + +_acpi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-v|--version) + return + ;; + -d|--directory) + _filedir -d + return + ;; + esac + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _acpi acpi + +# ex: filetype=sh diff --git a/completions/adb b/completions/adb new file mode 100644 index 0000000..d069b42 --- /dev/null +++ b/completions/adb @@ -0,0 +1,66 @@ +# adb completion -*- shell-script -*- + +_adb_command_usage() +{ + COMPREPLY=( $( compgen -W \ + '$( "$1" help 2>&1 | command grep "^ *\(adb \)\? *$2 " \ + | command sed -e "s/[]|[]/\n/g" | _parse_help - )' -- "$cur" ) ) +} + +_adb() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s|-p|--algo|--key|--iv) + return + ;; + -f) + _filedir + return + ;; + esac + + local cmd i + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" != -* && "${words[i-1]}" != -[sp] ]]; then + cmd="${words[i]}" + break + fi + done + + if [[ ! "$cmd" ]]; then + local tmp=() + if [[ ! $cur || $cur == -* ]]; then + tmp+=( $( compgen -W '$( _parse_help "$1" help )' -- "$cur" ) ) + fi + if [[ ! $cur || $cur != -* ]]; then + tmp+=( $( $1 help 2>&1 | awk '$1 == "adb" { print $2 }' ) ) + tmp+=( devices connect disconnect sideload ) + fi + COMPREPLY=( $( compgen -W '${tmp[@]}' -- "$cur" ) ) + return + fi + + # TODO: more and better command completions + + _adb_command_usage "$1" $cmd + + case $cmd in + push|restore|sideload) + _filedir + ;; + forward) + COMPREPLY=( $( compgen -W \ + '$( "$1" help 2>&1 | command sed -ne "s/^ *adb *forward *-/-/p" | \ + _parse_help - )' -- "$cur" ) ) + ;; + reboot) + COMPREPLY=( $( compgen -W 'bootloader recovery' -- "$cur" ) ) + ;; + esac +} && +complete -F _adb adb + +# ex: filetype=sh diff --git a/completions/add_members b/completions/add_members new file mode 100644 index 0000000..d582d94 --- /dev/null +++ b/completions/add_members @@ -0,0 +1,31 @@ +# mailman add_members completion -*- shell-script -*- + +_add_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -r|-d|--regular-members-file|--digest-members-file) + _filedir + return + ;; + -w|-a|--welcome-msg|--admin-notify) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--regular-members-file --digest-members-file + --welcome-msg --admin-notify --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _add_members add_members + +# ex: filetype=sh diff --git a/completions/alias b/completions/alias new file mode 100644 index 0000000..de2a57e --- /dev/null +++ b/completions/alias @@ -0,0 +1,20 @@ +# bash alias completion -*- shell-script -*- + +_alias() +{ + local cur prev words cword + _init_completion || return + + case ${words[@]} in + *[^=]) + COMPREPLY=( $( compgen -A alias -- "$cur" ) ) + ;; + *=) + COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | command sed \ + -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) + ;; + esac +} && +complete -F _alias -o nospace alias + +# ex: filetype=sh diff --git a/completions/ant b/completions/ant new file mode 100644 index 0000000..639cde9 --- /dev/null +++ b/completions/ant @@ -0,0 +1,99 @@ +# bash completion for ant and phing -*- shell-script -*- + +_ant_parse_targets() +{ + local line basedir + + [[ $1 == */* ]] && basedir=${1%/*} || basedir=. + + # parse buildfile for targets + while read -rd '>' line; do + if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then + targets+=" ${BASH_REMATCH[2]}" + fi + done < $1 + + # parse imports + while read -rd '>' line; do + if [[ $line =~ \/dev/null && \ + complete -C complete-ant-cmd.pl -F _ant ant || : + +# ex: filetype=sh diff --git a/completions/apache2ctl b/completions/apache2ctl new file mode 100644 index 0000000..7478974 --- /dev/null +++ b/completions/apache2ctl @@ -0,0 +1,16 @@ +# apache2ctl(1) completion -*- shell-script -*- + +_apache2ctl() +{ + local cur prev words cword + _init_completion || return + + local APWORDS + APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ + tr "|" " ") + + COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) +} && +complete -F _apache2ctl apache2ctl + +# ex: filetype=sh diff --git a/completions/appdata-validate b/completions/appdata-validate new file mode 100644 index 0000000..3285a3b --- /dev/null +++ b/completions/appdata-validate @@ -0,0 +1,32 @@ +# appdata-validate(1) completion -*- shell-script -*- + +_appdata_validate() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--version) + return + ;; + --output-format) + COMPREPLY=( $( compgen -W "$( $1 --help | + command sed -ne 's/--output-format.*\[\(.*\)\]/\1/' -e 's/|/ /gp' )" \ + -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir appdata.xml +} && +complete -F _appdata_validate appdata-validate + +# ex: filetype=sh diff --git a/completions/apt-build b/completions/apt-build new file mode 100644 index 0000000..0723bcc --- /dev/null +++ b/completions/apt-build @@ -0,0 +1,53 @@ +# Debian apt-build(1) completion -*- shell-script -*- + +_apt_build() +{ + local cur prev words cword + _init_completion || return + + local special i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(install|remove|source|info|clean) ]]; then + special=${words[i]} + fi + done + + if [[ -n $special ]]; then + case $special in + install|source|info) + COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) ) + ;; + remove) + COMPREPLY=( \ + $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) + ;; + esac + return + fi + + case $prev in + --patch|--build-dir|--repository-dir) + _filedir + return + ;; + -h|--help) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir + --repository-dir --build-only --build-command --reinstall --rebuild + --remove-builddep --no-wrapper --purge --patch --patch-strip -p + --yes -y --version -v --no-source' -- "$cur" ) ) + + else + COMPREPLY=( $( compgen -W 'update upgrade install remove source + dist-upgrade world clean info clean-build update-repository' \ + -- "$cur" ) ) + fi + +} && +complete -F _apt_build apt-build + +# ex: filetype=sh diff --git a/completions/apt-cache b/completions/apt-cache new file mode 100644 index 0000000..bedae4e --- /dev/null +++ b/completions/apt-cache @@ -0,0 +1,82 @@ +# Debian apt-cache(8) completion -*- shell-script -*- + +# List APT binary packages +_apt_cache_packages() { + apt-cache --no-generate pkgnames "$cur" 2> /dev/null +} + +# List APT source packages +_apt_cache_sources() { + apt-cache dumpavail | command grep "^Source: $1" | cut -f2 -d" " | sort -u +} + +# List APT source packages +_apt_cache_src_packages() { + compgen -W '$( _apt_cache_sources "$cur" )' -- "$cur" +} + +_apt_cache() +{ + local cur prev words cword + _init_completion || return + + local special i + if [[ $cur != show ]]; then + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then + special=${words[i]} + fi + done + fi + + + if [[ -n $special ]]; then + case $special in + add) + _filedir + ;; + + showsrc) + COMPREPLY=( $( _apt_cache_sources "$cur" ) ) + ;; + + *) + COMPREPLY=( $( _apt_cache_packages ) ) + ;; + + esac + return + fi + + + case $prev in + -c|-p|-s|--config-file|--pkg-cache|--src-cache) + _filedir + return + ;; + search) + if [[ "$cur" != -* ]]; then + return + fi + ;; + esac + + if [[ "$cur" == -* ]]; then + + COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help + --version --pkg-cache --src-cache --quiet --important --full + --all-versions --no-all-versions --generate --no-generate + --names-only --all-names --recurse --config-file --option + --installed' -- "$cur" ) ) + else + + COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc stats + dump dumpavail unmet search search depends rdepends pkgnames + dotty xvcg policy madison' -- "$cur" ) ) + + fi + +} && +complete -F _apt_cache apt-cache + +# ex: filetype=sh diff --git a/completions/apt-get b/completions/apt-get new file mode 100644 index 0000000..ce95105 --- /dev/null +++ b/completions/apt-get @@ -0,0 +1,72 @@ +# Debian apt-get(8) completion -*- shell-script -*- + +_apt_get() +{ + local cur prev words cword + _init_completion || return + + local special i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download|changelog) ]]; then + special=${words[i]} + fi + done + + if [[ -n $special ]]; then + case $special in + remove|autoremove|purge) + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=( $( \ + _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) + else + # assume RPM based + _xfunc rpm _rpm_installed_packages + fi + ;; + source) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ + 2> /dev/null ) $( apt-cache dumpavail | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + ;; + *) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ + 2> /dev/null ) ) + ;; + esac + return + fi + + case $prev in + -c|--config-file) + _filedir + return + ;; + -t|--target-release|--default-release) + COMPREPLY=( $( apt-cache policy | \ + command grep "release.o=Debian,a=$cur" | \ + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o + --download-only --fix-broken --help --version --ignore-missing + --fix-missing --no-download --quiet --simulate --just-print + --dry-run --recon --no-act --yes --assume-yes --show-upgraded + --only-source --compile --build --ignore-hold --target-release + --no-upgrade --force-yes --print-uris --purge --reinstall + --list-cleanup --default-release --trivial-only --no-remove + --diff-only --no-install-recommends --tar-only --config-file + --option --auto-remove' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade + dist-upgrade install remove purge source build-dep download + changelog check clean autoclean autoremove' -- "$cur" ) ) + fi + +} && +complete -F _apt_get apt-get + +# ex: filetype=sh diff --git a/completions/aptitude b/completions/aptitude new file mode 100644 index 0000000..32c1dac --- /dev/null +++ b/completions/aptitude @@ -0,0 +1,87 @@ +# Debian aptitude(1) completion -*- shell-script -*- + +_have grep-status && { +_comp_dpkg_hold_packages() +{ + grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package +} +} || { +_comp_dpkg_hold_packages() +{ + command grep -B 2 'hold' /var/lib/dpkg/status | \ + awk "/Package: $1/ { print \$2 }" +} +} + +_aptitude() +{ + local cur prev words cword + _init_completion || return + + local dashoptions='-S -u -i -h --help --version -s --simulate -d + --download-only -P --prompt -y --assume-yes -F --display-format -O + --sort -w --width -f -r -g --with-recommends -R -G --without-recommends + -t --target-release -V --show-versions -D --show-deps -Z -v --verbose + --purge-unused --schedule-only' + + local special i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full|safe)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then + special=${words[i]} + fi + #exclude some mutually exclusive options + [[ ${words[i]} == '-u' ]] && dashoptions=${dashoptions/-i} + [[ ${words[i]} == '-i' ]] && dashoptions=${dashoptions/-u} + done + + if [[ -n "$special" ]]; then + case $special in + install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \ + safe-upgrade|download|show|changelog|why|why-not|build-dep| \ + add-user-tag|remove-user-tag|versions) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) ) + return + ;; + purge|remove|reinstall|forbid-version) + COMPREPLY=( \ + $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) + return + ;; + unhold) + COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) + return + ;; + esac + fi + + case $prev in + # don't complete anything if these options are found + autoclean|clean|forget-new|search|upgrade|update|keep-all) + return + ;; + -S) + _filedir + return + ;; + -t|--target-release|--default-release) + COMPREPLY=( $( apt-cache policy | \ + command grep "release.o=Debian,a=$cur" | \ + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$dashoptions" -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new + clean autoclean install reinstall remove hold unhold purge markauto + unmarkauto why why-not dist-upgrade full-upgrade download search + show forbid-version changelog keep-all build-dep add-user-tag + remove-user-tag versions' -- "$cur" ) ) + fi + +} && +complete -F _aptitude -o default aptitude + +# ex: filetype=sh diff --git a/completions/arch b/completions/arch new file mode 100644 index 0000000..cd33b4f --- /dev/null +++ b/completions/arch @@ -0,0 +1,46 @@ +# mailman arch completion -*- shell-script -*- + +# Try to detect whether this is the mailman "arch" to avoid installing +# it for the coreutils/util-linux-ng one. +_have mailmanctl && +_arch() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -d|--file) + _filedir + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + local args=$cword + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -* ]]; then + args=$(($args-1)) + fi + done + case $args in + 1) + _xfunc list_lists _mailman_lists + ;; + 2) + _filedir + ;; + esac + fi + +} && +complete -F _arch arch + +# ex: filetype=sh diff --git a/completions/arping b/completions/arping new file mode 100644 index 0000000..a719e91 --- /dev/null +++ b/completions/arping @@ -0,0 +1,31 @@ +# arping(8) completion -*- shell-script -*- + +_arping() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c|-w) + return + ;; + -I) + _available_interfaces -a + return + ;; + -s) + _ip_addresses + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + return + fi + + _known_hosts_real "$cur" +} && +complete -F _arping arping + +# ex: filetype=sh diff --git a/completions/arpspoof b/completions/arpspoof new file mode 100644 index 0000000..7b515ed --- /dev/null +++ b/completions/arpspoof @@ -0,0 +1,28 @@ +# arpspoof completion -*- shell-script -*- + +_arpspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -t) + _known_hosts_real "$cur" + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + else + _known_hosts_real "$cur" + fi + +} && +complete -F _arpspoof arpspoof + +# ex: filetype=sh diff --git a/completions/asciidoc b/completions/asciidoc new file mode 100644 index 0000000..fb29fad --- /dev/null +++ b/completions/asciidoc @@ -0,0 +1,52 @@ +# asciidoc(1) completion -*- shell-script -*- + +_asciidoc_doctype() +{ + COMPREPLY+=( $( compgen -W 'article book manpage' -- "$cur" ) ) +} + +_asciidoc() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --attribute|-a) + return + ;; + --backend|-b) + COMPREPLY=( $( compgen -W 'docbook html4 xhtml11' -- "$cur" ) ) + return + ;; + --conf-file|-f) + _filedir conf + return + ;; + --doctype|-d) + _asciidoc_doctype + return + ;; + --help|-h) + COMPREPLY=( $( compgen -W 'manpage syntax topics' -- "$cur" ) ) + return + ;; + --out-file|-o) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help manpage" )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _asciidoc asciidoc asciidoc.py + +# ex: filetype=sh diff --git a/completions/aspell b/completions/aspell new file mode 100644 index 0000000..9457a5f --- /dev/null +++ b/completions/aspell @@ -0,0 +1,88 @@ +# bash completion for aspell -*- shell-script -*- + +_aspell_dictionary() +{ + local datadir aspell=${1:-aspell} + datadir=$( $aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) + # First, get aliases (dicts dump does not list them) + COMPREPLY=( $( printf '%s\n' $datadir/*.alias ) ) + COMPREPLY=( "${COMPREPLY[@]%.alias}" ) + COMPREPLY=( "${COMPREPLY[@]#$datadir/}" ) + # Then, add the canonical dicts + COMPREPLY+=( $( $aspell dicts 2>/dev/null ) ) + COMPREPLY=( $( compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur" ) ) +} + +_aspell() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -c|-p|check|--conf|--personal|--repl|--per-conf) + _filedir + return + ;; + --conf-dir|--data-dir|--dict-dir|--home-dir|--local-data-dir|--prefix) + _filedir -d + return + ;; + dump|create|merge) + COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) ) + return + ;; + --mode) + COMPREPLY=( $( compgen -W "$( $1 modes 2>/dev/null | \ + awk '{ print $1 }' )" -- "$cur" ) ) + return + ;; + --sug-mode) + COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' \ + -- "$cur" ) ) + return + ;; + --keymapping) + COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) ) + return + ;; + -d|--master) + _aspell_dictionary "$1" + return + ;; + --add-filter|--rem-filter) + COMPREPLY=( $( compgen -W "$( $1 filters 2>/dev/null | \ + awk '{ print $1 }' )" -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= + --encoding= --add-filter= --rem-filter= --mode= --add-extra-dicts= + --rem-extra-dicts= --home-dir= --ignore= --ignore-accents + --dont-ignore-accents --ignore-case --dont-ignore-case + --ignore-repl --dont-ignore-repl --jargon --keyboard= --lang= + --language-tag --local-data-dir= --master= --module + --add-module-search-order --rem-module-search-order --per-conf= + --personal= --prefix= --repl= --run-together --dont-run-together + --run-together-limit= --run-together-min= --save-repl + --dont-save-repl --set-prefix --dont-set-prefix --size= --spelling + --strip-accents --dont-strip-accents --sug-mode= + --add-word-list-path --rem-word-list-path --backup --dont-backup + --reverse --dont-reverse --time --dont-time --keymapping= + --add-email-quote= --rem-email-quote= --email-margin= + --add-tex-command= --rem-tex-command= --tex-check-comments + --dont-tex-check-comments --add-tex-extension --rem-tex-extension + --add-sgml-check= --rem-sgml-check= --add-sgml-extension + --rem-sgml-extension' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + COMPREPLY=( $( compgen -W 'usage help check pipe list config soundslike + filter version dump create merge' -- "$cur" ) ) + fi +} && +complete -F _aspell aspell + +# ex: filetype=sh diff --git a/completions/autoconf b/completions/autoconf new file mode 100644 index 0000000..c67f1bd --- /dev/null +++ b/completions/autoconf @@ -0,0 +1,40 @@ +# autoconf(1) completion -*- shell-script -*- + +_autoconf() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V|--trace|-t) + return + ;; + --output|-o) + _filedir + return + ;; + --warnings|-W) + local cats=( cross obsolete syntax ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return + ;; + --prepend-include|-B|--include|-I) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir '@(ac|in)' +} && +complete -F _autoconf autoconf + +# ex: filetype=sh diff --git a/completions/automake b/completions/automake new file mode 100644 index 0000000..c5fe1a1 --- /dev/null +++ b/completions/automake @@ -0,0 +1,36 @@ +# automake(1) completion -*- shell-script -*- + +_automake() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|--version) + return + ;; + --warnings|-W) + local cats=( gnu obsolete override portability syntax unsupported ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return + ;; + --libdir) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _automake automake automake-1.1{0..5} + +# ex: filetype=sh diff --git a/completions/autoreconf b/completions/autoreconf new file mode 100644 index 0000000..c067cec --- /dev/null +++ b/completions/autoreconf @@ -0,0 +1,41 @@ +# autoreconf(1) completion -*- shell-script -*- + +_autoreconf() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V) + return + ;; + --warnings|-W) + local cats=( cross gnu obsolete override portability syntax \ + unsupported ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return + ;; + --prepend-include|-B|--include|-I) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + if [[ $1 == autoheader ]] ; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && +complete -F _autoreconf autoreconf autoheader + +# ex: filetype=sh diff --git a/completions/autorpm b/completions/autorpm new file mode 100644 index 0000000..8c6e299 --- /dev/null +++ b/completions/autorpm @@ -0,0 +1,14 @@ +# autorpm(8) completion -*- shell-script -*- + +_autorpm() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add + fullinfo info help install list remove set' -- "$cur" ) ) + +} && +complete -F _autorpm autorpm + +# ex: filetype=sh diff --git a/completions/autoscan b/completions/autoscan new file mode 100644 index 0000000..054a58a --- /dev/null +++ b/completions/autoscan @@ -0,0 +1,34 @@ +# autoscan(1) completion -*- shell-script -*- + +_autoscan() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V) + return + ;; + --prepend-include|-B|--include|-I) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + if [[ $1 == autoupdate ]] ; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && +complete -F _autoscan autoscan autoupdate + +# ex: filetype=sh diff --git a/completions/avctrl b/completions/avctrl new file mode 100644 index 0000000..acd9aeb --- /dev/null +++ b/completions/avctrl @@ -0,0 +1,20 @@ +# avctrl completion -*- shell-script -*- + +_avctrl() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) ) + else + local args + _count_args + if [[ $args -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) ) + fi + fi +} && +complete -F _avctrl avctrl + +# ex: filetype=sh diff --git a/completions/badblocks b/completions/badblocks new file mode 100644 index 0000000..d70affe --- /dev/null +++ b/completions/badblocks @@ -0,0 +1,32 @@ +# badblocks(8) completion -*- shell-script -*- + +_badblocks() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-c|-e|-d|-p|-t) + return + ;; + -i|-o) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + # Filter out -w (dangerous) and -X (internal use) + for i in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]' + done + return + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _badblocks badblocks + +# ex: filetype=sh diff --git a/completions/bind b/completions/bind new file mode 100644 index 0000000..ec5d0b8 --- /dev/null +++ b/completions/bind @@ -0,0 +1,36 @@ +# bash bind completion -*- shell-script -*- + +_bind() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l|-p|-P|-s|-S|-v|-V|-r|-x|-X) + return + ;; + -m) + COMPREPLY=( $( compgen -W "emacs emacs-standard emacs-meta + emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur" ) ) + return + ;; + -f) + _filedir + return + ;; + -q|-u) + COMPREPLY=( $( compgen -W '$( "$1" -l )' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -A binding -- "$cur" ) ) +} && +complete -F _bind bind + +# ex: filetype=sh diff --git a/completions/bk b/completions/bk new file mode 100644 index 0000000..334e25b --- /dev/null +++ b/completions/bk @@ -0,0 +1,18 @@ +# BitKeeper completion -*- shell-script -*- +# adapted from code by Bart Trojanowski + +_bk() +{ + local cur prev words cword + _init_completion || return + + local BKCMDS="$( bk help topics 2>/dev/null | \ + awk '/^ bk/ { print $2 }' | xargs printf '%s ' )" + + COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) + _filedir + +} && +complete -F _bk bk + +# ex: filetype=sh diff --git a/completions/brctl b/completions/brctl new file mode 100644 index 0000000..0137065 --- /dev/null +++ b/completions/brctl @@ -0,0 +1,39 @@ +# bash completion for brctl -*- shell-script -*- + +_brctl() +{ + local cur prev words cword + _init_completion || return + + local command=${words[1]} + + case $cword in + 1) + COMPREPLY=( $( compgen -W "addbr delbr addif delif setageing + setbridgeprio setfd sethello setmaxage setpathcost setportprio + show showmacs showstp stp" -- "$cur" ) ) + ;; + 2) + case $command in + show) + ;; + *) + COMPREPLY=( $( compgen -W "$($1 show | \ + awk 'NR>1 {print $1}' )" -- "$cur" ) ) + esac + ;; + 3) + case $command in + addif|delif) + _configured_interfaces + ;; + stp) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + ;; + esac + ;; + esac +} && +complete -F _brctl -o default brctl + +# ex: filetype=sh diff --git a/completions/btdownloadheadless.py b/completions/btdownloadheadless.py new file mode 100644 index 0000000..f0b7461 --- /dev/null +++ b/completions/btdownloadheadless.py @@ -0,0 +1,32 @@ +# btdownloadheadless(1) completion -*- shell-script -*- + +_btdownload() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --responsefile|--saveas) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval + --download_slice_size --request_backlog --max_message_length + --ip --minport --maxport --responsefile --url --saveas --timeout + --timeout_check_interval --max_slice_length --max_rate_period + --bind --upload_rate_fudge --display_interval --rerequest_interval + --min_peers --http_timeout --max_initiate --max_allow_in + --check_hashes --max_upload_rate --snub_time --spew + --rarest_first_cutoff --min_uploads --report_hash_failures' \ + -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \ + btdownloadgui.py + +# ex: filetype=sh diff --git a/completions/bts b/completions/bts new file mode 100644 index 0000000..ba33fd6 --- /dev/null +++ b/completions/bts @@ -0,0 +1,115 @@ +# bts completion -*- shell-script -*- + +# List bug numbers from bugs cache in ~/.devscripts_cache/bts +_cached_bugs() { + [[ -d $HOME/.devscripts_cache/bts ]] && \ + find $HOME/.devscripts_cache/bts -maxdepth 1 -name "$cur[0-9]*.html" \ + -printf "%f\n" | cut -d'.' -f1 +} + +# List APT source packages prefixed with "src:" +_src_packages_with_prefix() { + ppn=${cur:4} # partial package name, after stripping "src:" + compgen -P "src:" -W '$( _xfunc apt-cache _apt_cache_sources "$ppn" )' \ + -- "$ppn" +} + + +_bts() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + show|bugs) + COMPREPLY=( $( compgen -W 'release-critical RC from: tag: + usertag:' -- "$cur" ) $( _cached_bugs ) + $( _src_packages_with_prefix ) ) + return + ;; + select) + COMPREPLY=( $( compgen -W 'package: source: maintainer: submitter: + severity: status: tag: owner: correspondent: affects: bugs: + users: archive:' -- "$cur" ) ) + return + ;; + status) + COMPREPLY=( $( compgen -W 'file: fields: verbose' -- "$cur" ) + $( _cached_bugs ) ) + return + ;; + block|unblock) + COMPREPLY=( $( compgen -W 'by with' -- "$cur" ) ) + return + ;; + severity) + COMPREPLY=( $( compgen -W 'wishlist minor normal important serious + grave critical' -- "$cur" ) ) + return + ;; + limit) + COMPREPLY=( $( compgen -W 'submitter date subject msgid package + source tag severity owner affects archive' -- "$cur" ) ) + return + ;; + clone|done|reopen|archive|unarchive|retitle|summary|submitter|found\ + |notfound|fixed|notfixed|merge|forcemerge|unmerge|claim|unclaim\ + |forwarded|notforwarded|owner|noowner|subscribe|unsubscribe\ + |reportspam|spamreport|affects|usertag|usertags|reassign|tag\ + |tags) + COMPREPLY=( $( _cached_bugs ) ) + return + ;; + package) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) ) + return + ;; + cache) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) + $( _src_packages_with_prefix ) + $( compgen -W 'from: release-critical RC' -- "$cur" ) ) + return + ;; + cleancache) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) + $( _src_packages_with_prefix ) + $( compgen -W 'from: tag: usertag: ALL' -- "$cur" ) ) + return + ;; + user) + # non-predicible arguments + COMPREPLY=( ) + return + ;; + :) + # Chances are that "src:" is being completed + # COMP_WORDS would be: "bts cleancache src : " + pos=$((COMP_CWORD - 2)) + if [[ $pos -gt 0 && "${COMP_WORDS[$pos]}" == "src" ]]; then + COMPREPLY=( $( _xfunc apt-cache _apt_cache_src_packages ) ) + return + fi + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '--offline --online --no-offline + --no-action --cache --no-cache --cache-mode --cache-delay --mbox + --mailreader --cc-addr --use-default-cc --no-use-default-cc + --sendmail --mutt --no-mutt --smtp-host --smtp-username + --smtp-helo --bts-server --force-refresh --no-force-refresh + --only-new --include-resolved --no-include-resolved --no-ack --ack + --interactive --force-interactive --no-interactive --quiet + --no-conf --noconf + show bugs select status clone done reopen archive unarchive retitle + summary submitter reassign found notfound fixed notfixed block unblock + merge forcemerge unmerge tag tags affects user usertag usertags claim + unclaim severity forwarded notforwarded package limit owner noowner + subscribe unsubscribe reportspam spamreport cache cleancache version + help' -- "$cur" ) ) + +} && +complete -F _bts bts + +# ex: filetype=sh diff --git a/completions/bzip2 b/completions/bzip2 new file mode 100644 index 0000000..8362a59 --- /dev/null +++ b/completions/bzip2 @@ -0,0 +1,43 @@ +# bash completion for bzip2 -*- shell-script -*- + +_bzip2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-h|--help|-p) + return + ;; + -n) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + local helpopts=$( _parse_help "$1" ) + COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ + -- "$cur" ) ) + return + fi + + local IFS=$'\n' xspec="*.bz2" + + if [[ "$prev" == --* ]]; then + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ "$prev" == --compress ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec + [[ "$prev" == -*z* ]] && xspec= + fi + + _expand || return + + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _bzip2 bzip2 pbzip2 lbzip2 + +# ex: filetype=sh diff --git a/completions/cancel b/completions/cancel new file mode 100644 index 0000000..2722d2a --- /dev/null +++ b/completions/cancel @@ -0,0 +1,12 @@ +# cancel(1) completion -*- shell-script -*- + +_cancel() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( compgen -W "$( lpstat 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) +} && +complete -F _cancel cancel + +# ex: filetype=sh diff --git a/completions/cardctl b/completions/cardctl new file mode 100644 index 0000000..273d1a9 --- /dev/null +++ b/completions/cardctl @@ -0,0 +1,15 @@ +# Linux cardctl(8) completion -*- shell-script -*- + +_cardctl() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'status config ident suspend resume reset + eject insert scheme' -- "$cur" ) ) + fi +} && +complete -F _cardctl cardctl pccardctl + +# ex: filetype=sh diff --git a/completions/ccache b/completions/ccache new file mode 100644 index 0000000..7184d74 --- /dev/null +++ b/completions/ccache @@ -0,0 +1,38 @@ +# ccache(1) completion -*- shell-script -*- + +_ccache() +{ + local cur prev words cword split + _init_completion -s || return + + local i + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + _command_offset $i + return + fi + [[ ${COMP_WORDS[i]} == -[oFM] ]] && ((i++)) + done + + case $prev in + -h|--help|-V|--version|-F|--max-files|-M|--max-size) + return + ;; + -o|--set-config) + if [[ $cur != *=* ]]; then + COMPREPLY=( $( compgen -S = -W "$( $1 -p 2>/dev/null | \ + awk '$3 = "=" { print $2 }' )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _ccache ccache + +# ex: filetype=sh diff --git a/completions/cfagent b/completions/cfagent new file mode 100644 index 0000000..fbf364e --- /dev/null +++ b/completions/cfagent @@ -0,0 +1,21 @@ +# cfagent completion -*- shell-script -*- + +_cfagent() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|--file) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _cfagent cfagent + +# ex: filetype=sh diff --git a/completions/cfrun b/completions/cfrun new file mode 100644 index 0000000..f4d1f26 --- /dev/null +++ b/completions/cfrun @@ -0,0 +1,47 @@ +# cfrun completion -*- shell-script -*- + +_cfrun() +{ + local cur prev words cword + _init_completion || return + + local i section=1 + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -- ]]; then + section=$((section + 1)) + fi + done + + case $section in + 1) + case $prev in + -f) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- "$cur" ) ) + else + hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -f ]]; then + hostfile=${words[i+1]} + break + fi + done + [[ ! -f $hostfile ]] && return + + COMPREPLY=( $(compgen -W "$( command grep -v \ + -E '(=|^$|^#)' $hostfile )" -- "$cur" ) ) + fi + ;; + 2) + COMPREPLY=( $( compgen -W '$( _parse_help cfagent )' -- "$cur" ) ) + ;; + esac +} && +complete -F _cfrun cfrun + +# ex: filetype=sh diff --git a/completions/chage b/completions/chage new file mode 100644 index 0000000..9b11f16 --- /dev/null +++ b/completions/chage @@ -0,0 +1,26 @@ +# chage(1) completion -*- shell-script -*- + +_chage() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ + -M|--maxdays|-W|--warndays) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _chage chage + +# ex: filetype=sh diff --git a/completions/change_pw b/completions/change_pw new file mode 100644 index 0000000..b0f2061 --- /dev/null +++ b/completions/change_pw @@ -0,0 +1,25 @@ +# mailman change_pw completion -*- shell-script -*- + +_change_pw() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all --domain --listname --password --quiet + --help' -- "$cur" ) ) + fi + +} && +complete -F _change_pw change_pw + +# ex: filetype=sh diff --git a/completions/check_db b/completions/check_db new file mode 100644 index 0000000..6f66617 --- /dev/null +++ b/completions/check_db @@ -0,0 +1,17 @@ +# mailman check_db completion -*- shell-script -*- + +_check_db() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _check_db check_db + +# ex: filetype=sh diff --git a/completions/check_perms b/completions/check_perms new file mode 100644 index 0000000..0fb05b1 --- /dev/null +++ b/completions/check_perms @@ -0,0 +1,15 @@ +# mailman check_perms completion -*- shell-script -*- + +_check_perms() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) ) + fi + +} && +complete -F _check_perms check_perms + +# ex: filetype=sh diff --git a/completions/checksec b/completions/checksec new file mode 100644 index 0000000..4e9fb60 --- /dev/null +++ b/completions/checksec @@ -0,0 +1,37 @@ +# bash completion for checksec -*- shell-script -*- + +_checksec() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --version|--help) + return + ;; + --file|--fortify-file) + _filedir + return + ;; + --dir) + _filedir -d + return + ;; + --proc) + _pnames + return + ;; + --proc-libs|--fortify-proc) + _pids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi +} && +complete -F _checksec checksec + +# ex: filetype=sh diff --git a/completions/chgrp b/completions/chgrp new file mode 100644 index 0000000..986a77a --- /dev/null +++ b/completions/chgrp @@ -0,0 +1,39 @@ +# chgrp(1) completion -*- shell-script -*- + +_chgrp() +{ + local cur prev words cword split + _init_completion -s || return + + cur=${cur//\\\\/} + + if [[ "$prev" == --reference ]]; then + _filedir + return + fi + + $split && return + + # options completion + if [[ "$cur" == -* ]]; then + local w opts + for w in "${words[@]}" ; do + [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break + done + COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference + --no-dereference --silent --quiet --reference --recursive --verbose + --help --version $opts' -- "$cur" ) ) + return + fi + + # first parameter on line or first since an option? + if [[ $cword -eq 1 && "$cur" != -* || "$prev" == -* ]]; then + _allowed_groups "$cur" + else + _filedir + fi + +} && +complete -F _chgrp chgrp + +# ex: filetype=sh diff --git a/completions/chkconfig b/completions/chkconfig new file mode 100644 index 0000000..8766b3a --- /dev/null +++ b/completions/chkconfig @@ -0,0 +1,37 @@ +# chkconfig(8) completion -*- shell-script -*- + +_chkconfig() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --level=[1-6]|[1-6]|--list|--add|--del|--override) + _services + _xinetd_services + return + ;; + --level) + COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--list --add --del --override --level' \ + -- "$cur" ) ) + else + if [[ $cword -eq 2 || $cword -eq 4 ]]; then + COMPREPLY=( $( compgen -W 'on off reset resetpriorities' \ + -- "$cur" ) ) + else + _services + _xinetd_services + fi + fi +} && +complete -F _chkconfig chkconfig + +# ex: filetype=sh diff --git a/completions/chown b/completions/chown new file mode 100644 index 0000000..c4479dd --- /dev/null +++ b/completions/chown @@ -0,0 +1,46 @@ +# chown(1) completion -*- shell-script -*- + +_chown() +{ + local cur prev words cword split + # Don't treat user:group as separate words. + _init_completion -s -n : || return + + case "$prev" in + --from) + _usergroup + return + ;; + --reference) + _filedir + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + # Complete -options + local w opts + for w in "${words[@]}" ; do + [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break + done + COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference + --no-dereference --from --silent --quiet --reference --recursive + --verbose --help --version $opts' -- "$cur" ) ) + else + local args + + # The first argument is an usergroup; the rest are filedir. + _count_args : + + if [[ $args -eq 1 ]]; then + _usergroup -u + else + _filedir + fi + fi +} && +complete -F _chown chown + +# ex: filetype=sh diff --git a/completions/chpasswd b/completions/chpasswd new file mode 100644 index 0000000..93e74f8 --- /dev/null +++ b/completions/chpasswd @@ -0,0 +1,26 @@ +# chpasswd(8) completion -*- shell-script -*- + +_chpasswd() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -c|--crypt) + COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ + -- "$cur" ) ) + return + ;; + -s|--sha-rounds) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _chpasswd chpasswd + +# ex: filetype=sh diff --git a/completions/chronyc b/completions/chronyc new file mode 100644 index 0000000..ede6bb0 --- /dev/null +++ b/completions/chronyc @@ -0,0 +1,59 @@ +# chronyc(1) completion -*- shell-script -*- + +_chronyc_command_args() +{ + local -a args=( $( compgen -W "$( $1 help 2>/dev/null | \ + awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }' )" ) ) + case $args in + \) _known_hosts_real "$cur" ;; + \<*) ;; + *) COMPREPLY+=( $( compgen -W '${args[@]}' -- "$cur" ) ) ;; + esac +} + +_chronyc() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|-p) + return + ;; + -h) + _known_hosts_real "$cur" + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -6' -- "$cur" ) ) + return + fi + + local i args=0 + for (( i=1; i < cword; i++ )); do + [[ ${words[i]} != -* && ${words[i-1]} != @(-p|-h) ]] && (( args++ )) + done + + case $args in + 0) + COMPREPLY=( $( compgen -W "$( $1 help 2>/dev/null | \ + awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }' )" \ + -- "$cur" ) ) + ;; + 1) + _chronyc_command_args "$1" + if [[ ! $COMPREPLY && $prev == sources?(tats) ]]; then + # [-v] not handled by _chronyc_command_args yet + COMPREPLY=( $( compgen -W '-v' -- "$cur" ) ) + fi + ;; + 2) + [[ $prev == @(peer|server) ]] && _known_hosts_real "$cur" + ;; + esac +} && +complete -F _chronyc chronyc + +# ex: filetype=sh diff --git a/completions/chrpath b/completions/chrpath new file mode 100644 index 0000000..13e43ad --- /dev/null +++ b/completions/chrpath @@ -0,0 +1,27 @@ +# chrpath(1) completion -*- shell-script -*- + +_chrpath() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -v|--version|-h|--help) + return + ;; + -r|--replace) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _chrpath chrpath + +# ex: filetype=sh diff --git a/completions/cksfv b/completions/cksfv new file mode 100644 index 0000000..dd90816 --- /dev/null +++ b/completions/cksfv @@ -0,0 +1,29 @@ +# cksfv completion by Chris -*- shell-script -*- + +_cksfv() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + case "$prev" in + -C|-g) + _filedir -d + return + ;; + -f) + _filedir 'sfv' + return + ;; + esac + + _filedir + +} && +complete -F _cksfv cksfv + +# ex: filetype=sh diff --git a/completions/cleanarch b/completions/cleanarch new file mode 100644 index 0000000..edac34f --- /dev/null +++ b/completions/cleanarch @@ -0,0 +1,16 @@ +# mailman cleanarch completion -*- shell-script -*- + +_cleanarch() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--status --dry-run --quiet --help' \ + -- "$cur" ) ) + fi + +} && +complete -F _cleanarch cleanarch + +# ex: filetype=sh diff --git a/completions/clisp b/completions/clisp new file mode 100644 index 0000000..23b04f0 --- /dev/null +++ b/completions/clisp @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# bash brogrammable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_clisp() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help --version --license -B -K -M -m -L + -N -E -q --quiet --silent -w -I -ansi -traditional -p -C -norc -i + -c -l -o -x ' -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _clisp -o default clisp + +# ex: filetype=sh diff --git a/completions/clone_member b/completions/clone_member new file mode 100644 index 0000000..fe45e49 --- /dev/null +++ b/completions/clone_member @@ -0,0 +1,25 @@ +# mailman clone_member completion -*- shell-script -*- + +_clone_member() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --remove --admin --quiet + --nomodify --help' -- "$cur" ) ) + fi + +} && +complete -F _clone_member clone_member + +# ex: filetype=sh diff --git a/completions/complete b/completions/complete new file mode 100644 index 0000000..5de2d16 --- /dev/null +++ b/completions/complete @@ -0,0 +1,50 @@ +# bash complete completion -*- shell-script -*- + +_complete() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o) + COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames + nospace plusdirs' -- "$cur" ) ) + return + ;; + + -A) + COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command + directory disabled enabled export file function group helptopic + hostname job keyword running service setopt shopt signal + stopped user variable' -- "$cur" ) ) + return + ;; + + -C) + COMPREPLY=( $( compgen -A command -- "$cur" ) ) + return + ;; + -F) + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + return + ;; + -p|-r) + COMPREPLY=( $( complete -p | command sed -e 's|.* ||' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + return + ;; + + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X" + [[ $1 != compgen ]] && opts+=" -F -C" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + else + COMPREPLY=( $( compgen -A command -- "$cur" ) ) + fi +} && +complete -F _complete compgen complete + +# ex: filetype=sh diff --git a/completions/config_list b/completions/config_list new file mode 100644 index 0000000..653c628 --- /dev/null +++ b/completions/config_list @@ -0,0 +1,27 @@ +# mailman config_list completion -*- shell-script -*- + +_config_list() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -i|-o|--inputfile|--outputfile) + _filedir + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--inputfile --outputfile --checkonly + --verbose --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _config_list config_list + +# ex: filetype=sh diff --git a/completions/configure b/completions/configure new file mode 100644 index 0000000..0e37726 --- /dev/null +++ b/completions/configure @@ -0,0 +1,42 @@ +# bash completion for configure -*- shell-script -*- + +_configure() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-V|--version|--program-prefix|--program-suffix|\ + --program-transform-name) + return + ;; + --*file) + _filedir + return + ;; + --*prefix|--*dir) + _filedir -d + return + ;; + esac + + $split && return + + # if $COMP_CONFIGURE_HINTS is not null, then completions of the form + # --option=SETTING will include 'SETTING' as a contextual hint + [[ "$cur" != -* ]] && return + + if [[ -n $COMP_CONFIGURE_HINTS ]]; then + COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ + awk '/^ --[A-Za-z]/ { print $1; \ + if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g' )" \ + -- "$cur" ) ) + [[ $COMPREPLY == *=* ]] && compopt -o nospace + else + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _configure configure + +# ex: filetype=sh diff --git a/completions/convert b/completions/convert new file mode 100644 index 0000000..59647d5 --- /dev/null +++ b/completions/convert @@ -0,0 +1,324 @@ +# bash completion for ImageMagick -*- shell-script -*- + +_ImageMagick() +{ + case $prev in + -channel) + COMPREPLY=( $( compgen -W 'Red Green Blue Opacity Matte Cyan + Magenta Yellow Black' -- "$cur" ) ) + return + ;; + -colormap) + COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) ) + return + ;; + -colorspace) + COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ + YPbPr YUV CMYK' -- "$cur" ) ) + return + ;; + -compose) + COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus Minus Add + Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen + CopyBlue CopyOpacity' -- "$cur" ) ) + return + ;; + -compress) + COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG Lossless LZW + RLE Zip' -- "$cur" ) ) + return + ;; + -dispose) + COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \ + -- "$cur" ) ) + return + ;; + -encoding) + COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert AdobeStandard + AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode + Wansung' -- "$cur" ) ) + return + ;; + -endian) + COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) ) + return + ;; + -filter) + COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite Hanning + Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell + Lanczos Bessel Sinc' -- "$cur" ) ) + return + ;; + -format) + COMPREPLY=( $( compgen -W "$( convert -list format | awk \ + '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }' )" \ + -- "$cur" ) ) + return + ;; + -gravity) + COMPREPLY=( $( compgen -W 'Northwest North NorthEast West Center + East SouthWest South SouthEast' -- "$cur" ) ) + return + ;; + -intent) + COMPREPLY=( $( compgen -W 'Absolute Perceptual Relative + Saturation' -- "$cur" ) ) + return + ;; + -interlace) + COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) ) + return + ;; + -limit) + COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) ) + return + ;; + -list) + COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource + Type' -- "$cur" ) ) + return + ;; + -map) + COMPREPLY=( $( compgen -W 'best default gray red green blue' \ + -- "$cur" ) ) + _filedir + return + ;; + -noise) + COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative + Impulse Laplacian Poisson' -- "$cur" ) ) + return + ;; + -preview) + COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue Saturation + Brightness Gamma Spiff Dull Grayscale Quantize Despeckle + ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread + Shade Raise Segment Solarize Swirl Implode Wave OilPaint + CharcoalDrawing JPEG' -- "$cur" ) ) + return + ;; + -mask|-profile|-texture|-tile|-write) + _filedir + return + ;; + -type) + COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte + TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte + Optimize' -- "$cur" ) ) + return + ;; + -units) + COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch + PixelsPerCentimeter' -- "$cur" ) ) + return + ;; + -virtual-pixel) + COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) ) + return + ;; + -visual) + COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor + PseudoColor TrueColor DirectColor defaut visualid' \ + -- "$cur" ) ) + return + ;; + esac + + return 1 +} + +_convert() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+adjoin +append +compress +contrast +debug + +dither +endian +gamma +label +map +mask +matte +negate +noise + +page +raise +render +write' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _convert convert + +_mogrify() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +mask +matte +negate +page +raise' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _mogrify mogrify + +_display() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +matte +negate +page +raise +write' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _display display + +_animate() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \ + -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _animate animate + +_identify() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _identify identify + +_montage() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither +endian + +gamma +label +matte +page' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _montage montage + +_composite() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label + +matte +negate +page +write' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _composite composite + +_compare() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _compare compare + +_conjure() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _conjure conjure + +_import() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _import import + +_stream() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _stream stream + +# ex: filetype=sh diff --git a/completions/cowsay b/completions/cowsay new file mode 100644 index 0000000..4f4411a --- /dev/null +++ b/completions/cowsay @@ -0,0 +1,23 @@ +# bash completion for cowsay -*- shell-script -*- + +_cowsay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f) + COMPREPLY=( $( compgen -W \ + '$( cowsay -l 2>/dev/null | tail -n +2 )' -- "$cur" ) ) + return + ;; + esac + + # relevant options completion + COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \ + -- "$cur" ) ) + +} && +complete -F _cowsay -o default cowsay cowthink + +# ex: filetype=sh diff --git a/completions/cpan2dist b/completions/cpan2dist new file mode 100644 index 0000000..9704782 --- /dev/null +++ b/completions/cpan2dist @@ -0,0 +1,37 @@ +# bash completion for cpan2dist -*- shell-script -*- + +_cpan2dist() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --format) + # should remove ":" from COMP_WORDBREAKS, but doesn't work (?) + COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \ + "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ + -- "$cur" ) ) + return + ;; + --banlist|--ignorelist|--modulelist|--logfile) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" ) + local packagelist + for dir in ${cpandirs[@]}; do + [[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && \ + packagelist="$dir/02packages.details.txt.gz" + done + [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \ + $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g' ) ) + fi +} && +complete -F _cpan2dist -o default cpan2dist + +# ex: filetype=sh diff --git a/completions/cpio b/completions/cpio new file mode 100644 index 0000000..36e3fe9 --- /dev/null +++ b/completions/cpio @@ -0,0 +1,78 @@ +# bash completion for cpio -*- shell-script -*- + +_cpio() +{ + local cur prev words cword split + _init_completion -s -n : || return + + # --name value style option + case $prev in + -H|--format) + COMPREPLY=( $( compgen -W \ + 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) + return + ;; + -E|-F|-I|--file|--pattern-file) + _filedir + return + ;; + -R|--owner) + _usergroup + return + ;; + --rsh-command) + compopt -o filenames + COMPREPLY=( $( compgen -c -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through + -? --help --license --usage --version' -- "$cur" ) ) + else + case ${words[1]} in + -o|--create) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B -L -V -C -H -M + -O -F --file --format --message --null + --reset-access-time --verbose --dot --append + --block-size --dereference --io-size --quiet + --force-local --rsh-command --help --version' \ + -- "$cur" ) ) + fi + ;; + -i|--extract) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r -t -s -u -v + -B -S -V -C -E -H -M -R -I -F --file --make-directories + --nonmatching --preserve-modification-time + --numeric-uid-gid --rename --list --swap-bytes --swap + --dot --unconditional --verbose --block-size + --swap-halfwords --io-size --pattern-file --format + --owner --no-preserve-owner --message --force-local + --no-absolute-filenames --sparse --only-verify-crc + --quiet --rsh-command --help --to-stdout --version' \ + -- "$cur" ) ) + fi + ;; + -p*|--pass-through) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v -L -V -R + --null --reset-access-time --make-directories --link + --quiet --preserve-modification-time --unconditional + --verbose --dot --dereference --owner + --no-preserve-owner --sparse --help --version' \ + -- "$cur" ) ) + else + _filedir -d + fi + ;; + esac + fi +} && +complete -F _cpio cpio + +# ex: filetype=sh diff --git a/completions/cppcheck b/completions/cppcheck new file mode 100644 index 0000000..86990dd --- /dev/null +++ b/completions/cppcheck @@ -0,0 +1,91 @@ +# bash completion for cppcheck(1) -*- shell-script -*- + +_cppcheck() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --append|--exitcode-suppressions|--rule-file|--config-excludes-file|\ + --suppressions-list|--includes-file|--include|-i) + _filedir + return + ;; + -D|-U|--rule|--suppress|--template|--max-configs|-h|--help|--version|\ + --errorlist|--config-exclude|-l) + return + ;; + --enable) + # split comma-separated list + split=false + if [[ "$cur" == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=( $( compgen -W 'all warning style performance + portability information unusedFunction missingInclude' \ + -- "$cur" ) ) + $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) + return + ;; + --error-exitcode) + COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) + return + ;; + --file-list) + _filedir + [[ -z $cur || $cur == - ]] && COMPREPLY+=( - ) + return + ;; + -I) + _filedir -d + return + ;; + -j) + COMPREPLY=( $( compgen -W "{2..$(_ncpus)}" -- "$cur" ) ) + return + ;; + --language|-x) + COMPREPLY=( $( compgen -W 'c c++' -- "$cur" ) ) + return + ;; + --std) + COMPREPLY=( $( compgen -W 'c89 c99 c11 c++03 c++11 posix' \ + -- "$cur" ) ) + return + ;; + --platform) + _filedir + COMPREPLY+=( $( compgen -W 'unix32 unix64 win32A win32W win64 + native' -- "$cur" ) ) + return + ;; + -rp|--relative-paths) + if $split; then # -rp without argument is allowed + _filedir -d + return + fi + ;; + --library) + _filedir cfg + return + ;; + --xml-version) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' + fi +} && +complete -F _cppcheck cppcheck + +# ex: filetype=sh diff --git a/completions/crontab b/completions/crontab new file mode 100644 index 0000000..bb8d0e2 --- /dev/null +++ b/completions/crontab @@ -0,0 +1,48 @@ +# crontab(1) completion -*- shell-script -*- + +_crontab() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -u) + _allowed_users + return + ;; + esac + + local -A opts=( [-u]= [-l]= [-r]= [-e]= ) + [[ $OSTYPE == *linux* ]] && opts[-i]= + [[ -d /sys/fs/selinux || -d /selinux ]] && opts[-s]= + + local i + for (( i=0; i < ${#words[@]}-1; i++ )); do + [[ ${words[i]} ]] && unset "opts[${words[i]}]" + case "${words[i]}" in + -l) + unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' + ;; + -e) + unset 'opts[-l]' 'opts[-r]' 'opts[-i]' + ;; + -r) + unset 'opts[-l]' 'opts[-e]' + ;; + -u) + unset 'opts[-i]' + ;; + esac + done + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '${!opts[@]}' -- "$cur" ) ) + return + fi + + # do filenames only if we did not have -l, -r, or -e + [[ "${words[@]}" == *\ -[lre]* ]] || _filedir +} && +complete -F _crontab crontab + +# ex: filetype=sh diff --git a/completions/cryptsetup b/completions/cryptsetup new file mode 100644 index 0000000..9411ad7 --- /dev/null +++ b/completions/cryptsetup @@ -0,0 +1,105 @@ +# bash completion for cryptsetup -*- shell-script -*- + +_cryptsetup_name() +{ + COMPREPLY=( $( compgen -X control -W '$( command ls /dev/mapper )' \ + -- "$cur" ) ) +} + +_cryptsetup_device() +{ + cur=${cur:=/dev/} + _filedir +} + +_cryptsetup() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --key-file|--master-key-file|--header-backup-file|-d) + _filedir + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + COMPREPLY=( $( compgen -W 'create remove status resize luksFormat + luksOpen luksClose luksSuspend luksResume luksAddKey + luksRemoveKey luksKillSlot luksDelKey luksUUID isLuks + luksDump luksHeaderBackup luksHeaderRestore' -- "$cur" ) ) + fi + else + local args + _count_args + case $arg in + create) + case $args in + 2) + _cryptsetup_name + ;; + 3) + _cryptsetup_device + ;; + esac + ;; + remove|status|resize|luksClose|luksSuspend|luksResume) + case $args in + 2) + _cryptsetup_name + ;; + esac + ;; + luksFormat|luksAddKey|luksRemoveKey) + case $args in + 2) + _cryptsetup_device + ;; + 3) + _filedir + ;; + esac + ;; + luksOpen) + case $args in + 2) + _cryptsetup_device + ;; + 3) + _cryptsetup_name + ;; + esac + ;; + luksKillSlot|luksDelKey|luksUUID|isLuks|luksDump) + case $args in + 2) + _cryptsetup_device + ;; + esac + ;; + luksHeaderBackup|luksHeaderRestore) + case $args in + 2) + _cryptsetup_device + ;; + 3) + COMPREPLY=( '--header-backup-file' ) + ;; + esac + ;; + esac + fi + +} && +complete -F _cryptsetup cryptsetup + +# ex: filetype=sh diff --git a/completions/curl b/completions/curl new file mode 100644 index 0000000..8251674 --- /dev/null +++ b/completions/curl @@ -0,0 +1,95 @@ +# curl(1) completion -*- shell-script -*- + +_curl() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --ciphers|--connect-timeout|-C|--continue-at|-F|--form|--form-string|\ + --ftp-account|--ftp-alternative-to-user|-P|--ftp-port|-H|--header|-h|\ + --help|--hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\ + --mail-from|--mail-rcpt|--max-filesize|--max-redirs|-m|--max-time|\ + --pass|--proto|--proto-redir|--proxy-user|--proxy1.0|-Q|--quote|-r|\ + --range|-X|--request|--retry|--retry-delay|--retry-max-time|\ + --socks5-gssapi-service|-t|--telnet-option|--tftp-blksize|-z|\ + --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|\ + --write-out|--resolve|--tlsuser|--tlspassword) + return + ;; + -K|--config|-b|--cookie|-c|--cookie-jar|-D|--dump-header|--egd-file|\ + --key|--libcurl|-o|--output|--random-file|-T|--upload-file|--trace|\ + --trace-ascii|--netrc-file) + _filedir + return + ;; + --cacert|-E|--cert) + _filedir '@(c?(e)rt|cer|pem|der)' + return + ;; + --capath) + _filedir -d + return + ;; + --cert-type|--key-type) + COMPREPLY=( $( compgen -W 'DER PEM ENG' -- "$cur" ) ) + return + ;; + --crlfile) + _filedir crl + return + ;; + -d|--data|--data-ascii|--data-binary|--data-urlencode) + if [[ $cur == \@* ]]; then + cur=${cur:1} + _filedir + COMPREPLY=( "${COMPREPLY[@]/#/@}" ) + fi + return + ;; + --delegation) + COMPREPLY=( $( compgen -W 'none policy always' -- "$cur" ) ) + return + ;; + --engine) + COMPREPLY=( $( compgen -W 'list' -- "$cur" ) ) + return + ;; + --ftp-method) + COMPREPLY=( $( compgen -W 'multicwd nocwd singlecwd' -- "$cur" ) ) + return + ;; + --ftp-ssl-ccc-mode) + COMPREPLY=( $( compgen -W 'active passive' -- "$cur" ) ) + return + ;; + --interface) + _available_interfaces -a + return + ;; + -x|--proxy|--socks4|--socks4a|--socks5|--socks5-hostname) + _known_hosts_real + return + ;; + --pubkey) + _filedir pub + return + ;; + --stderr) + COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + _filedir + return + ;; + --tlsauthtype) + COMPREPLY=( $( compgen -W 'SRP' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _curl curl + +# ex: filetype=sh diff --git a/completions/cvs b/completions/cvs new file mode 100644 index 0000000..fee256f --- /dev/null +++ b/completions/cvs @@ -0,0 +1,390 @@ +# cvs(1) completion -*- shell-script -*- + +_cvs_entries() +{ + local prefix=${cur%/*}/ IFS=$'\n' + [[ -e ${prefix:-}CVS/Entries ]] || prefix="" + entries=( $( cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null ) ) + if [[ $entries ]]; then + entries=( "${entries[@]/#/${prefix:-}}" ) + compopt -o filenames + fi +} + +_cvs_modules() +{ + if [[ -n $prefix ]]; then + COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) ) + else + COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) ) + fi +} + +_cvs_commands() +{ + cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }' +} + +_cvs_command_options() +{ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $2" )' -- "$cur" ) ) +} + +_cvs_kflags() +{ + COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) ) +} + +_cvs_roots() +{ + local -a cvsroots + cvsroots=( $CVSROOT ) + [[ -r ~/.cvspass ]] && cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) ) + [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root + COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) ) + __ltrim_colon_completions "$cur" +} + +_cvs() +{ + local cur prev words cword + _init_completion -n : || return + + local count mode i cvsroot cvsroots pwd + local -a flags files entries changed newremoved + + count=0 + for i in "${words[@]}"; do + [[ $count -eq $cword ]] && break + # Last parameter was the CVSROOT, now go back to mode selection + if [[ "${words[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then + mode="" + fi + if [[ -z $mode ]]; then + case $i in + -H|--help) + COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) ) + return + ;; + -d) + mode=cvsroot + cvsroot=${words[((count+1))]} + ;; + add|ad|new) + mode=add + ;; + admin|adm|rcs) + mode=admin + ;; + annotate|ann|blame|rannotate|rann|ra) + mode=annotate + ;; + checkout|co|get) + mode=checkout + ;; + commit|ci|com) + mode=commit + ;; + diff|di|dif) + mode=diff + ;; + export|ex|exp) + mode=export + ;; + edit|unedit|editors|logout|pserver|server|watch|watchers) + mode=$i + ;; + history|hi|his) + mode=history + ;; + import|im|imp) + mode=import + ;; + log|lo|rlog|rl) + mode=log + ;; + login|logon|lgn) + mode=login + ;; + rdiff|patch|pa) + mode=rdiff + ;; + release|re|rel) + mode=release + ;; + remove|rm|delete) + mode=remove + ;; + rtag|rt|rfreeze) + mode=rtag + ;; + status|st|stat) + mode=status + ;; + tag|ta|freeze) + mode=tag + ;; + update|up|upd) + mode=update + ;; + version|ve|ver) + mode=version + ;; + esac + elif [[ "$i" == -* ]]; then + flags+=( $i ) + fi + count=$((++count)) + done + + case $mode in + add) + case $prev in + -m) + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" != -* ]]; then + _cvs_entries + [[ -z $cur ]] && files=( !(CVS) ) || \ + files=( $( command ls -d ${cur}* 2>/dev/null ) ) + local f + for i in ${!files[@]}; do + if [[ ${files[i]} == ?(*/)CVS ]]; then + unset 'files[i]' + else + for f in "${entries[@]}"; do + if [[ ${files[i]} == $f && ! -d $f ]]; then + unset 'files[i]' + break + fi + done + fi + done + COMPREPLY=( $( compgen -X "$_backup_glob" -W '${files[@]}' \ + -- "$cur" ) ) + else + _cvs_command_options "$1" $mode + fi + ;; + admin) + case $prev in + -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u) + return + ;; + -t) + _filedir + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + fi + ;; + annotate) + [[ "$prev" == -[rD] ]] && return + + if [[ "$cur" == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + fi + ;; + checkout) + case $prev in + -r|-D|-j) + return + ;; + -d) + _filedir -d + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" != -* ]]; then + [[ -z $cvsroot ]] && cvsroot=$CVSROOT + COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \ + awk '{print $1}' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + else + _cvs_command_options "$1" $mode + fi + ;; + commit) + case $prev in + -m|-r) + return + ;; + -F) + _filedir + return + ;; + esac + + if [[ "$cur" != -* ]]; then + # if $COMP_CVS_REMOTE is not null, 'cvs commit' will + # complete on remotely checked-out files (requires + # passwordless access to the remote repository + if [[ -n ${COMP_CVS_REMOTE:-} ]]; then + # this is the least computationally intensive way found so + # far, but other changes (something other than + # changed/removed/new) may be missing + changed=( $( cvs -q diff --brief 2>&1 | \ + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) + newremoved=( $( cvs -q diff --brief 2>&1 | \ + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) + COMPREPLY=( $( compgen -W '${changed[@]:-} \ + ${newremoved[@]:-}' -- "$cur" ) ) + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + fi + else + _cvs_command_options "$1" $mode + fi + ;; + cvsroot) + _cvs_roots + ;; + diff) + if [[ "$cur" == -* ]]; then + _cvs_command_options "$1" $mode + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) + fi + ;; + editors|watchers) + if [[ "$cur" == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + fi + ;; + export) + case $prev in + -r|-D) + return + ;; + -d) + _filedir -d + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" != -* ]]; then + [[ -z $cvsroot ]] && cvsroot=$CVSROOT + COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + else + _cvs_command_options "$1" $mode + fi + ;; + import) + case $prev in + -I|-b|-m|-W) + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" != -* ]]; then + # starts with same algorithm as checkout + [[ -z $cvsroot ]] && cvsroot=$CVSROOT + local prefix=${cur%/*} + if [[ -r ${cvsroot}/${prefix} ]]; then + _cvs_modules + COMPREPLY=( ${COMPREPLY[@]#$cvsroot} ) + COMPREPLY=( ${COMPREPLY[@]#\/} ) + fi + pwd=$( pwd ) + pwd=${pwd##*/} + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- "$cur" ) ) + else + _cvs_command_options "$1" $mode + fi + ;; + remove) + if [[ "$cur" != -* ]]; then + _cvs_entries + if [[ "$prev" != -f ]]; then + # find out what files are missing + for i in ${!entries[@]}; do + [[ -r "${entries[i]}" ]] && unset 'entries[i]' + done + fi + COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) + else + _cvs_command_options "$1" $mode + fi + ;; + update) + case $prev in + -r|-D|-j|-I|-W) + return + ;; + -k) + _cvs_kflags + return + ;; + esac + + if [[ "$cur" == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + fi + ;; + "") + case $prev in + -T) + _filedir -d + return + ;; + -e|-s) + return + ;; + -z) + COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + return + ;; + esac + + COMPREPLY=( $( compgen -W '$( _cvs_commands ) + $( _parse_help "$1" --help-options ) --help --help-commands + --help-options --version' -- "$cur" ) ) + ;; + esac + +} && +complete -F _cvs cvs + +# ex: filetype=sh diff --git a/completions/cvsps b/completions/cvsps new file mode 100644 index 0000000..64dab54 --- /dev/null +++ b/completions/cvsps @@ -0,0 +1,58 @@ +# bash completion for cvsps -*- shell-script -*- + +_cvsps() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -h|-z|-f|-d|-l|--diff-opts|--debuglvl) + return + ;; + -s) + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | + awk '/^PatchSet:?[ \t]/ { print $2 }' )" -- "$cur" ) ) + return + ;; + -a) + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | + awk '/^Author:[ \t]/ { print $2 }' )" -- "$cur" ) ) + return + ;; + -b) + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | + awk '/^Branch:[ \t]/ { print $2 }' )" -- "$cur" ) ) + return + ;; + -r) + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | + awk '/^Tag:[ \t]+[^(]/ { print $2 }' )" -- "$cur" ) ) + return + ;; + -p) + _filedir -d + return + ;; + --test-log) + _filedir + return + ;; + -Z) + COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + return + ;; + --root) + _xfunc cvs _cvs_roots + return + ;; + esac + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + else + _xfunc cvs _cvs_roots + fi +} && +complete -F _cvsps cvsps + +# ex: filetype=sh diff --git a/completions/dd b/completions/dd new file mode 100644 index 0000000..daaebbe --- /dev/null +++ b/completions/dd @@ -0,0 +1,43 @@ +# bash completion for dd -*- shell-script -*- + +_dd() +{ + local cur prev words cword + _init_completion -n = || return + + case $cur in + if=*|of=*) + cur=${cur#*=} + _filedir + return + ;; + conv=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase + ucase sparse swab sync excl nocreat notrunc noerror fdatasync + fsync' -- "$cur" ) ) + return + ;; + iflag=*|oflag=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'append direct directory dsync sync + fullblock nonblock noatime nocache noctty nofollow count_bytes + skip_bytes seek_bytes' -- "$cur" ) ) + return + ;; + status=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'none noxfer progress' -- "$cur" ) ) + return + ;; + esac + + _expand || return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \ + $( compgen -W 'bs cbs conv count ibs if iflag obs of oflag + seek skip status' -S '=' -- "$cur" ) ) +} && +complete -F _dd -o nospace dd + +# ex: filetype=sh diff --git a/completions/deja-dup b/completions/deja-dup new file mode 100644 index 0000000..a508bb1 --- /dev/null +++ b/completions/deja-dup @@ -0,0 +1,33 @@ +# bash completion for deja-dup(1) -*- shell-script -*- + +_deja_dup() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--help-*) + return + ;; + --restore) + _filedir + return + ;; + --restore-missing) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _deja_dup deja-dup + +# ex: filetype=sh diff --git a/completions/desktop-file-validate b/completions/desktop-file-validate new file mode 100644 index 0000000..93f2106 --- /dev/null +++ b/completions/desktop-file-validate @@ -0,0 +1,23 @@ +# desktop-file-validate completion -*- shell-script -*- + +_desktop_file_validate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + _filedir desktop +} && +complete -F _desktop_file_validate desktop-file-validate + +# ex: filetype=sh diff --git a/completions/dhclient b/completions/dhclient new file mode 100644 index 0000000..8b44f6c --- /dev/null +++ b/completions/dhclient @@ -0,0 +1,28 @@ +# bash completion for dhclient -*- shell-script -*- + +_dhclient() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -cf|-lf|-pf|-sf) + _filedir + return + ;; + -s) + _known_hosts_real "$cur" + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf -cf -sf -s -g -n -nw + -w' -- "$cur" ) ) + else + _available_interfaces + fi +} && +complete -F _dhclient dhclient + +# ex: filetype=sh diff --git a/completions/dict b/completions/dict new file mode 100644 index 0000000..ac7df3f --- /dev/null +++ b/completions/dict @@ -0,0 +1,67 @@ +# dict(1) completion -*- shell-script -*- + +_dictdata() +{ + dict $host $port $1 2>/dev/null | command sed -ne \ + 's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p' +} + +_dict() +{ + local cur prev words cword + _init_completion || return + + local host port db i + + for (( i=1; i < cword; i++ )); do + case ${words[i]} in + -h|--host) + host=${words[i+1]} + [[ -n $host ]] && host="-h $host" + i=$((++i)) + ;; + -p|--port) + port=${words[i+1]} + [[ -n $port ]] && port="-p $port" + i=$((++i)) + ;; + -d|--database) + db=${words[i+1]} + [[ -n $db ]] && host="-d $db" + i=$((++i)) + ;; + esac + done + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + case $prev in + -d|--database|-i|-info) + COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) + return + ;; + -s|--strategy) + COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) + return + ;; + esac + + local dictfile=/usr/share/dict/words + if [[ -r $dictfile ]]; then + # Dictfile may be too large for practical compgen -W usage, so narrow + # it down with grep if $cur looks like something that's safe to embed + # in a pattern instead. + if [[ $cur == +([-A-Za-z0-9/.]) ]]; then + COMPREPLY=( $( compgen -W \ + '$( command grep "^${cur//./\\.}" $dictfile )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) ) + fi + fi +} && +complete -F _dict -o default dict rdict + +# ex: filetype=sh diff --git a/completions/dnsspoof b/completions/dnsspoof new file mode 100644 index 0000000..d6b7872 --- /dev/null +++ b/completions/dnsspoof @@ -0,0 +1,26 @@ +# dnsspoof completion -*- shell-script -*- + +_dnsspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -f) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _dnsspoof dnsspoof + +# ex: filetype=sh diff --git a/completions/dot b/completions/dot new file mode 100644 index 0000000..bc3531b --- /dev/null +++ b/completions/dot @@ -0,0 +1,45 @@ +# dot(1) completion -*- shell-script -*- + +_dot() +{ + local cur prev words cword + _init_completion -n := || return + + [[ $prev == -[V?] ]] && return + + case $cur in + -G*|-N*|-E*|-l?*|-q?*|-s?*|-Ln*|-LU*|-LC*|-LT*) + return + ;; + -T*) + local langs=( $( "$1" -TNON_EXISTENT 2>&1 | \ + command sed -ne 's/.*one of://p' ) ) + COMPREPLY=( $( compgen -P -T -W '${langs[@]}' -- "${cur#-T}" ) ) + return + ;; + -K*) + local layouts=( $( "$1" -KNON_EXISTENT 2>&1 | \ + command sed -ne 's/.*one of://p' ) ) + COMPREPLY=( $( compgen -P -K -W '${layouts[@]}' -- "${cur#-K}" ) ) + return + ;; + -o*) + cur=${cur#-o} + _filedir + COMPREPLY=( $( compgen -P -o -W '${COMPREPLY[@]}' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n + -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur" ) ) + [[ $COMPREPLY == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace + return + fi + + _filedir dot +} && +complete -F _dot dot + +# ex: filetype=sh diff --git a/completions/dpkg b/completions/dpkg new file mode 100644 index 0000000..725542a --- /dev/null +++ b/completions/dpkg @@ -0,0 +1,120 @@ +# This function is required by _dpkg and _dpkg-reconfigure -*- shell-script -*- + +_have grep-status && { +_comp_dpkg_installed_packages() +{ + grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package +} +} || { +_comp_dpkg_installed_packages() +{ + command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | \ + command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ + half-configured" \ + -Ee "^Essential: yes" | \ + awk "/Package: $1/ { print \$2 }" 2>/dev/null +} +} + +_have grep-status && { +_comp_dpkg_purgeable_packages() +{ + grep-status -P -e "^$1" -a -FStatus 'install ok installed' -o -FStatus 'deinstall ok config-files' -n -s Package +} +} || { +_comp_dpkg_purgeable_packages() +{ + command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | \ + command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ + half-configured|config-files" \ + -Ee "^Essential: yes" | \ + awk "/Package: $1/ { print \$2 }" 2>/dev/null +} +} + +# Debian dpkg(8) completion +# +_dpkg() +{ + local cur prev words cword split + _init_completion -s || return + + local i=$cword + + # find the last option flag + if [[ $cur != -* ]]; then + while [[ $prev != -* && $i -ne 1 ]]; do + i=$((i-1)) + prev=${words[i-1]} + done + fi + + case $prev in + -c|-i|-A|-I|-f|-e|-x|-X|-W|--install|--unpack|--record-avail| \ + --contents|--info|--fsys-tarfile|--field|--control|--extract| \ + --show) + _filedir '?(u|d)deb' + return + ;; + -b|--build) + _filedir -d + return + ;; + -s|-p|-l|--status|--print-avail|--list) + COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) + return + ;; + -S|--search) + _filedir + return + ;; + -r|--remove) + COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) + return + ;; + -L|-P|--listfiles|--purge) + COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _dpkg dpkg dpkg-deb dpkg-query + +# Debian GNU dpkg-reconfigure(8) completion +# +_dpkg_reconfigure() +{ + local cur prev words cword + _init_completion || return + + local opt + + case $prev in + -f|--frontend) + opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) ) + opt=( ${opt[@]##*/} ) + opt=( ${opt[@]%.pm} ) + COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) ) + return + ;; + -p|--priority) + COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '--frontend --priority --all --unseen-only + --help --showold --force --terse' -- "$cur" ) ) + else + COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) + fi +} && +complete -F _dpkg_reconfigure -o default dpkg-reconfigure + +# ex: filetype=sh diff --git a/completions/dpkg-source b/completions/dpkg-source new file mode 100644 index 0000000..5440385 --- /dev/null +++ b/completions/dpkg-source @@ -0,0 +1,98 @@ +# Debian dpkg-source completion -*- shell-script -*- + +_dpkg_source() +{ + local cur prev words cword + _init_completion || return + + local options work i action packopts unpackopts fields + + packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ + -sU -sR" + unpackopts="-sp -sn -su" + options="-x -b $packopts $unpackopts" + fields="Format Source Version Binary Maintainer Uploader Architecture \ + Standards-Version Build-Depends Files" + + action="options" + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[$i]} == "-x" ]]; then + action=unpack + elif [[ ${words[$i]} == "-b" ]]; then + action=pack + elif [[ ${words[$i]} == "-h" ]]; then + action=help + fi + done + + case $action in + unpack) + case $prev in + -x) + _filedir -d + _filedir 'dsc' + ;; + *) + COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) + _filedir -d + _filedir + ;; + esac + return + ;; + pack) + case $prev in + -b) + _filedir -d + ;; + -c|-l|-T|-i|-I) + # -c: get controlfile + # -l: get per-version info from this file + # -T: read variables here, not debian/substvars + # -i: filter out files to ignore diffs of. + # -I: filter out files when building tarballs. + # return directory names and file names + _filedir -d + _filedir + ;; + -F) + # -F: force change log format + COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) + ;; + -V|-D) + # -V: set a substitution variable + # we don't know anything about possible variables or values + # so we don't try to suggest any completion. + COMPREPLY=() + ;; + -D) + # -D: override or add a .dsc field and value + # if $cur doesn't contain a = yet, suggest variable names + if [[ "$cur" == *=* ]]; then + # $cur contains a "=" + COMPREPLY=() + else + COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + fi + ;; + -U) + # -U: remove a field + # Suggest possible fieldnames + COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$packopts $unpackopts" \ + -- "$cur" ) ) + ;; + esac + return + ;; + *) + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + return + ;; + esac +} && +complete -F _dpkg_source dpkg-source + +# ex: filetype=sh diff --git a/completions/dselect b/completions/dselect new file mode 100644 index 0000000..e5f148c --- /dev/null +++ b/completions/dselect @@ -0,0 +1,30 @@ +# Debian Linux dselect(8) completion -*- shell-script -*- + +_dselect() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --admindir) + _filedir -d + return + ;; + -D|-debug) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--admindir --help --version --licence + --expert --debug' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'access update select install config remove + quit' -- "$cur" ) ) + fi + +} && +complete -F _dselect dselect + +# ex: filetype=sh diff --git a/completions/dsniff b/completions/dsniff new file mode 100644 index 0000000..165ab74 --- /dev/null +++ b/completions/dsniff @@ -0,0 +1,26 @@ +# dsniff completion -*- shell-script -*- + +_dsniff() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -r|-w|-f|-p) + _filedir + return + ;; + -i) + _available_interfaces -a + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -r -w -p' -- "$cur" ) ) + fi + +} && +complete -F _dsniff dsniff + +# ex: filetype=sh diff --git a/completions/dumpdb b/completions/dumpdb new file mode 100644 index 0000000..ced754f --- /dev/null +++ b/completions/dumpdb @@ -0,0 +1,18 @@ +# mailman dumpdb completion -*- shell-script -*- + +_dumpdb() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--marshal --pickle --noprint --help' \ + -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _dumpdb dumpdb + +# ex: filetype=sh diff --git a/completions/dumpe2fs b/completions/dumpe2fs new file mode 100644 index 0000000..90f8479 --- /dev/null +++ b/completions/dumpe2fs @@ -0,0 +1,28 @@ +# dumpe2fs(8) completion -*- shell-script -*- + +_dumpe2fs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-V) + return + ;; + -i) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _dumpe2fs dumpe2fs + +# ex: filetype=sh diff --git a/completions/e2freefrag b/completions/e2freefrag new file mode 100644 index 0000000..bee4a16 --- /dev/null +++ b/completions/e2freefrag @@ -0,0 +1,24 @@ +# e2freefrag(8) completion -*- shell-script -*- + +_e2freefrag() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c|-h) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) + return + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _e2freefrag e2freefrag + +# ex: filetype=sh diff --git a/completions/e2label b/completions/e2label new file mode 100644 index 0000000..c145c3a --- /dev/null +++ b/completions/e2label @@ -0,0 +1,15 @@ +# e2label(8) completion -*- shell-script -*- + +_e2label() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + cur=${cur:=/dev/} + _filedir + fi +} && +complete -F _e2label e2label + +# ex: filetype=sh diff --git a/completions/eog b/completions/eog new file mode 100644 index 0000000..d562111 --- /dev/null +++ b/completions/eog @@ -0,0 +1,27 @@ +# eog(1) completion -*- shell-script -*- + +_eog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--help-all|--help-gtk) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir '@(ani|?(w)bmp|gif|ico|j2[ck]|jp[cefgx2]|jpeg|jpg2|pcx|p[gp]m|pn[gm]|ras|svg?(z)|tga|tif?(f)|x[bp]m)' +} && +complete -F _eog eog + +# ex: filetype=sh diff --git a/completions/ether-wake b/completions/ether-wake new file mode 100644 index 0000000..387b2d6 --- /dev/null +++ b/completions/ether-wake @@ -0,0 +1,27 @@ +# ether-wake(8) completion -*- shell-script -*- + +_ether_wake() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -p) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) + return + fi + + _mac_addresses +} && +complete -F _ether_wake ether-wake + +# ex: filetype=sh diff --git a/completions/evince b/completions/evince new file mode 100644 index 0000000..eb6c730 --- /dev/null +++ b/completions/evince @@ -0,0 +1,33 @@ +# evince(1) completion -*- shell-script -*- + +_evince() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help*|-h|--sm-client-id|--class|--name|--screen|--gdk-debug|\ + --gdk-no-debug|--gtk-module|--gtk-debug|--gtk-no-debug|\ + -p|--page-label|-i|--page-index|-l|--find|--display) + return + ;; + --sm-client-state-file) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir '@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2|.xz|.XZ)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' +} && +complete -F _evince evince + +# ex: filetype=sh diff --git a/completions/explodepkg b/completions/explodepkg new file mode 100644 index 0000000..a281f81 --- /dev/null +++ b/completions/explodepkg @@ -0,0 +1,5 @@ +# Slackware Linux explodepkg completion -*- shell-script -*- + +complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg + +# ex: filetype=sh diff --git a/completions/export b/completions/export new file mode 100644 index 0000000..31715f9 --- /dev/null +++ b/completions/export @@ -0,0 +1,66 @@ +# bash export completion -*- shell-script -*- + +_export() +{ + local cur prev words cword + _init_completion -n = || return + + local i action=variable remove=false + for (( i=1; i < cword; i++ )); do + case ${words[i]} in + -p) + return + ;; + -*f*) + action=function + ;;& + -*n*) + remove=true + ;; + -*) + continue + ;; + esac + break + done + + if [[ $cur == *=* ]]; then + local ocur=$cur oprev=$prev + prev=${cur%%=*} cur=${cur#*=} + _variables && return + cur=$ocur prev=$oprev + fi + + case $cur in + *=) + local pval=$( quote "$( eval printf %s \"\$${cur%=}\" )" ) + # Complete previous value if it's not empty. + if [[ $pval != \'\' ]]; then + COMPREPLY=( "$pval" ) + else + cur=${cur#*=} + _filedir + fi + ;; + *=*) + cur=${cur#*=} + _filedir + ;; + *) + if [[ $cword -eq 1 && $cur == -* ]]; then + COMPREPLY=( $( compgen -W \ + '-p $( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + local suffix + if ! $remove; then + suffix+== + compopt -o nospace + fi + COMPREPLY=( $( compgen -A $action -S "$suffix" -- "$cur" ) ) + ;; + esac +} && +complete -F _export export + +# ex: filetype=sh diff --git a/completions/faillog b/completions/faillog new file mode 100644 index 0000000..3b4a23d --- /dev/null +++ b/completions/faillog @@ -0,0 +1,27 @@ +# faillog(8) completion -*- shell-script -*- + +_faillog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-l|--lock-time|-m|--maximum|-t|--time) + return + ;; + -u|--user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _faillog faillog + +# ex: filetype=sh diff --git a/completions/fbgs b/completions/fbgs new file mode 100644 index 0000000..c58a7af --- /dev/null +++ b/completions/fbgs @@ -0,0 +1,50 @@ +# bash completion for fbgs(1) -*- shell-script -*- + +_fbgs() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -f|--font) + local IFS=$'\n' + COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) + return + ;; + -m|--mode) + COMPREPLY=( $( compgen -W '$( command sed \ + -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ + /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) + return + ;; + -d|--device) + COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + return + ;; + -fp|--firstpage|-lp|--lastpage|-r|--resolution|-s|--scroll|-t|\ + --timeout) + # expect integer value + COMPREPLY+=( $( compgen -W '{0..9}' ) ) + compopt -o nospace + return + ;; + -T|--vt|-p|--password|-g|--gamma) + # argument required but no completions available + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--bell --help --password -fp --firstpage + -lp --lastpage --color -l -xl -xxl --resolution --autozoom + --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose + --{,no}random --vt --scroll --timeout --{,no}once --gamma --font + --device --mode' -- "$cur" ) ) + [[ $COMPREPLY ]] && return + fi + + _filedir '?(e)ps|pdf' +} && +complete -F _fbgs fbgs + +# ex: filetype=sh diff --git a/completions/fbi b/completions/fbi new file mode 100644 index 0000000..75b46b6 --- /dev/null +++ b/completions/fbi @@ -0,0 +1,54 @@ +# bash completion for fbi(1) -*- shell-script -*- + +_fbi() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -l|--list) + _filedir + return + ;; + -r|--resolution) + COMPREPLY+=( $( compgen -W '{1..5}' ) ) + return + ;; + -f|--font) + local IFS=$'\n' + COMPREPLY=( $( compgen -W '$( fc-list 2> /dev/null )' -- "$cur" ) ) + return + ;; + -m|--mode) + COMPREPLY=( $( compgen -W '$( command sed \ + -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ + /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) + return + ;; + -d|--device) + COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + return + ;; + --cachemem|--blend|-T|--vt|-s|--scroll|-t|--timeout|-g|--gamma) + # argument required but no completions available + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version --store --list --text + --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth + --{,no}verbose --{,no}random --{,no}comments --{,no}edit + --{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend + --vt --scroll --timeout --{,no}once --resolution --gamma --font + --device --mode' -- "$cur" ) ) + [[ $COMPREPLY ]] && return + fi + + # FIXME: It is hard to determine correct supported extensions. + # fbi can handle any format that imagemagick can plus some others + _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' +} && +complete -F _fbi fbi + +# ex: filetype=sh diff --git a/completions/feh b/completions/feh new file mode 100644 index 0000000..1cd7542 --- /dev/null +++ b/completions/feh @@ -0,0 +1,115 @@ +# bash completion for feh(1) -*- shell-script -*- + +_feh() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -B|--image-bg) + COMPREPLY=( $( compgen -W 'checks white black' -- "$cur" ) ) + return + ;; + -f|--filelist|-o|--output|-O|--output-only|-\||--start-at) + _filedir + return + ;; + -K|--caption-path|-C|--fontpath|-j|--output-dir) + _filedir -d + return + ;; + -e|--font|-M|--menu-font|-@|--title-font) + # expect string like "dejavu.ttf/12" + if [[ "$cur" == */* ]]; then # expect integer value + COMPREPLY=( $( compgen -P "$cur" -W '{0..9}' ) ) + compopt -o nospace + return + fi + local font_path + # font_path="$( imlib2-config --prefix 2> /dev/null )/share/imlib2/data/fonts" + # COMPREPLY=( $( cd "$font_path" 2> /dev/null; compgen -f \ + # -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) ) + for (( i=${#words[@]}-1; i>0; i-- )); do + if [[ ${words[i]} == -@(C|-fontpath) ]]; then + font_path="${words[i+1]}" + COMPREPLY+=( $( cd "$font_path" 2> /dev/null; compgen -f \ + -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) ) + fi + done + compopt -o nospace + return + ;; + -T|--theme) + local conf_path=~/.config/feh/themes + local theme_name theme_opts + [[ -r $conf_path ]] || return + while read theme_name theme_opts; do + if [[ "$theme_name" == '#'* || "$theme_name" == "" ]]; then + continue + fi + COMPREPLY+=( $( compgen -W "$theme_name" -- "$cur" ) ) + done < "$conf_path" + return + ;; + -S|--sort) + COMPREPLY=( $( compgen -W 'name filename mtime width height + pixels size format' -- "$cur" ) ) + return + ;; + -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\ + -y|--thumb-width|-J|--thumb-redraw|--magick-timeout) + # expect integer value + COMPREPLY+=( $( compgen -W '{0..9}' ) ) + compopt -o nospace + return + ;; + --zoom) + # expect integer value or "max", "fill" + COMPREPLY=( $( compgen -W 'max fill' -- "$cur" ) ) + if [[ ! $cur || ! $COMPREPLY ]]; then + COMPREPLY+=( $( compgen -W '{0..9}' ) ) + compopt -o nospace + fi + return + ;; + -a|--alpha) + COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) + return + ;; + -b|--bg) + _filedir + COMPREPLY+=( $( compgen -W 'trans' -- "$cur" ) ) + return + ;; + -g|--geometry|--max-dimension|--min-dimension) + # expect string like 640x480 + if [[ $cur && "$cur" != *x* ]]; then + COMPREPLY=( x ) + fi + COMPREPLY+=( $( compgen -W "{0..9}" ) ) + compopt -o nospace + return + ;; + -L|--customlist|--index-info|--info|-D|--slideshow-delay|-~|\ + --thumb-title|-^|--title) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + # Some versions of feh just output "See 'man feh'" for --help :( + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + [[ $COMPREPLY ]] && return + fi + + # FIXME: It is hard to determine correct supported extensions. + # feh can handle any format that imagemagick can plus some others + _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' +} && +complete -F _feh feh + +# ex: filetype=sh diff --git a/completions/file b/completions/file new file mode 100644 index 0000000..f3f6df8 --- /dev/null +++ b/completions/file @@ -0,0 +1,32 @@ +# file(1) completion -*- shell-script -*- + +_file() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|-v|--version|-F|--separator) + return + ;; + -m|--magic-file|-f|--files-from) + _filedir + return + ;; + -e|--exclude) + COMPREPLY=( $( compgen -W 'apptype ascii cdf compress elf encoding + soft tar text tokens troff' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _file file + +# ex: filetype=sh diff --git a/completions/file-roller b/completions/file-roller new file mode 100644 index 0000000..3c62758 --- /dev/null +++ b/completions/file-roller @@ -0,0 +1,43 @@ +# file-roller(1) completion -*- shell-script -*- + +_file_roller() +{ + local cur prev words cword split + _init_completion -s || return + + local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lzh|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' + + case $prev in + -'?'|--help|--help-all|--help-gtk|--help-sm-client) + return + ;; + --sm-client-state-file) + _filedir + return + ;; + -a|--add-to) + _filedir_xspec unzip + _filedir "$exts" + return + ;; + -e|--extract-to|--default-dir) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir_xspec unzip + _filedir "$exts" +} && +complete -F _file_roller file-roller + +# ex: filetype=sh diff --git a/completions/filefrag b/completions/filefrag new file mode 100644 index 0000000..b4866dc --- /dev/null +++ b/completions/filefrag @@ -0,0 +1,17 @@ +# filefrag(8) completion -*- shell-script -*- + +_filefrag() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _filefrag filefrag + +# ex: filetype=sh diff --git a/completions/filesnarf b/completions/filesnarf new file mode 100644 index 0000000..0cdcfe2 --- /dev/null +++ b/completions/filesnarf @@ -0,0 +1,22 @@ +# filesnarf etc completion -*- shell-script -*- + +_snarf() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _snarf filesnarf mailsnarf msgsnarf + +# ex: filetype=sh diff --git a/completions/find b/completions/find new file mode 100644 index 0000000..3902934 --- /dev/null +++ b/completions/find @@ -0,0 +1,114 @@ +# bash completion for GNU find -*- shell-script -*- +# This makes heavy use of ksh style extended globs and contains Linux specific +# code for completing the parameter to the -fstype option. + +_find() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -maxdepth|-mindepth) + COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) + return + ;; + -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\ + -lname|-ilname|-wholename|-iwholename|-samefile) + _filedir + return + ;; + -fstype) + _fstypes + [[ $OSTYPE == *bsd* ]] && \ + COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) ) + return + ;; + -gid) + _gids + return + ;; + -group) + COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) ) + return + ;; + -xtype|-type) + COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) ) + return + ;; + -uid) + _uids + return + ;; + -user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + -exec|-execdir|-ok|-okdir) + words=(words[0] "$cur") + cword=1 + _command + return + ;; + -[acm]min|-[acm]time|-iname|-lname|-wholename|-iwholename|-lwholename|\ + -ilwholename|-inum|-path|-ipath|-regex|-iregex|-links|-perm|-size|\ + -used|-printf|-context) + # do nothing, just wait for a parameter to be given + return + ;; + -regextype) + COMPREPLY=( $( compgen -W 'emacs posix-awk posix-basic posix-egrep + posix-extended' -- "$cur" ) ) + return + ;; + esac + + _expand || return + + local i exprfound=false + # set exprfound to true if there is already an expression present + for i in ${words[@]}; do + [[ "$i" == [-\(\),\!]* ]] && exprfound=true && break + done + + # handle case where first parameter is not a dash option + if ! $exprfound && [[ "$cur" != [-\(\),\!]* ]]; then + _filedir -d + return + fi + + # complete using basic options + COMPREPLY=( $( compgen -W '-daystart -depth -follow -help + -ignore_readdir_race -maxdepth -mindepth -mindepth -mount + -noignore_readdir_race -noleaf -regextype -version -warn -nowarn -xdev + -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false + -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename + -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm + -readable -regex -samefile -size -true -type -uid -used -user + -wholename -writable -xtype -context -delete -exec -execdir -fls + -fprint -fprint0 -fprintf -ls -ok -okdir -print -print0 -printf -prune + -quit' -- "$cur" ) ) + + if [[ ${#COMPREPLY[@]} -ne 0 ]]; then + # this removes any options from the list of completions that have + # already been specified somewhere on the command line, as long as + # these options can only be used once (in a word, "options", in + # opposition to "tests" and "actions", as in the find(1) manpage). + local -A onlyonce=( [-daystart]=1 [-depth]=1 [-follow]=1 [-help]=1 + [-ignore_readdir_race]=1 [-maxdepth]=1 [-mindepth]=1 [-mount]=1 + [-noignore_readdir_race]=1 [-noleaf]=1 [-nowarn]=1 [-regextype]=1 + [-version]=1 [-warn]=1 [-xdev]=1 ) + local j + for i in "${words[@]}"; do + [[ $i && ${onlyonce[$i]} ]] || continue + for j in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[j]} == $i ]] && unset 'COMPREPLY[j]' + done + done + fi + + _filedir + +} && +complete -F _find find + +# ex: filetype=sh diff --git a/completions/find_member b/completions/find_member new file mode 100644 index 0000000..df1a24f --- /dev/null +++ b/completions/find_member @@ -0,0 +1,25 @@ +# mailman find_member completion -*- shell-script -*- + +_find_member() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|-x|--listname|--exclude) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --exclude --owners --help' \ + -- "$cur" ) ) + fi + +} && +complete -F _find_member find_member + +# ex: filetype=sh diff --git a/completions/flake8 b/completions/flake8 new file mode 100644 index 0000000..60ad9e2 --- /dev/null +++ b/completions/flake8 @@ -0,0 +1,35 @@ +# flake8 completion -*- shell-script -*- + +_flake8() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--version|--exclude|--filename|--select|--ignore|\ + --max-line-length|--max-complexity|--builtins) + return + ;; + --format) + COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) ) + return + ;; + --config) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _flake8 flake8 + +# ex: filetype=sh diff --git a/completions/freebsd-update b/completions/freebsd-update new file mode 100644 index 0000000..6ee2438 --- /dev/null +++ b/completions/freebsd-update @@ -0,0 +1,29 @@ +# bash completion for FreeBSD update tool - freebsd-update -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_freebsd_update() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-d) + _filedir -d + return + ;; + -f) + _filedir + return + ;; + -k|-r|-s|-t) + return + ;; + esac + + COMPREPLY=( $(compgen -W "fetch cron upgrade install rollback IDS" -- \ + $cur) ) +} && +complete -F _freebsd_update freebsd-update + +# ex: filetype=sh diff --git a/completions/freeciv-gtk2 b/completions/freeciv-gtk2 new file mode 100644 index 0000000..246d4f2 --- /dev/null +++ b/completions/freeciv-gtk2 @@ -0,0 +1,30 @@ +# freeciv client completions -*- shell-script -*- + +_civclient() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l|-S|-t|--log|--Sound|--tiles) + _filedir + return + ;; + -P|--Plugin) + COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) ) + return + ;; + -s|--server) + _known_hosts_real "$cur" + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _civclient civclient freeciv-gtk2 freeciv-sdl freeciv-xaw + +# ex: filetype=sh diff --git a/completions/freeciv-server b/completions/freeciv-server new file mode 100644 index 0000000..78f57af --- /dev/null +++ b/completions/freeciv-server @@ -0,0 +1,22 @@ +# freeciv-server completion -*- shell-script -*- + +_civserver() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|-g|-l|-r|--file|--log|--gamelog|--read) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _civserver civserver freeciv-server + +# ex: filetype=sh diff --git a/completions/function b/completions/function new file mode 100644 index 0000000..fbcf10d --- /dev/null +++ b/completions/function @@ -0,0 +1,37 @@ +# bash shell function completion -*- shell-script -*- + +_function() +{ + local cur prev words cword + _init_completion || return + + if [[ $1 == @(declare|typeset) ]]; then + if [[ $cur == [-+]* ]]; then + local opts + opts=( $( _parse_usage "$1" ) ) + # Most options also have a '+' form. We'll exclude the ones that don't with compgen. + opts+=( ${opts[*]/-/+} ) + COMPREPLY=( $( compgen -W "${opts[*]}" -X '+[Ffgp]' -- "$cur" ) ) + else + local i=1 + while [[ ${words[i]} == [-+]* ]]; do + if [[ ${words[i]} == -*[fF]* ]]; then + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + return + fi + ((i++)) + done + if [[ $i -gt 1 ]]; then + # There was at least one option and it was not one that limited operations to functions + COMPREPLY=( $( compgen -A variable -- "$cur" ) ) + fi + fi + elif [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + else + COMPREPLY=( "() $( type -- ${words[1]} | command sed -e 1,2d )" ) + fi +} && +complete -F _function function declare typeset + +# ex: filetype=sh diff --git a/completions/fusermount b/completions/fusermount new file mode 100644 index 0000000..23671bd --- /dev/null +++ b/completions/fusermount @@ -0,0 +1,28 @@ +# fusermount completion -*- shell-script -*- + +_fusermount() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|-V|-o) + return + ;; + -u) + COMPREPLY=( $( compgen -W "$( awk \ + '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ + 2>/dev/null )" -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + else + _filedir -d + fi +} && +complete -F _fusermount fusermount + +# ex: filetype=sh diff --git a/completions/gcc b/completions/gcc new file mode 100644 index 0000000..174e071 --- /dev/null +++ b/completions/gcc @@ -0,0 +1,67 @@ +# gcc(1) completion -*- shell-script -*- +# +# The only unusual feature is that we don't parse "gcc --help -v" output +# directly, because that would include the options of all the other backend +# tools (linker, assembler, preprocessor, etc) without any indication that +# you cannot feed such options to the gcc driver directly. (For example, the +# linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we +# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the +# --help output of the compiler. + +_gcc() +{ + local cur prev words cword + _init_completion || return + + _expand || return + + local cc backend + + case $1 in + gcj) + backend=jc1 + ;; + gpc) + backend=gpc1 + ;; + *77) + backend=f771 + ;; + *95) + backend=f951 + ;; + *) + backend=cc1 # (near-)universal backend + ;; + esac + + if [[ "$cur" == -* ]]; then + cc=$( $1 -print-prog-name=$backend 2>/dev/null ) + [[ $cc ]] || return + # sink stderr: + # for C/C++/ObjectiveC it's useless + # for FORTRAN/Java it's an error + COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\ + command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir + fi +} && +complete -F _gcc gcc g++ gfortran g77 g95 gcj gpc && +{ + cc --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand cc ) == *gcc* ]] && \ + complete -F _gcc cc || complete -F _minimal cc + c++ --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand c++ ) == *g++* ]] && \ + complete -F _gcc c++ || complete -F _minimal c++ + f77 --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand f77 ) == *gfortran* ]] && \ + complete -F _gcc f77 || complete -F _minimal f77 + f95 --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand f95 ) == *gfortran* ]] && \ + complete -F _gcc f95 || complete -F _minimal f95 +} + +# ex: filetype=sh diff --git a/completions/gcl b/completions/gcl new file mode 100644 index 0000000..5d1ca5f --- /dev/null +++ b/completions/gcl @@ -0,0 +1,21 @@ +# -*- shell-script -*- +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_gcl() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir -compile + -o-file -c-file -h-file -data-file -system-p' -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _gcl -o default gcl + +# ex: filetype=sh diff --git a/completions/gdb b/completions/gdb new file mode 100644 index 0000000..7541478 --- /dev/null +++ b/completions/gdb @@ -0,0 +1,46 @@ +# bash completion for gdb -*- shell-script -*- + +_gdb() +{ + local cur prev words cword i + _init_completion || return + + # gdb [options] --args executable-file [inferior-arguments ...] + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == --args ]]; then + _command_offset $((i+1)) + return $? + fi + done + + # gdb [options] [executable-file [core-file or process-id]] + if [[ $cword -eq 1 ]]; then + local IFS + compopt -o filenames + if [[ "$cur" == */* ]]; then + # compgen -c works as expected if $cur contains any slashes. + IFS=$'\n' + COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) ) + else + # otherwise compgen -c contains Bash's built-in commands, + # functions and aliases. Thus we need to retrieve the program + # names manually. + IFS=":" + local path_array=( $( \ + command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) ) + IFS=$'\n' + COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ + -mindepth 1 -maxdepth 1 -not -type d -executable \ + -printf "%f\\n" 2>/dev/null)' -- "$cur" ) ) + fi + elif [[ $cword -eq 2 ]]; then + COMPREPLY=( $( compgen -W "$( command ps axo comm,pid | \ + awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}' )" -- "$cur" ) ) + compopt -o filenames + COMPREPLY+=( $( compgen -f -X '!?(*/)core?(.+([0-9]))' -o plusdirs \ + -- "$cur" ) ) + fi +} && +complete -F _gdb gdb + +# ex: filetype=sh diff --git a/completions/genaliases b/completions/genaliases new file mode 100644 index 0000000..f9a9890 --- /dev/null +++ b/completions/genaliases @@ -0,0 +1,15 @@ +# mailman genaliases completion -*- shell-script -*- + +_genaliases() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) ) + fi + +} && +complete -F _genaliases genaliases + +# ex: filetype=sh diff --git a/completions/gendiff b/completions/gendiff new file mode 100644 index 0000000..cb9bab3 --- /dev/null +++ b/completions/gendiff @@ -0,0 +1,12 @@ +# gendiff(1) completion -*- shell-script -*- + +_gendiff() +{ + local cur prev words cword + _init_completion -o '@(diff|patch)' || return + + [[ $cword -eq 1 ]] && _filedir -d +} && +complete -F _gendiff gendiff + +# ex: filetype=sh diff --git a/completions/genisoimage b/completions/genisoimage new file mode 100644 index 0000000..caf6d45 --- /dev/null +++ b/completions/genisoimage @@ -0,0 +1,38 @@ +# bash completion for mkisofs/genisoimage -*- shell-script -*- + +_mkisofs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-abstract|-biblio|-check-session|-copyright|-log-file| \ + -root-info|-prep-boot|-*-list) + _filedir + return + ;; + -*-charset) + COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \ + help 2>&1 | tail -n +3 )' -- "$cur" ) ) + return + ;; + -uid) + _uids + return + ;; + -gid) + _gids + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _mkisofs mkisofs genisoimage + +# ex: filetype=sh diff --git a/completions/getent b/completions/getent new file mode 100644 index 0000000..0658b0b --- /dev/null +++ b/completions/getent @@ -0,0 +1,78 @@ +# bash completion for getent -*- shell-script -*- + +_getent() +{ + local cur prev words cword split + _init_completion -s || return + + local i db + for (( i=1; i < cword; i++ )); do + case ${words[i]} in + -V|--version|--usage|-'?'|--help) + return + ;; + -s|--service) + (( i++ )) + ;; + -*) + ;; + *) + # First non-option value is the db + db=${words[i]} + break + ;; + esac + done + + case $db in + passwd) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + group) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return + ;; + services) + COMPREPLY=( $( compgen -s -- "$cur" ) ) + return + ;; + hosts) + COMPREPLY=( $( compgen -A hostname -- "$cur" ) ) + return + ;; + protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) + COMPREPLY=( $( compgen -W "$( $1 $db | \ + awk '{ print $1 }' )" -- "$cur" ) ) + return + ;; + aliases|shadow|gshadow) + COMPREPLY=( $( compgen -W "$( $1 $db | cut -d: -f1 )" \ + -- "$cur" ) ) + return + ;; + ethers|netgroup) + return + ;; + esac + + case $prev in + -s|--service) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + elif [[ -z $db ]]; then + COMPREPLY=( $( compgen -W 'passwd group hosts services protocols + networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc + shadow gshadow' -- "$cur" ) ) + fi +} && +complete -F _getent getent + +# ex: filetype=sh diff --git a/completions/gkrellm b/completions/gkrellm new file mode 100644 index 0000000..cfe6542 --- /dev/null +++ b/completions/gkrellm @@ -0,0 +1,39 @@ +# gkrellm(1) completion -*- shell-script -*- + +_gkrellm() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -t|--theme) + _filedir -d + return + ;; + -p|--plugin) + _filedir so + return + ;; + -s|--server) + _known_hosts_real "$cur" + return + ;; + -l|--logfile) + _filedir + return + ;; + -g|--geometry|-c|--config|-P|--port|-d|--debug-level) + # Argument required but no completions available + return + ;; + -h|--help|-v|--version) + # All other options are noop with these + return + ;; + esac + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _gkrellm gkrellm gkrellm2 + +# ex: filetype=sh diff --git a/completions/gm b/completions/gm new file mode 100644 index 0000000..88c233c --- /dev/null +++ b/completions/gm @@ -0,0 +1,40 @@ +# bash completion for gm(1) -*- shell-script -*- + +_gm_commands() +{ + COMPREPLY+=( $( compgen -W '$( "$1" help | + awk "/^ +[^ ]+ +- / { print \$1 }" )' -- "$cur" ) ) +} + +_gm() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + _gm_commands "$1" + return + elif [[ $cword -eq 2 && ${words[1]} == time ]]; then + _gm_commands "$1" + return + fi + + local gmcmd=${words[1]} + [[ $gmcmd == time ]] && gmcmd=${words[2]} + + case $gmcmd in + help) + [[ $prev == help ]] && _gm_commands "$1" + return + ;; + version) + return + ;; + esac + + # TODO... defer some commnds to the imagemagick "gm"less completions etc? + compopt -o default +} && +complete -F _gm gm + +# ex: filetype=sh diff --git a/completions/gnatmake b/completions/gnatmake new file mode 100644 index 0000000..4cd24d2 --- /dev/null +++ b/completions/gnatmake @@ -0,0 +1,26 @@ +# Gnatmake completion -*- shell-script -*- +# by Ralf_Schroth@t-online.de (Ralf Schroth) + +_gnatmake() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + # relevant (and less relevant ;-) )options completion + COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o -q -s -v -z + -aL -A -aO -aI -I -I- -L -nostdinc -nostdlib -cargs -bargs -largs + -fstack-check -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA -gnatb + -gnatc -gnatd -gnatD -gnate -gnatE -gnatf -gnatF -gnatg -gnatG + -gnath -gnati -gnatk -gnatl -gnatL -gnatm -gnatn -gnato -gnatO + -gnatp -gnatP -gnatq -gnatR -gnats -gnatt -gnatT -gnatu -gnatU + -gnatv -gnatws -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX -gnaty + -gnatz -gnatZ -gnat83' -- "$cur" ) ) + else + # source file completion + _filedir '@(adb|ads)' + fi +} && +complete -F _gnatmake gnatmake + +# ex: filetype=sh diff --git a/completions/gnokii b/completions/gnokii new file mode 100644 index 0000000..95ccaea --- /dev/null +++ b/completions/gnokii @@ -0,0 +1,235 @@ +# gnokii(1) completion -*- shell-script -*- + +_gnokii_memory_type() +{ + # TODO: reduce the number of choices + COMPREPLY=( $( compgen -W "IN OU SM ME MT" -- "$cur" ) ) +} + +_gnokii() +{ + local cur prev words cword pprev tprev fprev + _init_completion || return + + case $prev in + --config) + _filedir + return + ;; + --phone) + local config_file + for config_file in "$XDG_CONFIG_HOME/gnokii/config" \ + "$HOME/.config/gnokii/config" "$HOME/.gnokiirc" \ + "$XDG_CONFIG_DIRS/gnokii/config" /etc/gnokiirc ; do + [[ -f $config_file ]] && break + done + [[ ! -f $config_file ]] && return + COMPREPLY=( $( compgen -W \ + "$( command sed -n 's/^\[phone_\(.*\)\]/\1/p' $config_file )" \ + -- "$cur" ) ) + return + ;; + --help) + COMPREPLY=( $( compgen -W 'all monitor sms mms phonebook calendar + todo dial profile settings wap logo ringtone security file + other' -- "$cur" ) ) + return + ;; + --version|--shell|ping) + return + ;; + + # MONITOR + --monitor) + COMPREPLY=( $( compgen -W 'delay once' -- "$cur" ) ) + return + ;; + --getdisplaystatus|--displayoutput) + return + ;; + --netmonitor) + COMPREPLY=( $( compgen -W 'reset off field devel next nr' \ + -- "$cur" ) ) + return + ;; + + # SMS + --sendsms) + # (how)TODO ? + return + ;; + --savesms) + COMPREPLY=( $( compgen -W '--sender --smsc --smscno --folder + --location --sent --read --deliver --datetime' -- "$cur" ) ) + return + ;; + --memory-type|--memory|--getsms|--deletesms|--getmms|--deletemms|\ + --getphonebook|--deletephonebook) + _gnokii_memory_type + return + ;; + --getsmsc|--getcalendarnote|--deletecalendarnote|--gettodo|\ + --getspeeddial) + # TODO: grab a specific entry ID + return + ;; + --setsmsc|--smsreader|--createsmsfolder|--deletealltodos|\ + --showsmsfolderstatus) + return + ;; + --deletesmsfolder|--folder) + # TODO: folderid + return + ;; + --writephonebook) + COMPREPLY=( $( compgen -W '--overwrite --find-free --memory-type + --location --vcard --ldif' -- "$cur" ) ) + return + ;; + --writecalendarnote|--writetodo) + _filedir vcf + return + ;; + + # DIAL + --setspeeddial|--dialvoice|--senddtmf|--answercall|--hangup) + # TODO + return + ;; + --divert) + COMPREPLY=( $( compgen -W '--op' -- "$cur" ) ) + return + ;; + + # PROFILE + --getprofile|--setactiveprofile) + # TODO + return + ;; + --setprofile|--getactiveprofile) + return + ;; + + # SETTINGS + --reset) + COMPREPLY=( $( compgen -W 'soft hard' -- "$cur" ) ) + return + ;; + --setdatetime|--setalarm) + # TODO + return + ;; + --getdatetime|--getalarm) + return + ;; + + # WAP + --getwapbookmark|--writewapbookmark|--deletewapbookmark|\ + --getwapsetting|--writewapsetting|--activatewapsetting) + return + ;; + + # LOGOS + --sendlogo) + COMPREPLY=( $( compgen -W 'caller op picture' -- "$cur" ) ) + return + ;; + --setlogo|--getlogo) + COMPREPLY=( $( compgen -W 'op startup caller dealer text' \ + -- "$cur" ) ) + return + ;; + --viewlogo) + # TODO: logofile + return + ;; + + --entersecuritycode) + COMPREPLY=( $( compgen -W 'PIN PIN2 PUK PUK2 SEC' -- "$cur" ) ) + return + ;; + + # TODO: RINGTONES + esac + + # second level completion + if [[ $((cword-2)) -ge 1 && ${words[cword-2]} =~ --* ]]; then + pprev=${words[cword-2]} + case $pprev in + --setspeeddial) + _gnokii_memory_type + return + ;; + --getsms|--deletesms|--getmms|--deletemms|--getphonebook|\ + --writetodo|--writecalendarnote) + # TODO: start number + return + ;; + --gettodo|--getcalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end --vCal' -- "$cur" ) ) + return + ;; + --deletecalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W 'register enable query disable + erasure' -- "$cur" ) ) + return + ;; + esac + fi + + # third level completion + if [[ $((cword-3)) -ge 1 && ${words[cword-3]} =~ --* ]]; then + tprev=${words[cword-3]} + case $tprev in + --deletesms|--deletemms) + COMPREPLY=( $( compgen -W 'end' -- "$cur" ) ) + return + ;; + --getphonebook|--writetodo|--writecalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + return + ;; + --gettodo|--getcalendarnote) + [[ ${words[cword-1]} == end ]] && \ + COMPREPLY=( $( compgen -W '--vCal' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W '--type' -- "$cur" ) ) + return + esac + fi + + # fourth level completion + if [[ $((cword-4)) -ge 1 && ${words[cword-4]} =~ --* ]]; then + fprev=${words[cword-4]} + case $fprev in + --getphonebook) + COMPREPLY=( $( compgen -W '--raw --vcard --ldif' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W 'all busy noans outofreach notavail' \ + -- "$cur" ) ) + return + esac + fi + + # safer to use LANG=C + local all_cmd="$( LANG=C _parse_help $1 "--help all" )" + # these 2 below are allowed in combination with others + local main_cmd=$( command grep -v -- '--config\|--phone' <<<"$all_cmd" ) + + # don't provide main command completions if one is + # already on the command line + [[ $COMP_LINE =~ $( tr ' ' '\b|'<<<$main_cmd ) ]] && return + + COMPREPLY=( $( compgen -W "$all_cmd" -- "$cur" ) ) +} && +complete -F _gnokii gnokii + +# ex: filetype=sh diff --git a/completions/gnome-mplayer b/completions/gnome-mplayer new file mode 100644 index 0000000..9a25041 --- /dev/null +++ b/completions/gnome-mplayer @@ -0,0 +1,39 @@ +# gnome-mplayer(1) completion -*- shell-script -*- + +_gnome_mplayer() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--help-all|--help-gtk) + return + ;; + --showcontrols|--showsubtitles|--autostart) + COMPREPLY=( $( compgen -w '0 1' -- "$cur" ) ) + return + ;; + --subtitle) + _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' + return + ;; + --tvdriver) + COMPREPLY=( $( compgen -W 'v4l v4l2' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _gnome_mplayer gnome-mplayer + +# ex: filetype=sh diff --git a/completions/gpasswd b/completions/gpasswd new file mode 100644 index 0000000..ada12b8 --- /dev/null +++ b/completions/gpasswd @@ -0,0 +1,25 @@ +# gpasswd(1) completion -*- shell-script -*- + +_gpasswd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|--add|-d|--delete|-A|--administrators|-M|--members) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + # TODO: only -A and -M can be combined + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -g -- "$cur" ) ) +} && +complete -F _gpasswd gpasswd + +# ex: filetype=sh diff --git a/completions/gpg b/completions/gpg new file mode 100644 index 0000000..3fee3df --- /dev/null +++ b/completions/gpg @@ -0,0 +1,38 @@ +# bash completion for gpg -*- shell-script -*- + +_gpg() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s|--sign|--clearsign|--decrypt-files|--load-extension) + _filedir + return + ;; + --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) + # return list of public keys + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + return + ;; + -r|--recipient) + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + if [[ -e ~/.gnupg/gpg.conf ]]; then + COMPREPLY+=( $( compgen -W "$( command sed -ne \ + 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ + ~/.gnupg/gpg.conf )" -- "$cur" ) ) + fi + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) + fi +} && +complete -F _gpg -o default gpg + +# ex: filetype=sh diff --git a/completions/gpg2 b/completions/gpg2 new file mode 100644 index 0000000..6663059 --- /dev/null +++ b/completions/gpg2 @@ -0,0 +1,42 @@ +# gpg2(1) completion -*- shell-script -*- + +_gpg2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --homedir) + _filedir -d + return + ;; + -s|--sign|--clearsign|--options|--decrypt) + _filedir + return + ;; + --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) + # return list of public keys + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + return + ;; + -r|--recipient) + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | \ + command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + if [[ -e ~/.gnupg/gpg.conf ]]; then + COMPREPLY+=( $( compgen -W "$( command sed -ne \ + 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ + ~/.gnupg/gpg.conf)" -- "$cur" ) ) + fi + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) + fi +} && +complete -F _gpg2 -o default gpg2 + +# ex: filetype=sh diff --git a/completions/gphoto2 b/completions/gphoto2 new file mode 100644 index 0000000..94bf063 --- /dev/null +++ b/completions/gphoto2 @@ -0,0 +1,54 @@ +# bash completion for gphoto2(1) -*- shell-script -*- + +_gphoto2() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case $prev in + --debug-logfile) + _filedir + return + ;; + --hook-script) + _filedir + return + ;; + --filename) + _filedir + return + ;; + -u|--upload-file) + _filedir + return + ;; + --port) + COMPREPLY=( $(compgen -W "$( $1 --list-ports 2>/dev/null | \ + awk 'NR>3 { print $1 }' )" -- "$cur") ) + __ltrim_colon_completions "$cur" + return + ;; + --camera) + local IFS=$'\n' + COMPREPLY=( $(compgen -W "$( $1 --list-cameras 2>/dev/null | \ + awk -F'"' 'NR>2 { print $2 }' )" -- "$cur") ) + return + ;; + --get-config|--set-config|--set-config-index|--set-config-value) + COMPREPLY=( $(compgen -W "$( $1 --list-config 2>/dev/null \ + )" -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi + +} && +complete -F _gphoto2 gphoto2 + +# ex: filetype=sh diff --git a/completions/gprof b/completions/gprof new file mode 100644 index 0000000..b9692ba --- /dev/null +++ b/completions/gprof @@ -0,0 +1,65 @@ +# gprof(1) completion -*- shell-script -*- + +_gprof() +{ + local cur prev words cword split + _init_completion -s || return + + case $cur in + -A*|-C*|-J*|-p*|-P*|-q*|-Q*|-n*|-N*|-d*) + return + ;; + -S*) + cur=${cur:2} + _filedir + COMPREPLY=( "${COMPREPLY[@]/#/-S}" ) + return + ;; + -O*) + cur=${cur:2} + COMPREPLY=( $( compgen -P -O -W 'auto bsd 4.4bsd magic prof' \ + -- "$cur" ) ) + return + ;; + esac + + case $prev in + -I|--directory-path) + _filedir -d + return + ;; + -R|--file-ordering|--external-symbol-table) + _filedir + return + ;; + -w|--width|-k|-m|--min-count|-h|--help|-e|-E|-f|-F) + return + ;; + --file-format) + COMPREPLY=( $( compgen -W 'auto bsd 4.4bsd magic prof' \ + -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '--annotated-source --brief --exec-counts + --file-info --directory-path --no-annotated-source --print-path + --flat-profile --no-flat-profile --graph --no-graph --table-length= + --separate-files --no-exec-counts --function-ordering + --file-ordering --traditional --width= --all-lines --demangle + --no-demangle --no-static --static-call-graph + --ignore-non-functions -k --line --min-count= --time= --no-time= + --external-symbol-table= --display-unused-functions --debug --help + --file-format= --sum --version' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _gprof gprof + +# ex: filetype=sh diff --git a/completions/groupadd b/completions/groupadd new file mode 100644 index 0000000..c5a74b7 --- /dev/null +++ b/completions/groupadd @@ -0,0 +1,26 @@ +# groupadd(8) completion -*- shell-script -*- + +_groupadd() +{ + local cur prev words cword split + _init_completion -s || return + + # TODO: if -o/--non-unique is given, could complete on existing gids + # with -g/--gid + + case $prev in + -g|--gid|-K|--key|-p|--password) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _groupadd groupadd + +# ex: filetype=sh diff --git a/completions/groupdel b/completions/groupdel new file mode 100644 index 0000000..91ba358 --- /dev/null +++ b/completions/groupdel @@ -0,0 +1,5 @@ +# groupdel(8) completion -*- shell-script -*- + +complete -g groupdel + +# ex: filetype=sh diff --git a/completions/groupmems b/completions/groupmems new file mode 100644 index 0000000..3bb5d82 --- /dev/null +++ b/completions/groupmems @@ -0,0 +1,27 @@ +# groupmems(8) completion -*- shell-script -*- + +_groupmems() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|--add|-d|--delete) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + -g|--group) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return + ;; + -R|--root) + _filedir -d + return + ;; + esac + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _groupmems groupmems + +# ex: filetype=sh diff --git a/completions/groupmod b/completions/groupmod new file mode 100644 index 0000000..51e23b5 --- /dev/null +++ b/completions/groupmod @@ -0,0 +1,29 @@ +# groupmod(8) completion -*- shell-script -*- + +_groupmod() +{ + local cur prev words cword split + _init_completion -s || return + + # TODO: if -o/--non-unique is given, could complete on existing gids + # with -g/--gid + + case $prev in + -g|--gid|-h|--help|-n|--new-name|-p|--password) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=( $( compgen -g -- "$cur" ) ) +} && +complete -F _groupmod groupmod + +# ex: filetype=sh diff --git a/completions/growisofs b/completions/growisofs new file mode 100644 index 0000000..04b29a5 --- /dev/null +++ b/completions/growisofs @@ -0,0 +1,39 @@ +# growisofs(1) completion -*- shell-script -*- + +_growisofs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -version|-speed) + return + ;; + -Z|-M) + compopt -o nospace + _dvd_devices + return + ;; + /?(r)dev/*) + if [[ $cur == =* ]] ; then + # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero + cur="${cur#=}" + _filedir + return + fi + ;; + esac + + if [[ "$cur" == -* ]]; then + # TODO: mkisofs options + COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \ + -- "$cur" ) ) + [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _growisofs growisofs + +# ex: filetype=sh diff --git a/completions/grpck b/completions/grpck new file mode 100644 index 0000000..18a5392 --- /dev/null +++ b/completions/grpck @@ -0,0 +1,17 @@ +# grpck(8) completion -*- shell-script -*- + +_grpck() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _grpck grpck + +# ex: filetype=sh diff --git a/completions/gzip b/completions/gzip new file mode 100644 index 0000000..8093e41 --- /dev/null +++ b/completions/gzip @@ -0,0 +1,44 @@ +# bash completion for gzip -*- shell-script -*- + +_gzip() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|--blocksize|-S|--suffix|-h|--help|-V|--version) + return + ;; + -p|--processes) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local IFS=$'\n' xspec="*.@(gz|t[ag]z)" + [[ ${1##*/} == pigz ]] && xspec="*.@([gz]z|t[ag]z)" + + if [[ "$prev" == --* ]]; then + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ "$prev" == --force ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec + [[ "$prev" == -*f* ]] && xspec= + fi + + _expand || return + + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _gzip gzip pigz + +# ex: filetype=sh diff --git a/completions/hcitool b/completions/hcitool new file mode 100644 index 0000000..38d6642 --- /dev/null +++ b/completions/hcitool @@ -0,0 +1,380 @@ +# bash completion for bluez utils -*- shell-script -*- + +_bluetooth_addresses() +{ + if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then + COMPREPLY+=( $( compgen -W "$( hcitool scan | \ + awk '/^\t/{print $1}' )" -- "$cur" ) ) + fi +} + +_bluetooth_devices() +{ + COMPREPLY+=( $( compgen -W "$( hcitool dev | \ + awk '/^\t/{print $1}' )" -- "$cur" ) ) +} + +_bluetooth_services() +{ + COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP + GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \ + -- "$cur" ) ) +} + +_bluetooth_packet_types() +{ + COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \ + -- "$cur" ) ) +} + +_hcitool() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -i) + _bluetooth_devices + return + ;; + --role) + COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) ) + return + ;; + --pkt-type) + _bluetooth_packet_types + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'dev inq scan name info spinq epinq cmd + con cc dc sr cpt rssi lq tpl afh lst auth enc key clkoff + clock' -- "$cur" ) ) + fi + else + local args + case $arg in + name|info|dc|rssi|lq|afh|auth|key|clkoff|lst) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + fi + ;; + cc) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--role --pkt-type' -- "$cur" ) ) + else + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + fi + fi + ;; + sr) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + else + COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) ) + fi + ;; + cpt) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + else + _bluetooth_packet_types + fi + ;; + tpl|enc|clock) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + else + COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) + fi + ;; + esac + fi +} && +complete -F _hcitool hcitool + +_sdptool() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --bdaddr) + _bluetooth_addresses + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'search browse records add del get + setattr setseq' -- "$cur" ) ) + fi + else + case $arg in + search) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur" ) ) + else + _bluetooth_services + fi + ;; + browse|records) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) ) + else + _bluetooth_addresses + fi + ;; + add) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--handle --channel' -- "$cur" ) ) + else + _bluetooth_services + fi + ;; + get) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur" ) ) + fi + ;; + esac + fi +} && +complete -F _sdptool sdptool + +_l2ping() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _bluetooth_devices + return + ;; + -s|-c|-t|-d) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + else + _bluetooth_addresses + fi +} && +complete -F _l2ping l2ping + +_rfcomm() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|--config) + _filedir + return + ;; + -i) + _bluetooth_devices + _bluetooth_addresses + return + ;; + esac + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'show connect listen watch bind + release' -- "$cur" ) ) + fi + else + local args + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_devices + else + case $arg in + connect|bind) + if [[ $args -eq 3 ]]; then + _bluetooth_addresses + fi + ;; + esac + fi + fi +} && +complete -F _rfcomm rfcomm + +_ciptool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _bluetooth_devices + _bluetooth_addresses + return + ;; + esac + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'show search connect release loopback' \ + -- "$cur" ) ) + fi + else + local args + case $arg in + connect|release|loopback) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + fi + ;; + esac + fi +} && +complete -F _ciptool ciptool + +_dfutool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -d|--device) + _bluetooth_devices + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + local args + _count_args + case $args in + 1) + COMPREPLY=( $( compgen -W 'verify modify upgrade archive' \ + -- "$cur" ) ) + ;; + 2) + _filedir + ;; + esac + fi +} && +complete -F _dfutool dfutool + +_hciconfig() +{ + local cur prev words cword + _init_completion || return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --all' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'up down reset rstat auth noauth encrypt + noencrypt secmgr nosecmgr piscan noscan iscan pscan ptype name + class voice iac inqmode inqdata inqtype inqparams pageparms + pageto afhmode aclmtu scomtu putkey delkey commands features + version revision lm' -- "$cur" ) ) + fi + else + local args + case $arg in + putkey|delkey) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_addresses + fi + ;; + lm) + _count_args + if [[ $args -eq 2 ]]; then + COMPREPLY=( $( compgen -W 'MASTER SLAVE NONE ACCEPT' \ + -- "$cur" ) ) + fi + ;; + ptype) + _count_args + if [[ $args -eq 2 ]]; then + _bluetooth_packet_types + fi + ;; + esac + fi +} && +complete -F _hciconfig hciconfig + +_hciattach() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) ) + else + local args + _count_args + case $args in + 1) + COMPREPLY=( $( printf '%s\n' /dev/tty* ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} + ${COMPREPLY[@]#/dev/}' -- "$cur" ) ) + ;; + 2) + COMPREPLY=( $( compgen -W 'any ericsson digi xircom csr bboxes + swave bcsp 0x0105 0x080a 0x0160 0x0002' -- "$cur" ) ) + ;; + 3) + COMPREPLY=( $( compgen -W '9600 19200 38400 57600 115200 230400 + 460800 921600' -- "$cur" ) ) + ;; + 4) + COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) ) + ;; + 5) + _bluetooth_addresses + ;; + esac + fi +} && +complete -F _hciattach hciattach + +# ex: filetype=sh diff --git a/completions/hddtemp b/completions/hddtemp new file mode 100644 index 0000000..123b74a --- /dev/null +++ b/completions/hddtemp @@ -0,0 +1,38 @@ +# hddtemp(8) completion -*- shell-script -*- + +_hddtemp() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -f|--file) + _filedir db + return + ;; + -l|--listen) + _ip_addresses + return + ;; + -u|--unit) + COMPREPLY=( $( compgen -W 'C F' -- "$cur" ) ) + return + ;; + -p|--port|-s|--separator|-S|--syslog|-v|--version|-h|-\?|--help) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) --help' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + cur=${cur:=/dev/} + _filedir + fi +} && +complete -F _hddtemp hddtemp + +# ex: filetype=sh diff --git a/completions/hid2hci b/completions/hid2hci new file mode 100644 index 0000000..9221c4d --- /dev/null +++ b/completions/hid2hci @@ -0,0 +1,15 @@ +# hid2hci completion -*- shell-script -*- + +_hid2hci() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 --tohid' \ + -- "$cur" ) ) + fi +} && +complete -F _hid2hci hid2hci + +# ex: filetype=sh diff --git a/completions/hostname b/completions/hostname new file mode 100644 index 0000000..48f4222 --- /dev/null +++ b/completions/hostname @@ -0,0 +1,23 @@ +# hostname(1) completion -*- shell-script -*- + +_hostname() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -F|--file) + _filedir + return + ;; + esac + + [[ $cur == -* ]] && \ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _hostname hostname + +# ex: filetype=sh diff --git a/completions/hping2 b/completions/hping2 new file mode 100644 index 0000000..9d45462 --- /dev/null +++ b/completions/hping2 @@ -0,0 +1,35 @@ +# bash completion for hping2 -*- shell-script -*- + +_hping2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -I|--interface) + _available_interfaces + return + ;; + -a|--spoof) + _known_hosts_real "$cur" + return + ;; + -o|--tos) + COMPREPLY=( $( compgen -W '02 04 08 10' ) ) + return + ;; + -E|--file) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + _known_hosts_real "$cur" + fi +} && +complete -F _hping2 hping hping2 hping3 + +# ex: filetype=sh diff --git a/completions/htop b/completions/htop new file mode 100644 index 0000000..13c06b1 --- /dev/null +++ b/completions/htop @@ -0,0 +1,33 @@ +# htop(1) completion -*- shell-script -*- + +_htop() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -s|--sort-key) + COMPREPLY=( $( compgen -W '$( "$1" -s help )' -- "$cur" ) ) + return + ;; + -u|--user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + -d|--delay) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _htop htop + +# ex: filetype=sh diff --git a/completions/htpasswd b/completions/htpasswd new file mode 100644 index 0000000..bf3acb2 --- /dev/null +++ b/completions/htpasswd @@ -0,0 +1,33 @@ +# htpasswd(1) completion -*- shell-script -*- + +_htpasswd() +{ + local cur prev words cword + _init_completion || return + + local i o=0 # $o is index of first non-option argument + for (( i=1; i <= cword; i++ )); do + case ${words[i]} in + -*n*) return ;; + -*) ;; + *) o=$i ; break ;; + esac + done + + if [[ $o -eq 0 || $o -eq $cword ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + # Password file (first non-option argument) + _filedir + + elif [[ $o -eq $cword-1 ]]; then + # Username (second non-option argument) + COMPREPLY=( $( compgen -W \ + '$( cut -d: -f1 "${words[o]}" 2>/dev/null )' -- "$cur" ) ) + fi +} && +complete -F _htpasswd htpasswd + +# ex: filetype=sh diff --git a/completions/iconv b/completions/iconv new file mode 100644 index 0000000..50edb4c --- /dev/null +++ b/completions/iconv @@ -0,0 +1,33 @@ +# iconv(1) completion -*- shell-script -*- + +_iconv() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ + --widechar-subst) + return + ;; + -f|--from-code|-t|--to-code) + COMPREPLY=( $( compgen -W '$( iconv -l | \ + command sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + return + ;; + -o|--output) + _filedir + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _iconv -o default iconv + +# ex: filetype=sh diff --git a/completions/id b/completions/id new file mode 100644 index 0000000..137a5f7 --- /dev/null +++ b/completions/id @@ -0,0 +1,18 @@ +# id(1) completion -*- shell-script -*- + +_id() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + local opts=$( _parse_help "$1" ) + [[ $opts ]] || opts="-G -g -u" # POSIX fallback + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + else + COMPREPLY=( $( compgen -u "$cur" ) ) + fi +} && +complete -F _id id + +# ex: filetype=sh diff --git a/completions/idn b/completions/idn new file mode 100644 index 0000000..12f4bdd --- /dev/null +++ b/completions/idn @@ -0,0 +1,26 @@ +# idn(1) completion -*- shell-script -*- + +_idn() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -p|--profile) + COMPREPLY=( $( compgen -W 'Nameprep iSCSI Nodeprep Resourceprep + trace SASLprep' -- "$cur" ) ) + return + ;; + esac + + if ! $split && [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _idn idn + +# ex: filetype=sh diff --git a/completions/iftop b/completions/iftop new file mode 100644 index 0000000..831e327 --- /dev/null +++ b/completions/iftop @@ -0,0 +1,26 @@ +# iftop(8) completion -*- shell-script -*- + +_iftop() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|-f|-F|-m) + return + ;; + -i) + _available_interfaces -a + return + ;; + -c) + _filedir + return + ;; + esac + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) +} && +complete -F _iftop iftop + +# ex: filetype=sh diff --git a/completions/ifup b/completions/ifup new file mode 100644 index 0000000..42cb8f8 --- /dev/null +++ b/completions/ifup @@ -0,0 +1,18 @@ +# Red Hat & Debian GNU/Linux if{up,down} completion -*- shell-script -*- + +_userland GNU || return 1 + +_ifupdown() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + _configured_interfaces + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) + fi + +} && +complete -F _ifupdown ifup ifdown ifstatus + +# ex: filetype=sh diff --git a/completions/info b/completions/info new file mode 100644 index 0000000..f71cbf5 --- /dev/null +++ b/completions/info @@ -0,0 +1,74 @@ +# bash completion for info -*- shell-script -*- + +_info() +{ + local cur prev words cword split + _init_completion -s || return + + _expand || return + + # default completion if parameter looks like a path + if [[ "$cur" == @(*/|[.~])* ]]; then + _filedir + return + fi + + case $prev in + -k|--apropos|--index-search|-n|--node|-h|--help|-v|--version) + return + ;; + -d) + if [[ ${1##*/} == info ]]; then + _filedir -d + return + fi + ;; + --directory) + _filedir -d + return + ;; + --dribble|-f|--file|-o|--output|--restore|-r|--raw-filename|--rcfile) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local i infopath=/usr/share/info + + if [[ $INFOPATH == *: ]]; then + infopath=${INFOPATH}${infopath} + elif [[ ${INFOPATH:+set} ]]; then + infopath=$INFOPATH + fi + + infopath=$infopath: + if [[ -n $cur ]]; then + infopath="${infopath//://$cur* }" + else + infopath="${infopath//:// }" + fi + + # redirect stderr for when path doesn't exist + COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) ) + # weed out directory path names and paths to info pages + COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) + # weed out info dir file + for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do + [[ ${COMPREPLY[$i]} == dir ]] && unset "COMPREPLY[$i]" + done + # strip suffix from info pages + COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) + +} && +complete -F _info info pinfo + +# ex: filetype=sh diff --git a/completions/inject b/completions/inject new file mode 100644 index 0000000..20ea9b7 --- /dev/null +++ b/completions/inject @@ -0,0 +1,26 @@ +# mailman inject completion -*- shell-script -*- + +_inject() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _inject inject + +# ex: filetype=sh diff --git a/completions/insmod b/completions/insmod new file mode 100644 index 0000000..ec81c93 --- /dev/null +++ b/completions/insmod @@ -0,0 +1,18 @@ +# Linux insmod(8) completion -*- shell-script -*- + +_insmod() +{ + local cur prev words cword + _init_completion || return + + # do filename completion for first argument + if [[ $cword -eq 1 ]]; then + _filedir '@(?(k)o?(.gz))' + else # do module parameter completion + COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ + -p ${words[1]} 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) + fi +} && +complete -F _insmod insmod insmod.static + +# ex: filetype=sh diff --git a/completions/installpkg b/completions/installpkg new file mode 100644 index 0000000..f002f77 --- /dev/null +++ b/completions/installpkg @@ -0,0 +1,33 @@ +# Slackware Linux installpkg completion -*- shell-script -*- + +_installpkg() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + --root) + _filedir -d + return + ;; + --priority) + COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) + return + ;; + --tagfile) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse + --menu --ask --priority --tagfile' -- "$cur" ) ) + return + fi + + _filedir 't[bglx]z' +} && +complete -F _installpkg installpkg + +# ex: filetype=sh diff --git a/completions/interdiff b/completions/interdiff new file mode 100644 index 0000000..cf71002 --- /dev/null +++ b/completions/interdiff @@ -0,0 +1,33 @@ +# interdiff(1) completion -*- shell-script -*- + +_interdiff() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -U|--unified|-p|--strip-match|-d|--drop-context) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local exts='@(?(d)patch|dif?(f))' word + for word in ${words[@]}; do + if [[ $word == -@(z|-decompress) ]]; then + exts+='?(.@(gz|bz2))' + break + fi + done + _filedir "$exts" +} && +complete -F _interdiff interdiff + +# ex: filetype=sh diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d new file mode 100644 index 0000000..777f6ac --- /dev/null +++ b/completions/invoke-rc.d @@ -0,0 +1,38 @@ +# invoke-rc.d(8) completion -*- shell-script -*- +# +# Copyright (C) 2004 Servilio Afre Puentes + +_invoke_rc_d() +{ + local cur prev words cword + _init_completion || return + + local sysvdir services options valid_options + + [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d \ + || sysvdir=/etc/init.d + + services=( $( printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob) ) ) + services=( ${services[@]#$sysvdir/} ) + options=( --help --quiet --force --try-anyway --disclose-deny --query \ + --no-fallback ) + + if [[ ($cword -eq 1) || ("$prev" == --* ) ]]; then + valid_options=( $( \ + tr " " "\n" <<<"${words[@]} ${options[@]}" \ + | command sed -ne "/$( command sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ + | sort | uniq -u \ + ) ) + COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) + elif [[ -x $sysvdir/$prev ]]; then + COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ + -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ + $sysvdir/$prev`' -- "$cur" ) ) + else + COMPREPLY=() + fi + +} && +complete -F _invoke_rc_d invoke-rc.d + +# ex: filetype=sh diff --git a/completions/ip b/completions/ip new file mode 100644 index 0000000..00dd839 --- /dev/null +++ b/completions/ip @@ -0,0 +1,326 @@ +# ip(8) completion -*- shell-script -*- + +_iproute2_etc() +{ + COMPREPLY+=( $( compgen -W \ + "$( awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null )" \ + -- "$cur" ) ) +} + +_ip() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -V|-Version|-rc|-rcvbuf) + return + ;; + -f|-family) + COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) ) + return + ;; + -b|-batch) + _filedir + return + ;; + -force) + COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) + return + ;; + esac + + local subcword cmd subcmd + for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do + [[ ${words[subcword]} == -b?(atch) ]] && return + [[ -n $cmd ]] && subcmd=${words[subcword]} && break + [[ ${words[subcword]} != -* && \ + ${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \ + cmd=${words[subcword]} + done + + if [[ -z $cmd ]]; then + case $cur in + -*) + local c="-Version -statistics -details -resolve -family + -oneline -timestamp -batch -rcvbuf" + [[ $cword -eq 1 ]] && c+=" -force" + COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) + return + ;; + *) + COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | command sed -e \ + '/OBJECT := /,/}/!d' -e \ + 's/.*{//' -e \ + 's/}.*//' -e \ + 's/|//g' )" -- "$cur" ) ) + return + ;; + esac + fi + + [[ $subcmd == help ]] && return + + case $cmd in + l|link) + case $subcmd in + add) + # TODO + ;; + delete) + case $(($cword-$subcword)) in + 1) + _available_interfaces + ;; + 2) + COMPREPLY=( $( compgen -W 'type' -- "$cur" ) ) + ;; + 3) + [[ $prev == type ]] && \ + COMPREPLY=( $( compgen -W 'vlan veth vcan dummy + ifb macvlan can' -- "$cur" ) ) + ;; + esac + ;; + set) + if [[ $cword-$subcword -eq 1 ]]; then + _available_interfaces + else + case $prev in + arp|dynamic|multicast|allmulticast|promisc|\ + trailers) + COMPREPLY=( $( compgen -W 'on off' \ + -- "$cur" ) ) + ;; + txqueuelen|name|address|broadcast|mtu|netns|alias) + ;; + *) + local c="arp dynamic multicast allmulticast + promisc trailers txqueuelen name address + broadcast mtu netns alias" + [[ $prev != @(up|down) ]] && c+=" up down" + COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) + ;; + esac + fi + ;; + show) + if [[ $cword -eq $subcword+1 ]]; then + _available_interfaces + COMPREPLY+=( $( compgen -W 'dev group up' -- "$cur" ) ) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == group ]]; then + _iproute2_etc group + fi + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help add delete set show' \ + -- "$cur" ) ) + ;; + esac + ;; + + a|addr|address) + case $subcmd in + add|change|replace) + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi + ;; + del) + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi + ;; + show|flush) + if [[ $cword -eq $subcword+1 ]]; then + _available_interfaces + COMPREPLY+=( $( compgen -W 'dev scope to label dynamic + permanent tentative deprecated dadfailed temporary + primary secondary up' -- "$cur" ) ) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + fi + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help add change replace del + show flush' -- "$cur" ) ) + ;; + esac + ;; + + addrlabel) + case $subcmd in + list|add|del|flush) + if [[ $prev == dev ]]; then + _available_interfaces + else + : # TODO + fi + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help list add del flush' \ + -- "$cur" ) ) + ;; + esac + ;; + + route) + case $subcmd in + list|flush) + if [[ $prev == proto ]]; then + _iproute2_etc rt_protos + else + : # TODO + fi + ;; + get) + # TODO + ;; + add|del|change|append|replace|monitor) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help list flush get add del + change append replace monitor' -- "$cur" ) ) + ;; + esac + ;; + + rule) + case $subcmd in + add|del) + # TODO + ;; + flush|show|list|lst) + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help list add del flush' \ + -- "$cur" ) ) + ;; + esac + ;; + + neigh) + case $subcmd in + add|del|change|replace) + # TODO + ;; + show|flush) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help add del change replace + show flush' -- "$cur" ) ) + ;; + esac + ;; + + ntable) + case $subcmd in + change) + # TODO + ;; + show) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help change show' \ + -- "$cur" ) ) + ;; + esac + ;; + + tunnel) + case $subcmd in + show) + ;; + add|change|del|prl|6rd) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help add change del show prl + 6rd' -- "$cur" ) ) + ;; + esac + ;; + + maddr) + case $subcmd in + add|del) + # TODO + ;; + show) + if [[ $cword -eq $subcword+1 || $prev == dev ]]; then + _available_interfaces + [[ $prev != dev ]] && \ + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} dev' \ + -- "$cur" ) ) + fi + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help add del show' \ + -- "$cur" ) ) + ;; + esac + ;; + + mroute) + case $subcmd in + show) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help show' -- "$cur" ) ) + ;; + esac + ;; + + monitor) + case $subcmd in + all) ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'help all' -- "$cur" ) ) + ;; + esac + ;; + + xfrm) + case $subcmd in + state|policy|monitor) + # TODO + ;; + *) + [[ $cword -eq $subcword ]] && \ + COMPREPLY=( $( compgen -W 'state policy monitor' \ + -- "$cur" ) ) + ;; + esac + ;; + esac +} && +complete -F _ip ip + +# ex: filetype=sh diff --git a/completions/iperf b/completions/iperf new file mode 100644 index 0000000..4652879 --- /dev/null +++ b/completions/iperf @@ -0,0 +1,63 @@ +# iperf(1) completion -*- shell-script -*- + +_iperf() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-v|--version|-i|--interval|-l|--len|-p|--port|-w|--window|\ + -M|--mss|-b|--bandwidth|-n|--num|-t|--time|-L|--listenport|-P|\ + --parallel|-T|--ttl|-Z|--linux-congestion) + return + ;; + -f|--format) + COMPREPLY=( $( compgen -W 'k m K M' -- "$cur" ) ) + return + ;; + -o|--output|-F|--fileinput) + _filedir + return + ;; + -B|--bind) + _available_interfaces -a + _ip_addresses + return + ;; + -c|--client) + _known_hosts_real "$cur" + return + ;; + -x|--reportexclude) + COMPREPLY=( $( compgen -W 'C D M S V' -- "$cur" ) ) + return + ;; + -y|--reportstyle) + COMPREPLY=( $( compgen -W 'C' -- "$cur" ) ) + return + ;; + esac + + $split && return + + # Filter mode specific options + local i filter=cat + for i in ${words[@]}; do + case $i in + -s|--server) + filter='command sed -e /^Client.specific/,/^$/d' + ;; + -c|--client) + filter='command sed -e /^Server.specific/,/^$/d' + ;; + esac + done + [[ $filter != cat ]] && filter+=' -e /--client/d -e /--server/d' + + COMPREPLY=( $( compgen -W \ + '$( "$1" --help 2>&1 | $filter | _parse_help - )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _iperf iperf + +# ex: filetype=sh diff --git a/completions/ipmitool b/completions/ipmitool new file mode 100644 index 0000000..8e2637c --- /dev/null +++ b/completions/ipmitool @@ -0,0 +1,200 @@ +# bash completion for ipmitool -*- shell-script -*- + +_ipmitool_singleline_help() +{ + COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ + command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) +} + +_ipmitool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l) + return + ;; + -d) + COMPREPLY=( $( compgen -W "$( \ + command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ + 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ + -- "$cur" ) ) + return + ;; + -I) + COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \ + command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ + -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \ + -- "$cur" ) ) + return + ;; + -H) + _known_hosts_real "$cur" + return + ;; + -f|-S|-O) + _filedir + return + ;; + -C) + COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) ) + return + ;; + -L) + COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ + -- "$cur" ) ) + return + ;; + -A) + COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) ) + return + ;; + -o) + COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \ + awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h)' -- "$cur" ) ) + return + fi + + # Find out command and subcommand + + local cmds=( raw i2c spd lan chassis power event mc sdr sensor fru gendev + sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum + firewall shell exec set hpm ekanalyzer) + local i c cmd subcmd + for (( i=1; i < ${#words[@]}-1; i++ )); do + [[ -n $cmd ]] && subcmd=${words[i]} && break + for c in ${cmds[@]}; do + [[ ${words[i]} == $c ]] && cmd=$c && break + done + done + + if [[ -z $cmd ]]; then + COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) + return + fi + + # Command/subcommand completions + + case $cmd in + + shell) + ;; + + exec) + _filedir + ;; + + chassis|power|kontronoem|fwum) + _ipmitool_singleline_help $1 $cmd + ;; + + lan) + case $subcmd in + print|set) + ;; + alert) + [[ $prev == alert ]] && \ + COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + ;; + stats) + [[ $prev == stats ]] && \ + COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'print set alert stats' \ + -- "$cur" ) ) + ;; + esac + ;; + + sdr) + case $subcmd in + get|info|type|list|entity) + ;; + elist) + COMPREPLY=( $( compgen -W 'all full compact event mclog fru + generic' -- "$cur" ) ) + ;; + dump) + _filedir + ;; + fill) + case $prev in + fill) + COMPREPLY=( $( compgen -W 'sensors file' \ + -- "$cur" ) ) + ;; + file) + _filedir + ;; + esac + ;; + *) + COMPREPLY=( $( compgen -W 'get info type list elist entity + dump fill' -- "$cur" ) ) + ;; + esac + ;; + + sensor) + case $subcmd in + list|get|thresh) + ;; + *) + COMPREPLY=( $( compgen -W 'list get thresh' -- "$cur" ) ) + ;; + esac + ;; + + sel) + case $subcmd in + info|clear|list|elist|delete) + ;; + add|save|writeraw|readraw) + _filedir + ;; + time) + [[ $prev == time ]] && \ + COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'info clear list elist delete add + get save writeraw readraw time' -- "$cur" ) ) + ;; + esac + ;; + + user) + case $subcmd in + summary|list|disable|enable|priv|test) + ;; + set) + [[ $prev == set ]] && \ + COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'summary list set disable enable + priv test' -- "$cur" ) ) + ;; + esac + ;; + + set) + [[ $prev == set ]] && \ + COMPREPLY=( $( compgen -W 'hostname username password privlvl + authtype localaddr targetaddr port csv verbose' \ + -- "$cur" ) ) + ;; + + esac +} && +complete -F _ipmitool ipmitool + +# ex: filetype=sh diff --git a/completions/ipsec b/completions/ipsec new file mode 100644 index 0000000..357d505 --- /dev/null +++ b/completions/ipsec @@ -0,0 +1,103 @@ +# Linux ipsec(8) completion (for FreeS/WAN and strongSwan) -*- shell-script -*- + +# Complete ipsec.conf conn entries. +# +# Reads a file from stdin in the ipsec.conf(5) format. +_ipsec_connections() +{ + local keyword name + while read -r keyword name; do + if [[ $keyword == [#]* ]]; then continue; fi + [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=( "$name" ) + done + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) +} + +_ipsec_freeswan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual + pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp + tncfg whack' -- "$cur" ) ) + return + fi + + case ${words[1]} in + auto) + COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete + --replace --down --route --unroute --ready --status + --rereadsecrets' -- "$cur" ) ) + ;; + manual) + COMPREPLY=( $( compgen -W '--up --down --route --unroute --union' \ + -- "$cur" ) ) + ;; + ranbits) + COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \ + -- "$cur" ) ) + ;; + setup) + COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) ) + ;; + *) + ;; + esac +} + +_ipsec_strongswan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'down irdumm leases listaacerts listacerts + listalgs listall listcacerts listcainfos listcards listcerts + listcrls listgroups listocsp listocspcerts listpubkeys openac pki + pluto pool purgecerts purgecrls purgeike purgeocsp ready reload + rereadaacerts rereadacerts rereadall rereadcacerts rereadcrls + rereadgroups rereadocspcerts rereadsecrets restart route scdecrypt + scencrypt scepclient secrets start starter status statusall stop + stroke unroute uci up update version whack --confdir --copyright + --directory --help --version --versioncode' -- "$cur" ) ) + return + fi + + case ${words[1]} in + down|route|status|statusall|unroute|up) + local confdir=$( ipsec --confdir ) + _ipsec_connections < "$confdir/ipsec.conf" + ;; + list*) + COMPREPLY=( $( compgen -W '--utc' -- "$cur" ) ) + ;; + restart|start) + COMPREPLY=( $( compgen -W '--attach-gdb --auto-update --debug + --debug-all --debug-more --nofork' -- "$cur" ) ) + ;; + pki) + COMPREPLY=( $( compgen -W '--gen --issue --keyid --print --pub + --req --self --signcrl --verify' -- "$cur" ) ) + ;; + pool) + ;; + irdumm) + _filedir 'rb' + ;; + *) + ;; + esac +} + +case "$( ipsec --version 2>/dev/null )" in + *strongSwan*) + complete -F _ipsec_strongswan ipsec + ;; + *) + complete -F _ipsec_freeswan ipsec + ;; +esac + +# ex: filetype=sh diff --git a/completions/iptables b/completions/iptables new file mode 100644 index 0000000..0ecb1eb --- /dev/null +++ b/completions/iptables @@ -0,0 +1,60 @@ +# bash completion for iptables -*- shell-script -*- + +_iptables() +{ + local cur prev words cword split + _init_completion -s || return + + local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' + + if [[ ${words[@]} == *-t\ *filter* ]]; then + table="-t filter" + elif [[ ${words[@]} == *-t\ *nat* ]]; then + table="-t nat" + elif [[ ${words[@]} == *-t\ *mangle* ]]; then + table="-t mangle" + fi + + case $prev in + -*[AIDRPFXLZ]) + COMPREPLY=( $( compgen -W '`iptables $table -nL | \ + command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) + ;; + -*t) + COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) + ;; + -j) + if [[ "$table" == "-t filter" || -z "$table" ]]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT + `iptables $table -nL | command sed -ne "$chain" \ + -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ + "$cur" ) ) + elif [[ $table == "-t nat" ]]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MIRROR SNAT + DNAT MASQUERADE `iptables $table -nL | \ + command sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ + -- "$cur" ) ) + elif [[ $table == "-t mangle" ]]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MARK TOS + `iptables $table -nL | command sed -ne "$chain" \ + -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ + "$cur" ) ) + fi + ;; + *) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--in-interface --out-interface --source + --destination --protocol --fragment --match --append --delete + --insert --replace --list --flush --zero --new --delete-chain + --policy --rename-chain --proto --source --destination + --in-interface --jump --match --numeric --out-interface --table + --verbose --line-numbers --exact --fragment --modprobe + --set-counters --version' -- "$cur" ) ) + fi + ;; + esac + +} && +complete -F _iptables iptables + +# ex: filetype=sh diff --git a/completions/ipv6calc b/completions/ipv6calc new file mode 100644 index 0000000..0dacff9 --- /dev/null +++ b/completions/ipv6calc @@ -0,0 +1,43 @@ +# ipv6calc completion -*- shell-script -*- + +_ipv6calc() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -d|--debug) + return + ;; + -I|--in|-O|--out|-A|--action) + # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. + COMPREPLY=( $( compgen -W "$( $1 "$prev" -h 2>&1 | \ + command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ + -- "$cur" ) ) + return + ;; + --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6) + _filedir + return + ;; + --printstart|--printend) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --debug --quiet --in --out --action + --examples --showinfo --show_types --machine_readable --db-geoip + --db-geoip-default --db-ip2location-ipv4 --db-ip2location-ipv6 + --lowercase --uppercase --printprefix --printsuffix --maskprefix + --masksuffix --printstart --printend --printcompressed + --printuncompressed --printfulluncompressed --printmirrored' \ + -- "$cur" ) ) + fi + +} && +complete -F _ipv6calc ipv6calc + +# ex: filetype=sh diff --git a/completions/iscsiadm b/completions/iscsiadm new file mode 100644 index 0000000..e5218d7 --- /dev/null +++ b/completions/iscsiadm @@ -0,0 +1,66 @@ +# iscsiadm(1) completion -*- shell-script -*- + +_iscsiadm() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -m|--mode) + COMPREPLY=( $( compgen -W 'discovery node session iface fw host' \ + -- "$cur" ) ) + return + ;; + -o|--op) + COMPREPLY=( $( compgen -W 'new delete update show' -- "$cur" ) ) + return + ;; + -t|--type) + COMPREPLY=( $( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) ) + return + ;; + -L|-U|--loginall|--logoutall) + COMPREPLY=( $( compgen -W 'all manual automatic' -- "$cur" ) ) + return + ;; + esac + + $split && return + + local options + if [[ $cword -gt 1 ]] ; then + + case ${words[2]} in + discovery) + options='--help --version --debug --print --interface --type \ + --portal --login --op --name --value' + ;; + node) + options='--help --version --debug --print --loginall \ + --logoutall--show -T --portal --interface --login \ + --logout --rescan --stats --op --name --value' + ;; + session) + options='--help --version --debug --print --sid --logout \ + --rescan --stats' + ;; + iface) + options='--help --version --debug --print --interface --op \ + --name --value' + ;; + fw) + options='--login' + ;; + host) + options='--print -H' + ;; + esac + else + options='--mode' + fi + + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) +} && +complete -F _iscsiadm iscsiadm + +# ex: filetype=sh diff --git a/completions/isql b/completions/isql new file mode 100644 index 0000000..862a930 --- /dev/null +++ b/completions/isql @@ -0,0 +1,14 @@ +# isql completion -*- shell-script -*- +# by Victor Bogado da Silva Lins + +_isql() +{ + local cur prev words cword + _init_completion || return + + [[ -f $ODBCINI ]] \ + && COMPREPLY=( $( command grep "\[$cur" "$ODBCINI" | tr -d \[\] ) ) +} && +complete -F _isql isql + +# ex: filetype=sh diff --git a/completions/iwconfig b/completions/iwconfig new file mode 100644 index 0000000..114081d --- /dev/null +++ b/completions/iwconfig @@ -0,0 +1,90 @@ +# iwconfig completion -*- shell-script -*- + +_iwconfig() +{ + local cur prev words cword + _init_completion || return + + case $prev in + mode) + COMPREPLY=( $( compgen -W 'managed ad-hoc master repeater secondary + monitor' -- "$cur" ) ) + return + ;; + essid) + COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) + if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then + COMPREPLY+=( $( compgen -W \ + "$( iwlist ${words[1]} scan | \ + awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) ) + fi + return + ;; + nwid) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return + ;; + channel) + COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ + awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) ) + return + ;; + + freq) + COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ + awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) ) + return + ;; + ap) + COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) + if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then + COMPREPLY+=( $( compgen -W \ + "$( iwlist ${words[1]} scan | \ + awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) ) + fi + return + ;; + rate) + COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) ) + COMPREPLY+=( $( compgen -W \ + "$( iwlist ${words[1]} rate | \ + awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) ) + return + ;; + rts|frag) + COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) ) + return + ;; + key|enc) + COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) ) + return + ;; + power) + COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) ) + return + ;; + txpower) + COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) ) + return + ;; + retry) + COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) ) + return + ;; + esac + + if [[ $cword -eq 1 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode ap + nick rate rts frag enc key power txpower commit' -- "$cur" ) ) + fi + +} && +complete -F _iwconfig iwconfig + +# ex: filetype=sh diff --git a/completions/iwlist b/completions/iwlist new file mode 100644 index 0000000..b27dbe8 --- /dev/null +++ b/completions/iwlist @@ -0,0 +1,22 @@ +# iwlist completion -*- shell-script -*- + +_iwlist() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'scan scanning freq frequency channel rate + bit bitrate key enc encryption power txpower retry ap accesspoint + peers event' -- "$cur" ) ) + fi +} && +complete -F _iwlist iwlist + +# ex: filetype=sh diff --git a/completions/iwpriv b/completions/iwpriv new file mode 100644 index 0000000..c7f8209 --- /dev/null +++ b/completions/iwpriv @@ -0,0 +1,31 @@ +# iwpriv completion -*- shell-script -*- + +_iwpriv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + roam) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return + ;; + port) + COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) + return + ;; + esac + + if [[ $cword -eq 1 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W '--all roam port' -- "$cur" ) ) + fi +} && +complete -F _iwpriv iwpriv + +# ex: filetype=sh diff --git a/completions/iwspy b/completions/iwspy new file mode 100644 index 0000000..1cf3a28 --- /dev/null +++ b/completions/iwspy @@ -0,0 +1,20 @@ +# iwspy completion -*- shell-script -*- + +_iwspy() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'setthr getthr off' -- "$cur" ) ) + fi +} && +complete -F _iwspy iwspy + +# ex: filetype=sh diff --git a/completions/jar b/completions/jar new file mode 100644 index 0000000..b7de930 --- /dev/null +++ b/completions/jar @@ -0,0 +1,27 @@ +# jar(1) completion -*- shell-script -*- + +_jar() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) + return + fi + + case ${words[1]} in + *c*f) + _filedir + ;; + *f) + _filedir_xspec unzip + ;; + *) + _filedir + ;; + esac +} && +complete -F _jar jar + +# ex: filetype=sh diff --git a/completions/jarsigner b/completions/jarsigner new file mode 100644 index 0000000..2441bd1 --- /dev/null +++ b/completions/jarsigner @@ -0,0 +1,57 @@ +# jarsigner(1) completion -*- shell-script -*- + +_jarsigner() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -keystore) + COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) + _filedir '@(jks|ks|p12|pfx)' + return + ;; + -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-tsapolicyid|\ + -tsadigestalg|-altsigner|-altsignerpath|-providerName|-providerClass|\ + -providerArg) + return + ;; + -certchain|-sigfile|-tsa) + _filedir + return + ;; + -storetype) + COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) ) + return + ;; + -signedjar) + _filedir jar + return + ;; + esac + + # Check if a jar was already given. + local i jar=false + for (( i=0; i < ${#words[@]}-1; i++ )) ; do + if [[ "${words[i]}" == *.jar && \ + "${words[i-1]}" != -signedjar ]] ; then + jar=true + break + fi + done + + if ! $jar ; then + if [[ "$cur" == -* ]] ; then + # Documented as "should not be used": -internalsf, -sectionsonly + COMPREPLY=( $( compgen -W '-keystore -storepass -storetype + -keypass -sigfile -signedjar -digestalg -sigalg -verify + -verbose -certs -tsa -tsacert -altsigner -altsignerpath + -protected -providerName -providerClass -providerArg' \ + -- "$cur" ) ) + fi + _filedir jar + fi +} && +complete -F _jarsigner jarsigner + +# ex: filetype=sh diff --git a/completions/java b/completions/java new file mode 100644 index 0000000..7d1cf1f --- /dev/null +++ b/completions/java @@ -0,0 +1,328 @@ +# bash completion for java, javac and javadoc -*- shell-script -*- + +# available path elements completion +_java_path() +{ + cur=${cur##*:} + _filedir '@(jar|zip)' +} + +# exact classpath determination +_java_find_classpath() +{ + local i + + # search first in current options + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -@(cp|classpath) ]]; then + classpath=${words[i+1]} + break + fi + done + + # default to environment + [[ -z $classpath ]] && classpath=$CLASSPATH + + # default to current directory + [[ -z $classpath ]] && classpath=. +} + +# exact sourcepath determination +_java_find_sourcepath() +{ + local i + + # search first in current options + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -sourcepath ]]; then + sourcepath=${words[i+1]} + break + fi + done + + # default to classpath + if [[ -z $sourcepath ]]; then + local classpath + _java_find_classpath + sourcepath=$classpath + fi +} + +# available classes completion +_java_classes() +{ + local classpath i + + # find which classpath to use + _java_find_classpath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each classpath element for classes + for i in ${classpath//:/ }; do + if [[ "$i" == *.@(jar|zip) && -r $i ]]; then + if type zipinfo &>/dev/null; then + COMPREPLY+=( $( zipinfo -1 "$i" "$cur*" 2>/dev/null | \ + command grep '^[^$]*\.class$' ) ) + else + COMPREPLY+=( $( jar tf "$i" "$cur" | \ + command grep '^[^$]*\.class$' ) ) + fi + + elif [[ -d $i ]]; then + COMPREPLY+=( + $( compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|" ) + $( compgen -f -X '!*.class' -- "$i/$cur" | \ + command sed -e '/\$/d' -e "s|^$i/||" ) + ) + [[ $COMPREPLY == *.class ]] || compopt -o nospace + + # FIXME: if we have foo.class and foo/, the completion + # returns "foo/"... how to give precedence to files + # over directories? + fi + done + + # remove class extension + COMPREPLY=( ${COMPREPLY[@]%.class} ) + # convert path syntax to package syntax + COMPREPLY=( ${COMPREPLY[@]//\//.} ) +} + +# available packages completion +_java_packages() +{ + local sourcepath i + + # find which sourcepath to use + _java_find_sourcepath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each sourcepath element for packages + for i in ${sourcepath//:/ }; do + if [[ -d $i ]]; then + COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \ + command sed -e 's|^'$i'/||' ) ) + fi + done + # keep only packages + COMPREPLY=( $( tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$" ) ) + # remove packages extension + COMPREPLY=( ${COMPREPLY[@]%/} ) + # convert path syntax to package syntax + cur=${COMPREPLY[@]//\//.} +} + +# java completion +# +_java() +{ + local cur prev words cword + _init_completion -n : || return + + local i + + for ((i=1; i < $cword; i++)); do + case ${words[$i]} in + -cp|-classpath) + ((i++)) # skip the classpath string. + ;; + -*) + # this is an option, not a class/jarfile name. + ;; + *) + # once we've seen a class, just do filename completion + _filedir + return + ;; + esac + done + + case $cur in + # standard option completions + -verbose:*) + COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) ) + return + ;; + -javaagent:*) + cur=${cur#*:} + _filedir '@(jar|zip)' + return + ;; + -agentpath:*) + cur=${cur#*:} + _filedir so + return + ;; + # various non-standard option completions + -splash:*) + cur=${cur#*:} + _filedir '@(gif|jp?(e)g|png)' + return + ;; + -Xbootclasspath*:*) + _java_path + return + ;; + -Xcheck:*) + COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) ) + return + ;; + -Xgc:*) + COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \ + -- "${cur#*:}" ) ) + return + ;; + -Xgcprio:*) + COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \ + -- "${cur#*:}" ) ) + return + ;; + -Xloggc:*|-Xverboselog:*) + cur=${cur#*:} + _filedir + return + ;; + -Xshare:*) + COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) ) + return + ;; + -Xverbose:*) + COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt + gcpause gcreport' -- "${cur#*:}" ) ) + return + ;; + -Xverify:*) + COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) ) + return + ;; + # the rest that we have no completions for + -D*|-*:*) + return + ;; + esac + + case $prev in + -cp|-classpath) + _java_path + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + [[ $cur == -X* ]] && \ + COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) ) + else + if [[ "$prev" == -jar ]]; then + # jar file completion + _filedir jar + else + # classes completion + _java_classes + fi + fi + + [[ $COMPREPLY == -*[:=] ]] && compopt -o nospace + + __ltrim_colon_completions "$cur" +} && +complete -F _java java + +_javadoc() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -overview|-helpfile) + _filedir '?(x)htm?(l)' + return + ;; + -doclet|-exclude|-subpackages|-source|-locale|-encoding|-windowtitle|\ + -doctitle|-header|-footer|-top|-bottom|-group|-noqualifier|-tag|\ + -charset|-sourcetab|-docencoding) + return + ;; + -stylesheetfile) + _filedir css + return + ;; + -d|-link|-linkoffline) + _filedir -d + return + ;; + -classpath|-cp|-bootclasspath|-docletpath|-sourcepath|-extdirs|\ + -excludedocfilessubdir) + _java_path + return + ;; + -helpfile) + _filedir + return + ;; + esac + + # -linkoffline takes two arguments + if [[ $cword -gt 2 && ${words[$cword-2]} == -linkoffline ]]; then + _filedir -d + return + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + else + # source files completion + _filedir java + # packages completion + _java_packages + fi +} && +complete -F _javadoc javadoc + +_javac() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -d) + _filedir -d + return + ;; + -cp|-classpath|-bootclasspath|-sourcepath|-extdirs) + _java_path + return + ;; + esac + + if [[ $cur == -+([a-zA-z0-9-_]):* ]]; then + # Parse required options from -foo:{bar,quux,baz} + local helpopt=-help + [[ $cur == -X* ]] && helpopt=-X + # For some reason there may be -g:none AND -g:{lines,source,vars}; + # convert the none case to the curly brace format so it parses like + # the others. + local opts=$( "$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \ + "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p" ) + COMPREPLY=( $( compgen -W "${opts//,/ }" -- "${cur#*:}" ) ) + return + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + [[ $cur == -X* ]] && \ + COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) ) + else + # source files completion + _filedir java + fi + + [[ $COMPREPLY == -*[:=] ]] && compopt -o nospace + + __ltrim_colon_completions "$cur" +} && +complete -F _javac javac + +# ex: filetype=sh diff --git a/completions/javaws b/completions/javaws new file mode 100644 index 0000000..7d6e22c --- /dev/null +++ b/completions/javaws @@ -0,0 +1,34 @@ +# javaws(1) completion -*- shell-script -*- + +_javaws() +{ + local cur prev words cword + _init_completion -n = || return + + case $prev in + -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) + return + ;; + -basedir|-codebase) + _filedir -d + return + ;; + -uninstall|-import) + _filedir jnlp + return + ;; + esac + + if [[ $cur == *= ]]; then + return + elif [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir jnlp +} && +complete -F _javaws javaws + +# ex: filetype=sh diff --git a/completions/jpegoptim b/completions/jpegoptim new file mode 100644 index 0000000..754f16a --- /dev/null +++ b/completions/jpegoptim @@ -0,0 +1,38 @@ +# jpegoptim(1) completion -*- shell-script -*- + +_jpegoptim() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -d|--dest) + _filedir -d + return + ;; + -m|--max|-T|--threshold) + COMPREPLY=( $( compgen -W '{0..100}' -- "$cur" ) ) + return + ;; + -S|--size) + COMPREPLY=( $( compgen -W '{1..99}%' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir 'jp?(e)g' +} && +complete -F _jpegoptim jpegoptim + +# ex: filetype=sh diff --git a/completions/jps b/completions/jps new file mode 100644 index 0000000..42f8d1a --- /dev/null +++ b/completions/jps @@ -0,0 +1,25 @@ +# jps(1) completion -*- shell-script -*- + +_jps() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -J*|-help) + return + ;; + esac + + if [[ $cur == -* ]]; then + # Not using _parse_usage because output has [-help] which does not + # mean -h, -e, -l, -p... + COMPREPLY=( $( compgen -W "-q -m -l -v -V -J -help" -- "$cur" ) ) + [[ $COMPREPLY == -J* ]] && compopt -o nospace + else + _known_hosts_real "$cur" + fi +} && +complete -F _jps jps + +# ex: filetype=sh diff --git a/completions/jshint b/completions/jshint new file mode 100644 index 0000000..ea9bbeb --- /dev/null +++ b/completions/jshint @@ -0,0 +1,38 @@ +# bash completion for jshint -*- shell-script -*- + +_jshint() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -v|--version|-h|--help|--exclude|--filename|-e|--extra-ext) + return + ;; + -c|--config) + _filedir + return + ;; + --reporter) + COMPREPLY=( $( compgen -W "jslint checkstyle unix" -- "$cur" ) ) + return + ;; + --extract) + COMPREPLY=( $( compgen -W "auto always never" -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir js +} && +complete -F _jshint jshint + +# ex: filetype=sh diff --git a/completions/k3b b/completions/k3b new file mode 100644 index 0000000..2cbcbb1 --- /dev/null +++ b/completions/k3b @@ -0,0 +1,48 @@ +# bash completion for k3b -*- shell-script -*- + +_k3b() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help*|--author|-v|--version|--license|--lang) + return + ;; + --datacd|--audiocd|--videocd|--mixedcd|--emovixcd|--videodvd) + _filedir + return + ;; + --copydvd|--formatdvd|--videodvdrip) + _dvd_devices + return + ;; + --copycd|--erasecd|--cddarip|--videocdrip) + _cd_devices + _dvd_devices + return + ;; + --cdimage|--image) + _filedir '@(cue|iso|toc)' + return + ;; + --dvdimage) + _filedir iso + return + ;; + --ao) + COMPREPLY=( $( compgen -W 'alsa arts' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir + fi +} && +complete -F _k3b k3b + +# ex: filetype=sh diff --git a/completions/kcov b/completions/kcov new file mode 100644 index 0000000..7e9aa1e --- /dev/null +++ b/completions/kcov @@ -0,0 +1,61 @@ +# kcov(1) completion -*- shell-script -*- + +_kcov() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case "$prev" in + --pid|-p) + _pids + return + ;; + --sort-type|-s) + COMPREPLY=( $( compgen -W 'filename percent reverse lines + uncovered' -- "$cur" ) ) + return + ;; + --include-path|--exclude-path) + _filedir + return + ;; + --replace-src-path) + if [[ "$cur" == ?*:* ]]; then + cur="${cur##*:}" + _filedir + else + _filedir + compopt -o nospace + fi + return + ;; + --limits|-l) + if [[ "$cur" == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + COMPREPLY=( $( compgen -P "$prev," -W "{0..100}" -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) + compopt -o nospace + fi + return + ;; + --title|-t|--include-pattern|--exclude-pattern|--path-strip-level) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _kcov kcov + +# ex: filetype=sh diff --git a/completions/kill b/completions/kill new file mode 100644 index 0000000..ac179cd --- /dev/null +++ b/completions/kill @@ -0,0 +1,29 @@ +# kill(1) completion -*- shell-script -*- + +_kill() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s) + _signals + return + ;; + -l) + return + ;; + esac + + if [[ $cword -eq 1 && "$cur" == -* ]]; then + # return list of available signals + _signals - + COMPREPLY+=( $( compgen -W "-s -l" -- "$cur" ) ) + else + # return list of available PIDs + _pids + fi +} && +complete -F _kill kill + +# ex: filetype=sh diff --git a/completions/killall b/completions/killall new file mode 100644 index 0000000..6d1532c --- /dev/null +++ b/completions/killall @@ -0,0 +1,36 @@ +# killall(1) completion -*- shell-script -*- + +[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1 + +_killall() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -Z|--context|-o|--older-than|-y|--younger-than|-V|--version) + return + ;; + -s|--signal) + _signals + return + ;; + -u|--user) + _allowed_users + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $cword -eq 1 ]] && _signals - + return + fi + + _pnames +} && +complete -F _killall killall + +# ex: filetype=sh diff --git a/completions/kldload b/completions/kldload new file mode 100644 index 0000000..0442e95 --- /dev/null +++ b/completions/kldload @@ -0,0 +1,21 @@ +# FreeBSD kldload completion -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_kldload() +{ + local cur prev words cword + _init_completion || return + + local moddir=/modules/ + [[ -d $moddir ]] || moddir=/boot/kernel/ + + compopt -o filenames + COMPREPLY=( $( compgen -f "$moddir$cur" ) ) + COMPREPLY=( ${COMPREPLY[@]#$moddir} ) + COMPREPLY=( ${COMPREPLY[@]%.ko} ) + +} && +complete -F _kldload kldload + +# ex: filetype=sh diff --git a/completions/kldunload b/completions/kldunload new file mode 100644 index 0000000..8277018 --- /dev/null +++ b/completions/kldunload @@ -0,0 +1,15 @@ +# FreeBSD kldunload completion -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_kldunload() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( kldstat | command sed -ne \ + "s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) +} && +complete -F _kldunload kldunload + +# ex: filetype=sh diff --git a/completions/koji b/completions/koji new file mode 100644 index 0000000..30b8d49 --- /dev/null +++ b/completions/koji @@ -0,0 +1,247 @@ +# koji completion -*- shell-script -*- + +_koji_search() +{ + COMPREPLY+=( $( compgen -W \ + '$( "$1" -q search $2 "$cur*" 2>/dev/null )' -- "$cur" ) ) +} + +_koji_build() +{ + _koji_search "$1" build +} + +_koji_package() +{ + _koji_search "$1" package +} + +_koji_user() +{ + _koji_search "$1" user +} + +_koji_tag() +{ + COMPREPLY+=( $( compgen -W '$( "$1" -q list-tags 2>/dev/null )' \ + -- "$cur" ) ) +} + +_koji_target() +{ + COMPREPLY+=( $( compgen -W '$( "$1" -q list-targets 2>/dev/null | + awk "{ print \$1 }" )' -- "$cur" ) ) +} + +_koji() +{ + local cur prev words cword split + _init_completion -s || return + + local commandix command + for (( commandix=1; commandix < cword; commandix++ )); do + if [[ ${words[commandix]} != -* ]]; then + command=${words[commandix]} + break + fi + done + + case $prev in + -h|--help|--help-commands) + return + ;; + -c|--config|--keytab|-o) + _filedir + return + ;; + --runas|--user|--editor|--by) + _koji_user "$1" + return + ;; + --authtype) + COMPREPLY=( $( compgen -W 'noauth ssl password kerberos' \ + -- "$cur" ) ) + return + ;; + --topdir) + _filedir -d + return + ;; + --type) + case $command in + latest-pkg|list-tagged) + COMPREPLY=( $( compgen -W 'maven' -- "$cur" ) ) + ;; + esac + return + ;; + --name) + case $command in + list-targets) + _koji_target "$1" + ;; + esac + return + ;; + --owner) + _koji_user "$1" + return + ;; + --tag|--latestfrom) + _koji_tag "$1" + return + ;; + --package) + _koji_package "$1" + return + ;; + --build) + _koji_build "$1" + return + ;; + --build-target) + _koji_target "$1" + return + ;; + esac + + $split && return + + if [[ $command ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( _parse_help "$1" "$command --help" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + # How many'th non-option arg (1-based) for $command are we completing? + local i nth=1 + for (( i=commandix+1; i < cword; i++ )); do + [[ ${words[i]} == -* ]] || (( nth++ )) + done + + case $command in + build|maven-build|win-build) + case $nth in + 1) + _koji_target "$1" + ;; + 2) + _filedir src.rpm + ;; + esac + ;; + cancel) + _koji_build "$1" + ;; + chain-build) + case $nth in + 1) + _koji_target "$1" + ;; + esac + ;; + download-build) + case $nth in + 1) + _koji_build "$1" + ;; + esac + ;; + import-comps) + case $nth in + 1) + _filedir xml + ;; + 2) + _koji_tag "$1" + ;; + esac + ;; + latest-by-tag) + _koji_package "$1" + ;; + latest-pkg|list-groups|list-tag-inheritance|show-groups) + case $nth in + 1) + _koji_tag "$1" + ;; + esac + ;; + list-tagged) + case $nth in + 1) + _koji_tag "$1" + ;; + 2) + _koji_package "$1" + ;; + esac + ;; + list-untagged) + case $nth in + 1) + _koji_package "$1" + ;; + esac + ;; + move-pkg) + case $nth in + 1|2) + _koji_tag "$1" + ;; + *) + _koji_package "$1" + ;; + esac + ;; + search) + case $nth in + 1) + COMPREPLY=( $( compgen -W 'package build tag target + user host rpm' -- "$cur" ) ) + ;; + esac + ;; + tag-pkg|untag-pkg) + case $nth in + 1) + _koji_tag "$1" + ;; + *) + _koji_package "$1" + ;; + esac + ;; + taginfo) + _koji_tag "$1" + ;; + wait-repo) + case $nth in + 1) + for (( i=commandix+1; i < cword; i++ )); do + if [[ ${words[i]} == --target ]]; then + _koji_target "$1" + return + fi + done + _koji_tag "$1" + ;; + esac + ;; + esac + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + elif [[ ! $command ]]; then + COMPREPLY=( $( compgen -W '$( "$1" --help-commands 2>/dev/null | \ + awk "/^( +|\t)/ { print \$1 }" )' -- "$cur" ) ) + fi +} && +complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji + +# ex: filetype=sh diff --git a/completions/ktutil b/completions/ktutil new file mode 100644 index 0000000..384db32 --- /dev/null +++ b/completions/ktutil @@ -0,0 +1,120 @@ +# ktutil completion -*- shell-script -*- + +_heimdal_principals() +{ + COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \ + awk '{print $1}' )" -- "$cur" ) ) +} + +_heimdal_realms() +{ + COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \ + awk '{print $1}' | awk -F@ '{print $2}' )" -- "$cur" ) ) +} + +_heimdal_encodings() +{ + COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 + des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 + aes256-cts-hmac-sha1-96' -- "$cur" ) ) +} + +_ktutil() +{ + local cur prev words cword split + _init_completion -s || return + + local command options + + case $prev in + -p|--principal) + _heimdal_principals + return + ;; + -e|--enctype) + _heimdal_encodings + return + ;; + -a|--admin-server) + _known_hosts_real "$cur" + return + ;; + -r|--realm) + _heimdal_realms + return + ;; + -s|-k|--srvtab|--keytab) + _filedir + return + ;; + esac + + $split && return + + commands='add change copy get list remove rename purge srvconvert + srv2keytab srvcreate key2srvtab' + + for (( i=1; i < cword; i++ )); do + case ${words[i]} in + -k|--keytab) + i=$(($i+1)) + ;; + -*) + ;; + *) + command=${words[i]} + break + ;; + esac + done + + if [[ "$cur" == -* ]]; then + case $command in + add) + options='-p --principal -V -e --enctype -w --password -r + --random -s --no-salt -h --hex' + ;; + change) + options='-r --realm -a --admin-server -s --server-port' + ;; + get) + options='-p --principal -e --enctype -r --realm -a + --admin-server -s server --server-port' + ;; + list) + options='--keys --timestamp' + ;; + remove) + options='-p --principal -V --kvno -e --enctype' + ;; + purge) + options='--age' + ;; + srv2keytab|key2srvtab) + options='-s --srvtab' + ;; + *) + options='-k --keytab -v --verbose --version -v --help' + ;; + esac + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + case $command in + copy) + _filedir + ;; + get) + _heimdal_principals + ;; + rename) + _heimdal_principals + ;; + *) + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + ;; + esac + fi +} && +complete -F _ktutil ktutil + +# ex: filetype=sh diff --git a/completions/larch b/completions/larch new file mode 100644 index 0000000..5b7ebd1 --- /dev/null +++ b/completions/larch @@ -0,0 +1,39 @@ +# larch(1) completion -*- shell-script -*- +# by Alex Shinn + +_larch() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 || "$prev" == -* ]]; then + COMPREPLY=( $( compgen -W ' \ + my-id my-default-archive register-archive whereis-archive archives \ + init-tree tree-root tree-version set-tree-version inventory \ + tagging-method tree-lint missing-tags add delete \ + move explicit-default set-manifest manifest check-manifest mkpatch \ + dopatch patch-report empty-patch make-archive make-category \ + make-branch make-version categories branches versions revisions \ + cat-archive-log archive-cache-revision archive-cached-revisions \ + archive-uncache-revision category-readme branch-readme \ + version-readme make-log logs add-log log-ls cat-log \ + log-header-field changelog log-for-merge merge-points \ + new-on-branch import commit get get-patch lock-branch \ + lock-revision push-mirror build-config update-config replay-config \ + record-config show-config config-history update replay delta-patch \ + star-merge tag prepare-branch finish-branch join-branch \ + whats-missing what-changed file-diffs pristines lock-pristine \ + my-revision-library library-find library-add library-remove \ + library-archives library-categories library-branches \ + library-versions library-revisions library-log library-file \ + touched-files-prereqs patch-set-web update-distributions \ + distribution-name notify my-notifier mail-new-categories \ + mail-new-branches mail-new-versions mail-new-revisions \ + notify-library notify-browser push-new-revisions sendmail-mailx' \ + "$cur" ) ) + fi + +} && +complete -F _larch -o default larch + +# ex: filetype=sh diff --git a/completions/lastlog b/completions/lastlog new file mode 100644 index 0000000..4ac6b52 --- /dev/null +++ b/completions/lastlog @@ -0,0 +1,25 @@ +# lastlog(8) completion -*- shell-script -*- + +_lastlog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -b|--before|-h|--help|-t|--time) + return + ;; + -u|--user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _lastlog lastlog + +# ex: filetype=sh diff --git a/completions/ldapsearch b/completions/ldapsearch new file mode 100644 index 0000000..282760f --- /dev/null +++ b/completions/ldapsearch @@ -0,0 +1,232 @@ +# bash completion for openldap -*- shell-script -*- + +_ldap_uris() +{ + COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) ) +} + +_ldap_protocols() +{ + COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) ) +} + +_ldapsearch() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -T) + _filedir -d + return + ;; + -f|-y) + _filedir + return + ;; + -s) + COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) ) + return + ;; + -a) + COMPREPLY=( $( compgen -W 'never always search find' \ + -- "$cur" ) ) + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldapsearch ldapsearch + +_ldapaddmodify() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -S|-f|-y) + _filedir + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldapaddmodify ldapadd ldapmodify + +_ldapdelete() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -f|-y) + _filedir + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldapdelete ldapdelete + +_ldapcompare() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -y) + _filedir + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldapcompare ldapcompare + +_ldapmodrdn() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -f|-y) + _filedir + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -ZZ -MM' -- "$cur" ) ) + fi +} && +complete -F _ldapmodrdn ldapmodrdn + +_ldapwhoami() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -f|-y) + _filedir + return + ;; + -P) + _ldap_protocols + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldapwhoami ldapwhoami + +_ldappasswd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real "$cur" + return + ;; + -H) + _ldap_uris + return + ;; + -t|-T|-y) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + fi +} && +complete -F _ldappasswd ldappasswd + +# ex: filetype=sh diff --git a/completions/ldapvi b/completions/ldapvi new file mode 100644 index 0000000..e3c1f10 --- /dev/null +++ b/completions/ldapvi @@ -0,0 +1,51 @@ +# bash completion for ldapvi -*- shell-script -*- + +_ldapvi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--host) + _known_hosts_real "$cur" + return + ;; + -Y|--sasl-mech) + COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 + PLAIN ANONYMOUS' -- "$cur" ) ) + return + ;; + --bind) + COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) ) + return + ;; + --bind-dialog) + COMPREPLY=( $( compgen -W 'never auto always' -- "$cur" ) ) + return + ;; + --scope) + COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) ) + return + ;; + --deref) + COMPREPLY=( $( compgen -W 'never searching finding always' \ + -- "$cur" ) ) + return + ;; + --encoding) + COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) ) + return + ;; + --tls) + COMPREPLY=( $( compgen -W 'never allow try strict' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _ldapvi ldapvi + +# ex: filetype=sh diff --git a/completions/lftp b/completions/lftp new file mode 100644 index 0000000..edb363b --- /dev/null +++ b/completions/lftp @@ -0,0 +1,29 @@ +# lftp(1) completion -*- shell-script -*- + +_lftp() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f) + _filedir + return + ;; + -c|-h|--help|-v|--version|-e|-u|-p) + return + ;; + esac + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -W \ + '$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) ) + _known_hosts_real "$cur" +} && +complete -F _lftp lftp + +# ex: filetype=sh diff --git a/completions/lftpget b/completions/lftpget new file mode 100644 index 0000000..8f1d4a2 --- /dev/null +++ b/completions/lftpget @@ -0,0 +1,14 @@ +# lftpget(1) completion -*- shell-script -*- + +_lftpget() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) + fi +} && +complete -F _lftpget lftpget + +# ex: filetype=sh diff --git a/completions/lilo b/completions/lilo new file mode 100644 index 0000000..1ccca35 --- /dev/null +++ b/completions/lilo @@ -0,0 +1,50 @@ +# bash completion for lilo(8) -*- shell-script -*- + +_lilo_labels() +{ + COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ + /etc/lilo.conf | command sed -e 's/\"//g' )" -- "$cur" ) ) +} + +_lilo() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -C|-i|-m|-s|-S) + _filedir + return + ;; + -r) + _filedir -d + return + ;; + -I|-D|-R) + # label completion + _lilo_labels + return + ;; + -A|-b|-M|-u|-U) + # device completion + cur=${cur:=/dev/} + _filedir + return + ;; + -T) + # topic completion + COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= table= + video' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m -M -p -P + -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur" ) ) + fi +} && +complete -F _lilo lilo + +# ex: filetype=sh diff --git a/completions/links b/completions/links new file mode 100644 index 0000000..8c72970 --- /dev/null +++ b/completions/links @@ -0,0 +1,33 @@ +# bash completion for links -*- shell-script -*- + +_links() +{ + local cur prev words cword + _init_completion || return + + case $cur in + --*) + COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) + ;; + -*) + COMPREPLY=( $( compgen -W '-async-dns -max-connections + -max-connections-to-host -retries -receive-timeout + -unrestartable-receive-timeout -format-cache-size + -memory-cache-size -http-proxy -ftp-proxy -download-dir + -assume-codepage -anonymous -dump -no-connect -source -version + -help' -- "$cur" ) ) + ;; + *) + if [[ -r ~/.links/links.his ]]; then + COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \ + -- "$cur" ) ) + fi + _filedir '@(htm|html)' + return + ;; + esac + +} && +complete -F _links links + +# ex: filetype=sh diff --git a/completions/lintian b/completions/lintian new file mode 100644 index 0000000..e62a626 --- /dev/null +++ b/completions/lintian @@ -0,0 +1,170 @@ +# bash completion for lintian(1) and lintian-info(1) -*- shell-script -*- + +_lintian_tags() +{ + local match search tags + + tags=$( awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc ) + if [[ "$cur" == *, ]]; then + search=${cur//,/ } + for item in $search; do + match=$( command grep -nE "^Tag: $item$" \ + /usr/share/lintian/checks/*.desc | cut -d: -f1 ) + tags=$( command sed -e "s/\<$item\>//g" <<<$tags ) + done + COMPREPLY+=( $(compgen -W "$tags") ) + elif [[ "$cur" == *,* ]]; then + COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}") ) + else + COMPREPLY+=( $(compgen -W "$tags" -- "$cur") ) + fi +} + +_lintian_checks() +{ + local match search todisable checks + + checks=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' \ + /usr/share/lintian/checks/*.desc ) + if [[ "$cur" == *, ]]; then + search=${cur//,/ } + for item in $search; do + match=$( command grep -nE "^(Check-Script|Abbrev): $item$" \ + /usr/share/lintian/checks/*.desc | cut -d: -f1 ) + todisable=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' $match ) + for name in $todisable; do + checks=$( command sed -e "s/\<$name\>//g" <<<$checks ) + done + done + COMPREPLY+=( $(compgen -W "$checks") ) + elif [[ "$cur" == *,* ]]; then + COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}") ) + else + COMPREPLY+=( $(compgen -W "$checks" -- "$cur") ) + fi +} + +_lintian_infos() +{ + local match search infos + + infos=$( awk '/^Collector/ { print $2 }' \ + /usr/share/lintian/collection/*.desc ) + if [[ "$cur" == *, ]]; then + search=${cur//,/ } + for item in $search; do + match=$( command grep -nE "^Collector: $item$" \ + /usr/share/lintian/collection/*.desc | cut -d: -f1 ) + infos=$( command sed -e "s/\<$item\>//g" <<<$infos ) + done + COMPREPLY+=( $(compgen -W "$infos") ) + elif [[ "$cur" == *,* ]]; then + COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}") ) + else + COMPREPLY+=( $(compgen -W "$infos" -- "$cur") ) + fi +} + +_lintian() +{ + local cur prev words cword + _init_completion || return + + local action lint_actions general_opts behaviour_opts \ + configuration_opts selection_opts + + lint_actions="--setup-lab --remove-lab --check --check-part --tags + --tags-from-file --ftp-master-rejects --dont-check-part --unpack + --remove" + general_opts="--help --version --print-version --verbose --debug --quiet" + behaviour_opts="--info --display-info --display-experimental --pedantic + --display-level --suppress-tags --suppress-tags-from-file --no-override + --show-overrides --color --unpack-info --md5sums --checksums + --allow-root --fail-on-warnings --keep-lab" + configuration_opts="--cfg --lab --archivedir --dist --area --section --arch + --root" + selection_opts="--all --binary --source --udeb --packages-file" + + if [[ "$prev" == -* ]]; then + case $prev in + -C|--check-part|-X|--dont-check-part) + _lintian_checks + ;; + -T|--tags|--suppress-tags) + _lintian_tags + ;; + --tags-from-file|--suppress-tags-from-file|--cfg|-p|\ + --packages-file) + _filedir + ;; + --lab|--archivedir|--dist|--root) + _filedir -d + ;; + --color) + COMPREPLY=($(compgen -W "never always auto html" -- "$cur")) + ;; + -U|--unpack-info) + _lintian_infos + ;; + --area|--section) + COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur")) + ;; + --arch) + ;; + esac + fi + + case "$cur" in + --*) + COMPREPLY=($(compgen -W "$lint_actions $general_opts + $behaviour_opts $configuration_opts" -- "$cur")) + ;; + *,) + # If we're here, the user is trying to complete on + # --action tag,tag, + # Only few actions permit that, re-complete them now. + case "$prev" in + -C|--check-part|-X|--dont-check-part) + _lintian_checks + ;; + -T|--tags|--suppress-tags) + _lintian_tags + ;; + -U|--unpack-info) + _lintian_infos + ;; + esac + ;; + *) + _filedir '@(?(u)deb|changes|dsc)' + ;; + esac + return 0 +} && +complete -F _lintian lintian + +_lintian_info() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -t|--tags) + _lintian_tags + return 0 + ;; + esac + + case "$cur" in + --*) + COMPREPLY=($(compgen -W "--annotate --help --tags" -- "$cur")) + ;; + *) + _filedir + ;; + esac + return 0 +} && +complete -F _lintian_info lintian-info + +# ex: filetype=sh diff --git a/completions/lisp b/completions/lisp new file mode 100644 index 0000000..279ffcd --- /dev/null +++ b/completions/lisp @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_lisp() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init + -dynamic-space-size -hinit -noinit -nositeinit -load -slave' \ + -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _lisp -o default lisp + +# ex: filetype=sh diff --git a/completions/list_admins b/completions/list_admins new file mode 100644 index 0000000..06542f9 --- /dev/null +++ b/completions/list_admins @@ -0,0 +1,17 @@ +# mailman list_admins completion -*- shell-script -*- + +_list_admins() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _list_admins list_admins + +# ex: filetype=sh diff --git a/completions/list_lists b/completions/list_lists new file mode 100644 index 0000000..629e4c0 --- /dev/null +++ b/completions/list_lists @@ -0,0 +1,21 @@ +# mailman list_lists completion -*- shell-script -*- + +_mailman_lists() +{ + COMPREPLY=( $( compgen -W '$( list_lists -b 2>/dev/null )' -- "$cur" ) ) +} + +_list_lists() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview --bare + --help' -- "$cur" ) ) + fi + +} && +complete -F _list_lists list_lists + +# ex: filetype=sh diff --git a/completions/list_members b/completions/list_members new file mode 100644 index 0000000..e60f61d --- /dev/null +++ b/completions/list_members @@ -0,0 +1,36 @@ +# mailman list_members completion -*- shell-script -*- + +_list_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -o|--output) + _filedir + return + ;; + -d|--digest) + COMPREPLY=( $( compgen -W 'mime plain' -- "$cur" ) ) + return + ;; + -n|--nomail) + COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ + -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--output --regular --digest --nomail + --fullnames --preserve --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _list_members list_members + +# ex: filetype=sh diff --git a/completions/list_owners b/completions/list_owners new file mode 100644 index 0000000..88b25bb --- /dev/null +++ b/completions/list_owners @@ -0,0 +1,18 @@ +# mailman list_owners completion -*- shell-script -*- + +_list_owners() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--with-listnames --moderators --help' \ + -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _list_owners list_owners + +# ex: filetype=sh diff --git a/completions/lpq b/completions/lpq new file mode 100644 index 0000000..b02705a --- /dev/null +++ b/completions/lpq @@ -0,0 +1,28 @@ +# lpq(1) completion -*- shell-script -*- + +_lpq() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -P) + COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) + return + ;; + -U) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == - ]]; then + COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _lpq lpq + +# ex: filetype=sh diff --git a/completions/lpr b/completions/lpr new file mode 100644 index 0000000..b1515bd --- /dev/null +++ b/completions/lpr @@ -0,0 +1,33 @@ +# lpr(1) completion -*- shell-script -*- + +_lpr() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -P) + COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) + return + ;; + -U) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + -o) + COMPREPLY=( $( compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + ;; + esac + + if [[ "$cur" == - ]]; then + COMPREPLY=( $( compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _lpr lpr + +# ex: filetype=sh diff --git a/completions/lrzip b/completions/lrzip new file mode 100644 index 0000000..f8e2cf1 --- /dev/null +++ b/completions/lrzip @@ -0,0 +1,53 @@ +# lrzip(1) completion -*- shell-script -*- + +_lrzip() +{ + local cur prev words cword + _init_completion || return + + local xspec="*.lrz" + + case $prev in + -w|-S|-V|-h|-'?'|-m) + return + ;; + -d) + xspec="!"$xspec + ;; + -o) + _filedir + return + ;; + -O) + _filedir -d + return + ;; + -L) + COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + return + ;; + -N) + COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) ) + return + ;; + -p) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + esac + + _expand || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lrzip lrzip + +# ex: filetype=sh diff --git a/completions/lsof b/completions/lsof new file mode 100644 index 0000000..329946d --- /dev/null +++ b/completions/lsof @@ -0,0 +1,56 @@ +# lsof(8) completion -*- shell-script -*- + +_lsof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T) + return + ;; + -A|-k|-m|+m|-o) + _filedir + return + ;; + +d|+D) + _filedir -d + return + ;; + -D) + COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) ) + return + ;; + -f) + COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) ) + return + ;; + -g) + # TODO: handle ^foo exclusions, comma separated lists + _pgids + return + ;; + -p) + # TODO: handle ^foo exclusions, comma separated lists + _pids + return + ;; + -u) + # TODO: handle ^foo exclusions, comma separated lists + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == [-+]* ]]; then + COMPREPLY=( $( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g + -i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t + -u -U -v -V +w -w -x -X -z -Z' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _lsof lsof + +# ex: filetype=sh diff --git a/completions/lua b/completions/lua new file mode 100644 index 0000000..9413319 --- /dev/null +++ b/completions/lua @@ -0,0 +1,23 @@ +# lua(1) completion -*- shell-script -*- + +_lua() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -e|-l|-v|-) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + return + fi + + _filedir 'l@(ua|?(ua)c)' +} && +complete -F _lua lua + +# ex: filetype=sh diff --git a/completions/luac b/completions/luac new file mode 100644 index 0000000..9c91f25 --- /dev/null +++ b/completions/luac @@ -0,0 +1,27 @@ +# luac(1) completion -*- shell-script -*- + +_luac() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -v|-) + return + ;; + -o) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + return + fi + + _filedir lua +} && +complete -F _luac luac + +# ex: filetype=sh diff --git a/completions/luseradd b/completions/luseradd new file mode 100644 index 0000000..41769b0 --- /dev/null +++ b/completions/luseradd @@ -0,0 +1,40 @@ +# luseradd(1) and lusermod(1) completion -*- shell-script -*- + +_luseradd() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -\?|--help|--usage|-c|--gecos|-u|--uid|-l|--login|-P|--plainpassword|\ + -p|--password|--commonname|--givenname|--surname|--roomnumber|\ + --telephonenumber|--homephone) + return + ;; + -d|--directory|-k|--skeleton) + _filedir -d + return + ;; + -s|--shell) + _shells + return + ;; + -g|--gid) + _gids + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + [[ ${1##*/} == luseradd ]] || COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _luseradd luseradd lusermod + +# ex: filetype=sh diff --git a/completions/luserdel b/completions/luserdel new file mode 100644 index 0000000..83e1818 --- /dev/null +++ b/completions/luserdel @@ -0,0 +1,23 @@ +# luserdel(1) completion -*- shell-script -*- + +_luserdel() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -\?|--help|--usage) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _luserdel luserdel + +# ex: filetype=sh diff --git a/completions/lvm b/completions/lvm new file mode 100644 index 0000000..fb83a3f --- /dev/null +++ b/completions/lvm @@ -0,0 +1,869 @@ +# bash completion for lvm -*- shell-script -*- + +_lvm_filedir() +{ + cur=${cur:-/dev/} + _filedir +} + +_lvm_volumegroups() +{ + COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ + command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) +} + +_lvm_physicalvolumes_all() +{ + COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ + command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur" ) ) +} + +_lvm_physicalvolumes() +{ + COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) +} + +_lvm_logicalvolumes() +{ + COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ + command sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) + if [[ $cur == /dev/mapper/* ]]; then + _filedir + local i + for i in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' + done + fi +} + +_lvm_units() +{ + COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) ) +} + +_lvm_sizes() +{ + COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) ) +} + +# @param $1 glob matching args known to take an argument +_lvm_count_args() +{ + args=0 + local offset=1 + if [[ "${words[0]}" == lvm ]]; then + offset=2 + fi + local i prev=${words[$offset-1]} + for (( i=$offset; i < cword; i++ )); do + if [[ "${words[i]}" != -* && $prev != $1 ]]; then + args=$(($args + 1)) + fi + prev=${words[i]} + done +} + +_lvmdiskscan() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + fi +} && +complete -F _lvmdiskscan lvmdiskscan + +_pvscan() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup --help + --ignorelockingfailure --partial --short --uuid --verbose + --version' -- "$cur" ) ) + fi +} && +complete -F _pvscan pvscan + +_pvs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-O|--options|--sort) + COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used + pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur" ) ) + return + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_physicalvolumes_all + fi +} && +complete -F _pvs pvs + +_pvdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_physicalvolumes_all + fi +} && +complete -F _pvdisplay pvdisplay + +_pvchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|-x|--autobackup|--allocatable) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_physicalvolumes_all + fi +} && +complete -F _pvchange pvchange + +_pvcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --restorefile) + _filedir + return + ;; + -M|--metadatatype) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + --metadatacopies) + COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) + return + ;; + --metadatasize|--setphysicalvolumesize) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_filedir + fi +} && +complete -F _pvcreate pvcreate + +_pvmove() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -n|--name) + _lvm_logicalvolumes + return + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--abort --autobackup --background --debug + --force --help --interval --test --verbose --version --name' \ + -- "$cur" ) ) + else + _lvm_physicalvolumes + fi +} && +complete -F _pvmove pvmove + +_pvremove() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_physicalvolumes_all + fi +} && +complete -F _pvremove pvremove + +_vgscan() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + fi +} && +complete -F _vgscan vgscan + +_vgs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-O|--options|--sort) + COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size + vg_free vg_sysid vg_extent_size vg_extent_count vg_free_count + max_lv max_pv pv_count lv_count snap_count vg_seqno' \ + -- "$cur" ) ) + return + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgs vgs + +_vgdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgdisplay vgdisplay + +_vgchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|-A|-x|--available|--autobackup|--resizeable) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--autobackup --alloc --partial --debug + --help --ignorelockingfailure --test --uuid --verbose --version + --available --resizeable --logicalvolume --addtag --deltag' \ + -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgchange vgchange + +_vgcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -M|--metadatatype) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + -s|--physicalextentsize) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc --debug --help + --maxlogicalvolumes --metadatatype --maxphysicalvolumes + --physicalextentsize --test --verbose --version' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else + _lvm_physicalvolumes_all + fi + fi +} && +complete -F _vgcreate vgcreate + +_vgremove() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgremove vgremove + +_vgrename() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgrename vgrename + +_vgreduce() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + + else + local args + _lvm_count_args '@(-A|--autobackup)' + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && +complete -F _vgreduce vgreduce + +_vgextend() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -L|--size) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else + _lvm_physicalvolumes_all + fi + fi +} && +complete -F _vgextend vgextend + +_vgport() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgport vgimport vgexport + +_vgck() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgck vgck + +_vgconvert() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -M|--metadatatype) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + --metadatacopies) + COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) + return + ;; + --metadatasize) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgconvert vgconvert + +_vgcfgbackup() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|--file) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgcfgbackup vgcfgbackup + +_vgcfgrestore() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|--file) + _filedir + return + ;; + -M|--metadatatype) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + -n|--name) + _lvm_volumegroups + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgcfgrestore vgcfgrestore + +_vgmerge() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgmerge vgmerge + +_vgsplit() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -M|--metadatatype) + COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--autobackup --debug --help --list + --metadatatype --test --verbose --version' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' + if [[ $args -eq 0 || $args -eq 1 ]]; then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && +complete -F _vgsplit vgsplit + +_vgmknodes() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_volumegroups + fi +} && +complete -F _vgmknodes vgmknodes + +_lvscan() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + fi +} && +complete -F _lvscan lvscan + +_lvs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-O|--options|--sort) + COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size + seg_count origin snap_percent segtype stripes stripesize + chunksize seg_start seg_size' -- "$cur" ) ) + return + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvs lvs + +_lvdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvdisplay lvdisplay + +_lvchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|-A|-C|-M|--available|--autobackup|--contiguous|--persistent) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -p|--permission) + COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvchange lvchange + +_lvcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -L|--size) + _lvm_sizes + return + ;; + -p|--permission) + COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) + return + ;; + -n|--name) + _lvm_logicalvolumes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && +complete -F _lvcreate lvcreate + +_lvremove() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvremove lvremove + +_lvrename() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvrename lvrename + +_lvreduce() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -L|--size) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _lvm_logicalvolumes + fi +} && +complete -F _lvreduce lvreduce + +_lvresize() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -L|--size) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if [[ $args -eq 0 ]]; then + _lvm_logicalvolumes + else + _lvm_physicalvolumes + fi + fi +} && +complete -F _lvresize lvresize + +_lvextend() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -A|--autobackup) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return + ;; + -L|--size) + _lvm_sizes + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if [[ $args -eq 0 ]]; then + _lvm_logicalvolumes + else + _lvm_physicalvolumes + fi + fi +} && +complete -F _lvextend lvextend + +_lvm() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'dumpconfig help lvchange lvcreate lvdisplay + lvextend lvmchange lvmdiskscan lvmsadc lvmsar lvreduce lvremove + lvrename lvresize lvs lvscan pvchange pvcreate pvdata pvdisplay + pvmove pvremove pvresize pvs pvscan vgcfgbackup vgcfgrestore + vgchange vgck vgconvert vgcreate vgdisplay vgexport vgextend + vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan + vgsplit version' -- "$cur" ) ) + else + case "${words[1]}" in + pvchange|pvcreate|pvdisplay|pvmove|pvremove|pvresize|pvs|pvscan|\ + vgcfgbackup|vgcfgrestore|vgchange|vgck|vgconvert|vgcreate|\ + vgdisplay|vgexport|vgextend|vgimport|vgmerge|vgmknodes|vgreduce|\ + vgremove|vgrename|vgs|vgscan|vgsplit|lvchange|lvcreate|lvdisplay|\ + lvextend|lvreduce|lvremove|lvrename|lvresize|lvscan) + _${words[1]} + ;; + esac + fi +} && +complete -F _lvm lvm + +# ex: filetype=sh diff --git a/completions/lz4 b/completions/lz4 new file mode 100644 index 0000000..56602ca --- /dev/null +++ b/completions/lz4 @@ -0,0 +1,53 @@ +# lz4 completion -*- shell-script -*- + +_lz4() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( _parse_help "$1" -h | command sed -e "/#/d" ) -B{4..7} -i{1..9}' \ + -- "$cur" ) ) + return + fi + + local args word xspec="*.?(t)lz4" + _count_args + [[ $args -gt 2 ]] && return + + for word in ${words[@]}; do + case $word in + -*[dt]*) + case $args in + 1) xspec="!"$xspec ;; + 2) [[ $word == *t* ]] && return + esac + break + ;; + -z) + case $args in + 1) xspec= ;; + 2) xspec="!"$xspec ;; + esac + break + ;; + esac + done + + _expand || return + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lz4 lz4 lz4c + +# ex: filetype=sh diff --git a/completions/lzip b/completions/lzip new file mode 100644 index 0000000..c1aab4a --- /dev/null +++ b/completions/lzip @@ -0,0 +1,49 @@ +# lzip(1) completion -*- shell-script -*- + +_lzip() +{ + local cur prev words cword split + _init_completion -s || return + + local decompress=false + + case $prev in + -h|--help|-V|--version|-b|--member-size|-m|--match-length|\ + -s|--dictionary-size|-S|--volume-size|-B|--data-size) + return + ;; + -d|--decompress) + decompress=true + ;; + -n|--threads) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + -o|--output) + _filedir + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + if $decompress; then + _filedir lz + return + fi + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -f -X "*.lz" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lzip clzip lzip pdlzip plzip + +# ex: filetype=sh diff --git a/completions/lzma b/completions/lzma new file mode 100644 index 0000000..74dac25 --- /dev/null +++ b/completions/lzma @@ -0,0 +1,35 @@ +# lzma(1) completion -*- shell-script -*- +# by Per Øyvind Karlsen + +_lzma() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 + --help --decompress --compress --keep --force --suffix --test + --stdout --quiet --verbose --license --list --version --small + --fast --best --text' -- "$cur" ) ) + return + fi + + local IFS=$'\n' xspec="*.@(lzma|tlz)" + + if [[ "$prev" == --* ]]; then + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ "$prev" == --compress ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec + [[ "$prev" == -*z* ]] && xspec= + fi + + _expand || return + + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lzma lzma + +# ex: filetype=sh diff --git a/completions/lzop b/completions/lzop new file mode 100644 index 0000000..f675352 --- /dev/null +++ b/completions/lzop @@ -0,0 +1,60 @@ +# lzop(1) completion -*- shell-script -*- + +_lzop() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|--output) + _filedir + return + ;; + --path) + _filedir -d + return + ;; + -S|--suffix) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P + --fast --best --decompress --extract --test --list --ls --info + --sysinfo --license --help --version --stdout --output --path + --force --no-checksum --no-name --name --no-mode --no-time --suffix + --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose + --no-stdin --filter --checksum --no-color --mono --color' \ + -- "$cur" ) ) + return + fi + + local xspec="*.?(t)lzo" + case $prev in + --decompress|--uncompress|--extract|--list|--ls|--info|--test) + xspec="!"$xspec + ;; + --force) + xspec= + ;; + --*) + ;; + -*f*) + xspec= + ;; + -*[dltx]*) + xspec="!"$xspec + ;; + esac + + _expand || return + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lzop lzop + +# ex: filetype=sh diff --git a/completions/macof b/completions/macof new file mode 100644 index 0000000..dacae2f --- /dev/null +++ b/completions/macof @@ -0,0 +1,23 @@ +# macof completion -*- shell-script -*- + +_macof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _macof macof + +# ex: filetype=sh diff --git a/completions/mailmanctl b/completions/mailmanctl new file mode 100644 index 0000000..717df7b --- /dev/null +++ b/completions/mailmanctl @@ -0,0 +1,18 @@ +# mailmanctl completion -*- shell-script -*- + +_mailmanctl() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--no-restart --run-as-user + --stale-lock-cleanup --quiet --help' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) ) + fi + +} && +complete -F _mailmanctl mailmanctl + +# ex: filetype=sh diff --git a/completions/make b/completions/make new file mode 100644 index 0000000..1075b37 --- /dev/null +++ b/completions/make @@ -0,0 +1,172 @@ +# bash completion for GNU make -*- shell-script -*- + +_make_target_extract_script() +{ + local mode="$1" + shift + + local prefix="$1" + local prefix_pat=$( command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix" ) + local basename=${prefix##*/} + local dirname_len=$(( ${#prefix} - ${#basename} )) + + if [[ $mode == -d ]]; then + # display mode, only output current path component to the next slash + local output="\2" + else + # completion mode, output full path to the next slash + local output="\1\2" + fi + + cat <