diff options
673 files changed, 9955 insertions, 12214 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index 537ba6c3..ce251c0a 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,5 +1,3 @@ -;; bash-completion shell-script mode settings for Emacs +;; bash-completion shell-script mode additional settings for Emacs -((sh-mode . ((indent-tabs-mode . nil) - (sh-basic-offset . 4) - (sh-indent-comment . t)))) +((sh-mode . ((sh-indent-comment . t)))) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..93f55b83 --- /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/.gitignore b/.gitignore new file mode 100644 index 00000000..083411ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +*.tar* +*.swp +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.log +config.status +configure +install-sh +missing +doc/*.xml +*~ +doc/html* +bash_completion.sh +bash-completion.pc +bash-completion-config.cmake +bash-completion-config-version.cmake diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c287960c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: generic + +sudo: required + +services: + - docker + +env: + - DIST=centos6 + - DIST=fedoradev + - DIST=ubuntu14 + +before_install: + - docker build -t bashcomp:$DIST -f test/docker/Dockerfile-$DIST . + +script: + - docker run -e CI=true -e DIST=$DIST -t bashcomp:$DIST test/docker/docker-script.sh @@ -5,5 +5,3 @@ Igor Murzov <e-mail@date.by> Mike Kelly (Exherbo) <pioto@pioto.org> Santiago M. Mola (Exherbo) <cooldwind@gmail.com> Ville Skyttä (Fedora/Red Hat) <ville.skytta@iki.fi> - -To contact us: bash-completion-devel@lists.alioth.debian.org @@ -1,3 +1,697 @@ +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ä <ville.skytta@iki.fi> 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ä <ville.skytta@iki.fi> 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ä <ville.skytta@iki.fi> 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ä <ville.skytta@iki.fi> 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ä <ville.skytta@iki.fi> 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 <buildfile> 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ä <ville.skytta@iki.fi> Thu, 03 Mar 2016 17:22:50 +0200 + bash-completion (2.1) [ AllKind ] @@ -1272,4 +1966,3 @@ bash-completion (20060301-0ubuntu1) hardy; urgency=low Ubuntu: #139666. -- Matthias Klose <doko@ubuntu.com> Fri, 08 Feb 2008 16:46:34 +0100 - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..41287366 --- /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/Makefile.am b/Makefile.am index dbbba0c2..1df73ae0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,17 +11,26 @@ 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 $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \ - .dir-locals.el +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 && \ + 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 deleted file mode 100644 index 488f4d08..00000000 --- a/Makefile.in +++ /dev/null @@ -1,836 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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 = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/bash-completion.pc.in \ - $(top_srcdir)/configure AUTHORS COPYING install-sh missing -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) -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 -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-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 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)$(compatdir)" "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)" -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=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -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__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.bz2 -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@ -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 -CLEANFILES = bash_completion.sh bash-completion.pc -EXTRA_DIST = CHANGES $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \ - .dir-locals.el - -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 -.PRECIOUS: 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 $@ -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. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; 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" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - 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; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - 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 -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - 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" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -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) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__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*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(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*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(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 \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(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__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)$(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-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-compatDATA uninstall-pkgconfigDATA \ - uninstall-pkgdataDATA uninstall-profileDATA - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-data-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-lzip dist-lzma 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-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-recursive uninstall uninstall-am \ - uninstall-compatDATA uninstall-pkgconfigDATA \ - uninstall-pkgdataDATA uninstall-profileDATA - - -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 && \ - 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 b/README deleted file mode 100644 index 1558f62f..00000000 --- a/README +++ /dev/null @@ -1,411 +0,0 @@ -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: - -# 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: - -./configure -make -make check # optional, requires dejagnu and tcllib -make install # as root - -These commands installs 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, turn off programmable completion -with "shopt -u progcomp" in $XDG_CONFIG_HOME/bash_completion -(~/.config/bash_completion if $XDG_CONFIG_HOME is not set), and turn -it back on for example in ~/.bashrc if you want to use programmable -completion for other purposes. - -If you're using MacOS 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: - -if [ -f /sw/etc/bash_completion ]; then - . /sw/etc/bash_completion -fi - - -TROUBLESHOOTING ---------------- - -If you find that a given function is producing errors 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'. - - -KNOWN PROBLEMS --------------- - -I. - -There seems to be some issue with using the bash built-in cd within -Makefiles. When invoked as /bin/sh within Makefiles, 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. - -II. - -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. - -III. - -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 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? - - Install it in one of the directories pointed to by - bash-completion's pkgconfig file variables. There are two - alternatives: the recommended one is 'completionsdir' (get it with - "pkg-config --variable=completionsdir bash-completion") from which - 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 one which is present for - backwards compatibility reasons is 'compatdir' (get it with - "pkg-config --variable=compatdir bash-completion") from which files - are loaded when bash_completion is loaded. - -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 <Tab> - - 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: - - $ export PATH=/bin:/sbin:/usr<Tab> - - 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: - - $ man File::B<Tab> - - Here, the colons make bash think that it's completing the 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 modern Red Hat and Mandrake - Linux systems. - - If you don't have such a cron job, make one: - - #!/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. 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/ - - -CONTRIBUTING ------------- - -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, - - bar=$( echo $foo | sed -e 's/bar/baz/g' ) - - can be replaced by: - - 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. - -- Send small, incremental diffs that do one thing. Don't cram unrelated - changes into a single diff. - -- Generate patches preferably against the git repository, with "git - format-patch origin/master" (assuming the diff was against the - origin/master branch), and send them preferably with "git - send-email". If you don't have git available or can't access the - repository for some reason, generate patches as unified diffs - ('diff -u'). - -- 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://www.opengroup.org/onlinepubs/9699919799/ - -- 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. - -- File bugs, enhancement requests (preferably with patches attached) at - the project tracker at https://alioth.debian.org/projects/bash-completion/ - Sending them to the developers list usually works too, but bits are more - likely to fall through the cracks that way compared to the tracker. - -- 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. - --- -bash-completion developers -bash-completion-devel@lists.alioth.debian.org diff --git a/README.md b/README.md new file mode 100644 index 00000000..71e9aad2 --- /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 <kbd><Tab></kbd>, 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 <Tab> + ``` + + **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 <kbd><Tab></kbd> 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<Tab> + ``` + + 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<Tab> + ``` + + 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 deleted file mode 100644 index 279699f2..00000000 --- a/aclocal.m4 +++ /dev/null @@ -1,617 +0,0 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_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, 2003, 2005, 2006, 2007, 2008, 2011 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. - -# serial 1 - -# 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.11' -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.11.6], [], - [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.11.6])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, 2003, 2005, 2011 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. - -# serial 1 - -# 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], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 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. - -# serial 16 - -# 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. - -# 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.62])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], -[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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [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([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. 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)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl 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 -]) - -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, 2003, 2005, 2008, 2011 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. - -# serial 1 - -# 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}" != 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, 2005 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. - -# serial 2 - -# 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, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# 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. - -# serial 6 - -# 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 supports --run. -# If it does, 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 --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006, 2011 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. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 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. - -# serial 5 - -# _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, 1997, 2000, 2001, 2003, 2005, 2008 -# 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. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# 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 ( - 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 - rm -f conftest.file - 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 - - 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)]) - -# Copyright (C) 2001, 2003, 2005, 2011 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. - -# serial 1 - -# 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, 2008, 2010 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. - -# serial 3 - -# _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, 2005, 2012 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. - -# serial 2 - -# _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}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -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 <conftest.tar]) - grep GrepMe conftest.dir/file >/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 00000000..265e0756 --- /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 00000000..ccc6e052 --- /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 index c73cd39e..bde217db 100644 --- a/bash-completion.pc.in +++ b/bash-completion.pc.in @@ -5,5 +5,5 @@ helpersdir=@datarootdir@/@PACKAGE@/helpers Name: bash-completion Description: programmable completion for the bash shell -URL: http://bash-completion.alioth.debian.org/ +URL: https://github.com/scop/bash-completion Version: @VERSION@ diff --git a/bash_completion b/bash_completion index 6d3ba762..d16b10a5 100644 --- a/bash_completion +++ b/bash_completion @@ -3,8 +3,7 @@ # bash_completion - programmable completion functions for bash 4.1+ # # Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> -# © 2009-2013, Bash Completion Maintainers -# <bash-completion-devel@lists.alioth.debian.org> +# © 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 @@ -22,9 +21,9 @@ # # The latest version of this software can be obtained here: # -# http://bash-completion.alioth.debian.org/ -# -# RELEASE: 2.1 +# https://github.com/scop/bash-completion + +BASH_COMPLETION_VERSINFO=(2 7) if [[ $- == *v* ]]; then BASH_COMPLETION_ORIGINAL_V_VALUE="-v" @@ -38,11 +37,6 @@ else set +v fi -# Set the following to the location of the backwards compat completion dir. -# -: ${BASH_COMPLETION_COMPAT_DIR:=/etc/bash_completion.d} -readonly BASH_COMPLETION_COMPAT_DIR - # Blacklisted completions, causing problems with our code. # _blacklist_glob='@(acroread.sh)' @@ -53,13 +47,10 @@ 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 -# Make directory commands see only directories -complete -d pushd - # start of section containing compspecs that can be handled within bash # user commands see only users -complete -u write chfn groups slay w sux runuser +complete -u groups slay w sux # bg completes with stopped jobs complete -A stopped -P '"%' -S '"' bg @@ -82,9 +73,6 @@ complete -A helptopic help # unalias completes with aliases complete -a unalias -# bind completes with readline bindings (make this more intelligent) -complete -A binding bind - # type and which complete on commands complete -c command type which @@ -136,7 +124,7 @@ have() # _rl_enabled() { - [[ "$( bind -v )" = *$1+([[:space:]])on* ]] + [[ "$( bind -v )" == *$1+([[:space:]])on* ]] } # This function shell-quotes the argument @@ -246,7 +234,7 @@ __reassemble_comp_words_by_ref() fi # Default to cword unchanged - eval $3=$COMP_CWORD + printf -v "$3" %s "$COMP_CWORD" # Are characters excluded which were former included? if [[ $exclude ]]; then # Yes, list of word completion separators has shrunk; @@ -261,33 +249,35 @@ __reassemble_comp_words_by_ref() # 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 != [$' \t']* ]] && (( j >= 2 )) && ((j--)) + [[ $line != [[:blank:]]* ]] && (( j >= 2 )) && ((j--)) # Append word separator to current or new word ref="$2[$j]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} + printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}" # Indicate new cword - [[ $i == $COMP_CWORD ]] && eval $3=$j + [[ $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 == [$' \t']* ]] && ((j++)) + [[ $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]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} + 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 ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" done - [[ $i == $COMP_CWORD ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" else # No, list of word completions separators hasn't changed; - eval $2=\( \"\${COMP_WORDS[@]}\" \) + for i in ${!COMP_WORDS[@]}; do + printf -v "$2[i]" %s "${COMP_WORDS[i]}" + done fi } # __reassemble_comp_words_by_ref() @@ -318,8 +308,8 @@ __get_cword_at_cursor_by_ref() ]]; do # Strip first character cur="${cur:1}" - # Decrease cursor position - ((index--)) + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) done # Does found word match cword? @@ -448,8 +438,8 @@ _get_cword() ]]; do # Strip first character cur="${cur:1}" - # Decrease cursor position - ((index--)) + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) done # Does found word matches cword? @@ -558,37 +548,37 @@ _quote_readline_by_ref() # _filedir() { - local i IFS=$'\n' xspec + local IFS=$'\n' - _tilde "$cur" || return 0 + _tilde "$cur" || return local -a toks - local quoted x tmp + local x tmp - _quote_readline_by_ref "$cur" quoted - x=$( compgen -d -- "$quoted" ) && + 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 - xspec=${1:+"!*.@($1|${1^^})"} + local xspec=${1:+"!*.@($1|${1^^})"} x=$( compgen -f -X "$xspec" -- $quoted ) && while read -r tmp; do toks+=( "$tmp" ) done <<< "$x" - fi - - # If the filter failed to produce anything, try without it if configured to - [[ -n ${COMP_FILEDIR_FALLBACK:-} && \ - -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \ - x=$( compgen -f -- $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 @@ -622,11 +612,59 @@ _split_longopt() # False (> 0) if not. _variables() { - if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then - [[ $cur == *{* ]] && local suffix=} || local suffix= - COMPREPLY+=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \ - "${BASH_REMATCH[2]}" ) ) + 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 } @@ -707,7 +745,7 @@ _init_completion() fi done - [[ $cword -eq 0 ]] && return 1 + [[ $cword -le 0 ]] && return 1 prev=${words[cword-1]} [[ ${split-} ]] && _split_longopt && split=true @@ -722,15 +760,17 @@ __parse_options() # Take first found long option, or first one (short) if not found. option= - for i in $1; do - case $i in + 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 0 + [[ $option ]] || return IFS=$' \t\n' # affects parsing of the regexps below... @@ -760,7 +800,7 @@ _parse_help() esac } \ | while read -r line; do - [[ $line == *([ $'\t'])-* ]] || continue + [[ $line == *([[:blank:]])-* ]] || continue # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc while [[ $line =~ \ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do @@ -825,7 +865,8 @@ _mac_addresses() # - ifconfig on Linux: HWaddr or ether # - ifconfig on FreeBSD: ether # - ip link: link/ether - COMPREPLY+=( $( { ifconfig -a || ip link show; } 2>/dev/null | sed -ne \ + 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 \ @@ -833,12 +874,12 @@ _mac_addresses() ) ) # ARP cache - COMPREPLY+=( $( { arp -an || ip neigh show; } 2>/dev/null | sed -ne \ + 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+=( $( sed -ne \ + COMPREPLY+=( $( command sed -ne \ "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) @@ -851,23 +892,24 @@ _configured_interfaces() { if [[ -f /etc/debian_version ]]; then # Debian system - COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ - /etc/network/interfaces )" -- "$cur" ) ) + 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-* | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + 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 | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) else # Assume Red Hat COMPREPLY=( $( compgen -W "$( printf '%s\n' \ /etc/sysconfig/network-scripts/ifcfg-* | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) fi } @@ -877,9 +919,9 @@ _ip_addresses() { local PATH=$PATH:/sbin COMPREPLY+=( $( compgen -W \ - "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | - sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \ - -ne 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ + "$( { 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" ) ) } @@ -929,7 +971,7 @@ _tilde() local result=0 if [[ $1 == \~* && $1 != */* ]]; then # Try generate ~username completions - COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) ) + 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 @@ -996,7 +1038,7 @@ _expand() eval cur=$cur 2>/dev/null elif [[ "$cur" == \~* ]]; then cur=${cur#\~} - COMPREPLY=( $( compgen -P '~' -u "$cur" ) ) + COMPREPLY=( $( compgen -P '~' -u -- "$cur" ) ) [[ ${#COMPREPLY[@]} -eq 1 ]] && eval COMPREPLY[0]=${COMPREPLY[0]} return ${#COMPREPLY[@]} fi @@ -1007,7 +1049,7 @@ _expand() [[ $OSTYPE == *@(solaris|aix)* ]] && _pids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" )) + COMPREPLY=( $( compgen -W '$( command ps -efo pid | command sed 1d )' -- "$cur" )) } || _pids() { @@ -1019,7 +1061,7 @@ _pids() [[ $OSTYPE == *@(solaris|aix)* ]] && _pgids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" )) + COMPREPLY=( $( compgen -W '$( command ps -efo pgid | command sed 1d )' -- "$cur" )) } || _pgids() { @@ -1028,25 +1070,32 @@ _pgids() # 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 '<defunct>' -W '$( command ps -efo comm | \ - sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) + command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) } || _pnames() { - # 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. - # Not using "ps axo comm" because under some Linux kernels, it - # truncates command names (see e.g. http://bugs.debian.org/497540#19) - COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps axo command= | \ - sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \ - -e "s/[])]$//" | sort -u )' -- "$cur" ) ) + if [[ "$1" == -s ]]; then + COMPREPLY=( $( compgen -X '<defunct>' \ + -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 '<defunct>' -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 @@ -1103,12 +1152,17 @@ _services() _sysvdirs local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob - COMPREPLY=( $( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions) ) ) + 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" ) ) } @@ -1122,7 +1176,7 @@ _service() _init_completion || return # don't complete past 2nd token - [[ $cword -gt 2 ]] && return 0 + [[ $cword -gt 2 ]] && return if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then _services @@ -1130,7 +1184,7 @@ _service() else local sysvdirs _sysvdirs - COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ + 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 @@ -1151,7 +1205,7 @@ _modules() local modpath modpath=/lib/modules/$1 COMPREPLY=( $( compgen -W "$( command ls -RL $modpath 2>/dev/null | \ - sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) + command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) } # This function completes on installed modules @@ -1171,10 +1225,10 @@ _installed_modules() # context of current completion. _usergroup() { - if [[ $cur = *\\\\* || $cur = *:*:* ]]; then + if [[ $cur == *\\\\* || $cur == *:*:* ]]; then # Give up early on if something seems horribly wrong. return - elif [[ $cur = *\\:* ]]; then + elif [[ $cur == *\\:* ]]; then # Completing group after 'user\:gr<TAB>'. # Reply with a list of groups prefixed with 'user:', readline will # escape to the colon. @@ -1189,7 +1243,7 @@ _usergroup() COMPREPLY=( $( compgen -g -- "$mycur" ) ) fi COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) ) - elif [[ $cur = *:* ]]; then + elif [[ $cur == *:* ]]; then # Completing group after 'user:gr<TAB>'. # Reply with a list of unprefixed groups since readline with split on : # and only replace the 'gr' part @@ -1258,14 +1312,14 @@ _fstypes() if [[ -e /proc/filesystems ]]; then # Linux fss="$( cut -d$'\t' -f2 /proc/filesystems ) - $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )" + $( 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 )" + $( 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" ) ) @@ -1354,7 +1408,7 @@ _dvd_devices() _terms() { COMPREPLY+=( $( compgen -W \ - "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ + "$( 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" ) ) @@ -1375,12 +1429,11 @@ _user_at_host() if [[ $cur == *@* ]]; then _known_hosts_real "$cur" else - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $( compgen -u -S @ -- "$cur" ) ) + compopt -o nospace fi - - return 0 } -shopt -u hostcomplete && complete -F _user_at_host -o nospace talk ytalk finger +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. @@ -1397,6 +1450,39 @@ _known_hosts() _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 @@ -1441,6 +1527,11 @@ _known_hosts_real() 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 @@ -1533,7 +1624,7 @@ _known_hosts_real() # append any available aliases from config files if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then - local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ) + 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 @@ -1548,7 +1639,7 @@ _known_hosts_real() # 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" ) ) + awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) fi # Add hosts reported by ruptime. @@ -1565,7 +1656,6 @@ _known_hosts_real() __ltrim_colon_completions "$prefix$user$cur" - return 0 } # _known_hosts_real() complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \ fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount @@ -1586,7 +1676,7 @@ _cd() # ./ or ../ if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then _filedir -d - return 0 + return fi local -r mark_dirs=$(_rl_enabled mark-directories && echo y) @@ -1596,7 +1686,7 @@ _cd() for i in ${CDPATH//:/$'\n'}; do # create an array of matched subdirs k="${#COMPREPLY[@]}" - for j in $( compgen -d $i/$cur ); do + for j in $( compgen -d -- $i/$cur ); do if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then j+="/" fi @@ -1613,12 +1703,12 @@ _cd() fi fi - return 0 + return } if shopt -q cdable_vars; then - complete -v -F _cd -o nospace cd + complete -v -F _cd -o nospace cd pushd else - complete -F _cd -o nospace cd + complete -F _cd -o nospace cd pushd fi # a wrapper method for the next one, when the offset is unknown @@ -1664,7 +1754,7 @@ _command_offset() COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]} done for (( i; i <= COMP_CWORD; i++ )); do - unset COMP_WORDS[i] + unset 'COMP_WORDS[i]' done ((COMP_CWORD -= $word_offset)) @@ -1751,49 +1841,49 @@ _longopt() case "${prev,,}" in --help|--usage|--version) - return 0 + return ;; --*dir*) _filedir -d - return 0 + return ;; --*file*|--*path*) _filedir - return 0 + return ;; --+([-a-z0-9_])) - local argtype=$( $1 --help 2>&1 | sed -ne \ + 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 0 + return ;; *file*|*path*) _filedir - return 0 + return ;; esac ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ - sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ + 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 ]]; then + 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 colordiff cp csplit \ - cut date df diff dir du enscript env expand fmt fold gperf \ - grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \ +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 @@ -1804,7 +1894,7 @@ _filedir_xspec() local cur prev words cword _init_completion || return - _tilde "$cur" || return 0 + _tilde "$cur" || return local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp local -a toks @@ -1828,7 +1918,7 @@ _filedir_xspec() xspec="$matchop($xspec|${xspec^^})" toks+=( $( - eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { + eval compgen -f -X "'!$xspec'" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [[ -n $tmp ]] && printf '%s\n' $tmp done @@ -1852,10 +1942,11 @@ _install_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|do[ct][xm]|p[op]t[mx]|xl[st][xm])' unzip zipinfo +_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 unpigz +_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 @@ -1863,21 +1954,21 @@ _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|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)' xv +_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 +_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 +_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|wma|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|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|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|wma|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|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|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 '!*@(.@(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 @@ -1886,12 +1977,13 @@ _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]|okta|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123 -_install_xspec '*.@(o|so|so.!(conf|*/*)|a|[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 '!*.@(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 firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany -_install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm)' oowriter +_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 @@ -1906,7 +1998,6 @@ _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 -_install_xspec '!*.py' pyflakes unset -f _install_xspec # Minimal completion to use as fallback in _completion_loader. @@ -1917,23 +2008,47 @@ _minimal() $split && return _filedir } -# Complete the empty string to allow completion of '>', '>>', and '<' +# 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() { - local compfile=./completions - [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions" - compfile+="/${1##*/}" + # $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier + local cmd="${1:-_EmptycmD_}" - # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 - [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124 + __load_completion "$cmd" && return 124 # Need to define *something*, otherwise there will be no completion at all. - complete -F _minimal "$1" && return 124 + complete -F _minimal -- "$cmd" && return 124 } && complete -D -F _completion_loader @@ -1947,31 +2062,31 @@ _xfunc() local srcfile=$1 shift declare -F $1 &>/dev/null || { - local compdir=./completions - [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions" - . "$compdir/$srcfile" + __load_completion "$srcfile" } "$@" } # source compat completion directory definitions -if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ - -x $BASH_COMPLETION_COMPAT_DIR ]]; then - for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do - i=$BASH_COMPLETION_COMPAT_DIR/$i +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 i _blacklist_glob +unset compat_dir i _blacklist_glob # source user completion file -[[ ${BASH_SOURCE[0]} != ~/.bash_completion && -r ~/.bash_completion ]] \ - && . ~/.bash_completion +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: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/bash_completion.sh.in b/bash_completion.sh.in index 2fb74625..4e410d4a 100644 --- a/bash_completion.sh.in +++ b/bash_completion.sh.in @@ -1,14 +1,15 @@ # Check for interactive bash and that we haven't already been sourced. -[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return +if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then -# Check for recent enough version of bash. -bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} -if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -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 + # 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 -unset bash bmajor bminor diff --git a/completions/.gitignore b/completions/.gitignore new file mode 100644 index 00000000..60a2d949 --- /dev/null +++ b/completions/.gitignore @@ -0,0 +1,205 @@ +7za +aclocal-1.1[012345] +alpine +alternatives +animate +apropos +arm-koji +asciidoc.py +autoheader +automake-1.1[012345] +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-[23] +pydoc3 +python2 +python3 +pypy +pypy3 +pyvenv-3.[45] +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 diff --git a/completions/2to3 b/completions/2to3 new file mode 100644 index 00000000..4dd29bf4 --- /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 00000000..5599b708 --- /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 index f312b3a9..f04d7c36 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -1,12 +1,16 @@ bashcompdir = $(pkgdatadir)/completions -bashcomp_DATA = a2x \ +bashcomp_DATA = 2to3 \ + 7z \ + a2x \ abook \ aclocal \ acpi \ + adb \ add_members \ alias \ ant \ apache2ctl \ + appdata-validate \ apt-build \ apt-cache \ apt-get \ @@ -23,11 +27,13 @@ bashcomp_DATA = a2x \ autoscan \ avctrl \ badblocks \ + bind \ bk \ brctl \ btdownloadheadless.py \ + bts \ bzip2 \ - cal \ + _cal \ cancel \ cardctl \ ccache \ @@ -37,13 +43,15 @@ bashcomp_DATA = a2x \ change_pw \ check_db \ check_perms \ + checksec \ + _chfn \ chgrp \ chkconfig \ chown \ chpasswd \ chronyc \ chrpath \ - chsh \ + _chsh \ cksfv \ cleanarch \ clisp \ @@ -62,10 +70,11 @@ bashcomp_DATA = a2x \ cvs \ cvsps \ dd \ + deja-dup \ desktop-file-validate \ dhclient \ dict \ - dmesg \ + _dmesg \ dnsspoof \ dot \ dpkg \ @@ -76,7 +85,7 @@ bashcomp_DATA = a2x \ dumpe2fs \ e2freefrag \ e2label \ - eject \ + _eject \ eog \ ether-wake \ evince \ @@ -92,6 +101,8 @@ bashcomp_DATA = a2x \ filesnarf \ find \ find_member \ + flake8 \ + freebsd-update \ freeciv-gtk2 \ freeciv-server \ function \ @@ -104,7 +115,9 @@ bashcomp_DATA = a2x \ genisoimage \ getent \ gkrellm \ + gm \ gnatmake \ + gnokii \ gnome-mplayer \ gpasswd \ gpg \ @@ -120,12 +133,13 @@ bashcomp_DATA = a2x \ gzip \ hcitool \ hddtemp \ - hexdump \ + _hexdump \ hid2hci \ + hostname \ hping2 \ htop \ htpasswd \ - hwclock \ + _hwclock \ iconv \ id \ idn \ @@ -137,7 +151,7 @@ bashcomp_DATA = a2x \ installpkg \ interdiff \ invoke-rc.d \ - ionice \ + _ionice \ ip \ iperf \ ipmitool \ @@ -154,7 +168,9 @@ bashcomp_DATA = a2x \ jarsigner \ java \ javaws \ + jpegoptim \ jps \ + jshint \ k3b \ kcov \ kill \ @@ -177,7 +193,7 @@ bashcomp_DATA = a2x \ list_lists \ list_members \ list_owners \ - look \ + _look \ lpq \ lpr \ lrzip \ @@ -187,6 +203,7 @@ bashcomp_DATA = a2x \ luseradd \ luserdel \ lvm \ + lz4 \ lzip \ lzma \ lzop \ @@ -206,12 +223,15 @@ bashcomp_DATA = a2x \ mkinitrd \ mktemp \ mmsitepass \ + _mock \ modinfo \ modprobe \ + _modules \ monodevelop \ mount \ mount.linux \ mplayer \ + mr \ msynctool \ mtx \ munindoc \ @@ -225,20 +245,22 @@ bashcomp_DATA = a2x \ nc \ ncftp \ nethogs \ - newgrp \ + _newgrp \ newlist \ newusers \ ngrep \ nmap \ - nmcli \ + _nmcli \ nslookup \ ntpdate \ openssl \ opera \ + optipng \ p4 \ pack200 \ passwd \ patch \ + pdftotext \ perl \ pgrep \ pidof \ @@ -255,7 +277,9 @@ bashcomp_DATA = a2x \ pm-hibernate \ pm-is-supported \ pm-powersave \ + pngfix \ portinstall \ + portsnap \ portupgrade \ postcat \ postconf \ @@ -271,9 +295,12 @@ bashcomp_DATA = a2x \ pwd \ pwdx \ pwgen \ + py.test \ pydoc \ + pyflakes \ pylint \ python \ + pyvenv \ qdbus \ qemu \ qrunner \ @@ -283,9 +310,10 @@ bashcomp_DATA = a2x \ rdesktop \ remove_members \ removepkg \ - renice \ + _renice \ + _repomanage \ reportbug \ - reptyr \ + _reptyr \ resolvconf \ rfkill \ ri \ @@ -298,7 +326,8 @@ bashcomp_DATA = a2x \ rpmcheck \ rrdtool \ rsync \ - rtcwake \ + _rtcwake \ + _runuser \ sbcl \ sbopkg \ screen \ @@ -315,25 +344,33 @@ bashcomp_DATA = a2x \ ssh \ ssh-add \ ssh-copy-id \ + ssh-keygen \ sshfs \ sshmitm \ sshow \ strace \ strings \ - su \ + _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 \ @@ -359,6 +396,7 @@ bashcomp_DATA = a2x \ withlist \ wodim \ wol \ + _write \ wsimport \ wtf \ wvdial \ @@ -377,13 +415,21 @@ bashcomp_DATA = a2x \ xz \ xzdec \ ypmatch \ - yum-arch + _yum \ + yum-arch \ + zopfli \ + zopflipng -EXTRA_DIST = $(bashcomp_DATA) \ - _mock _modules _subversion _udevadm _yum _yum-utils +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 \ @@ -391,9 +437,15 @@ CLEANFILES = \ 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++ \ @@ -412,6 +464,7 @@ CLEANFILES = \ conjure \ cowthink \ createdb \ + createuser \ dcop \ declare \ dfutool \ @@ -420,14 +473,19 @@ CLEANFILES = \ dpkg-query \ dpkg-reconfigure \ dropdb \ + dropuser \ edquota \ + f77 \ + f95 \ filebucket \ freeciv-sdl \ freeciv-xaw \ g++ \ g4 \ g77 \ + g95 \ gcj \ + gfortran \ gkrellm2 \ gmake \ gmplayer \ @@ -469,9 +527,11 @@ CLEANFILES = \ lvresize \ lvs \ lvscan \ + lz4c \ mailsnarf \ mdecrypt \ mencoder \ + micropython \ mkisofs \ mogrify \ montage \ @@ -510,9 +570,18 @@ CLEANFILES = \ 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 \ @@ -532,6 +601,7 @@ CLEANFILES = \ sdptool \ setquota \ sftp \ + sidedoor \ slogin \ smbcacls \ smbcquotas \ @@ -541,6 +611,7 @@ CLEANFILES = \ smbtree \ sparc-koji \ spovray \ + star \ stream \ sudoedit \ tightvncviewer \ @@ -571,7 +642,12 @@ CLEANFILES = \ ypcat symlinks: $(targetdir) $(DATA) - for file in aclocal-1.11 ; do \ + 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 @@ -583,7 +659,8 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) asciidoc $(targetdir)/$$file ; \ done - for file in automake-1.11 ; do \ + 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 @@ -605,7 +682,7 @@ symlinks: $(targetdir) $(DATA) done for file in ncal ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) cal $(targetdir)/$$file ; \ + $(LN_S) _cal $(targetdir)/$$file ; \ done for file in pccardctl ; do \ rm -f $(targetdir)/$$file && \ @@ -648,7 +725,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) function $(targetdir)/$$file ; \ done - for file in g++ c++ g77 gcj gpc cc ; do \ + for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) gcc $(targetdir)/$$file ; \ done @@ -671,7 +748,7 @@ symlinks: $(targetdir) $(DATA) done for file in hd ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) hexdump $(targetdir)/$$file ; \ + $(LN_S) _hexdump $(targetdir)/$$file ; \ done for file in hping hping3 ; do \ rm -f $(targetdir)/$$file && \ @@ -719,6 +796,10 @@ symlinks: $(targetdir) $(DATA) 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 ; \ @@ -775,7 +856,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) pm-hibernate $(targetdir)/$$file ; \ done - for file in createdb dropdb ; do \ + for file in createdb createuser dropdb dropuser ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) psql $(targetdir)/$$file ; \ done @@ -792,18 +873,30 @@ symlinks: $(targetdir) $(DATA) 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 python2 python3 ; do \ + 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 ; \ @@ -828,7 +921,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) sbcl $(targetdir)/$$file ; \ done - for file in slogin autossh sftp scp ; do \ + for file in slogin autossh sftp scp sidedoor ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) ssh $(targetdir)/$$file ; \ done @@ -871,3 +964,11 @@ 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 deleted file mode 100644 index fef6ebc6..00000000 --- a/completions/Makefile.in +++ /dev/null @@ -1,1258 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -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) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -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 = a2x \ - abook \ - aclocal \ - acpi \ - add_members \ - alias \ - ant \ - apache2ctl \ - apt-build \ - apt-cache \ - apt-get \ - aptitude \ - arch \ - arping \ - arpspoof \ - asciidoc \ - aspell \ - autoconf \ - automake \ - autoreconf \ - autorpm \ - autoscan \ - avctrl \ - badblocks \ - bk \ - brctl \ - btdownloadheadless.py \ - bzip2 \ - cal \ - cancel \ - cardctl \ - ccache \ - cfagent \ - cfrun \ - chage \ - change_pw \ - check_db \ - check_perms \ - 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 \ - 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 \ - freeciv-gtk2 \ - freeciv-server \ - function \ - fusermount \ - gcc \ - gcl \ - gdb \ - genaliases \ - gendiff \ - genisoimage \ - getent \ - gkrellm \ - gnatmake \ - gnome-mplayer \ - gpasswd \ - gpg \ - gpg2 \ - gphoto2 \ - gprof \ - groupadd \ - groupdel \ - groupmems \ - groupmod \ - growisofs \ - grpck \ - gzip \ - hcitool \ - hddtemp \ - hexdump \ - hid2hci \ - 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 \ - jps \ - 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 \ - lzip \ - lzma \ - lzop \ - macof \ - mailmanctl \ - make \ - makepkg \ - man \ - mc \ - mcrypt \ - mdadm \ - mdtool \ - medusa \ - mii-diag \ - mii-tool \ - minicom \ - mkinitrd \ - mktemp \ - mmsitepass \ - modinfo \ - modprobe \ - monodevelop \ - mount \ - mount.linux \ - mplayer \ - 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 \ - p4 \ - pack200 \ - passwd \ - patch \ - perl \ - pgrep \ - pidof \ - pine \ - ping \ - pkg-config \ - pkg-get \ - pkg_delete \ - pkgadd \ - pkgrm \ - pkgtool \ - pkgutil \ - plague-client \ - pm-hibernate \ - pm-is-supported \ - pm-powersave \ - portinstall \ - portupgrade \ - postcat \ - postconf \ - postfix \ - postmap \ - postsuper \ - povray \ - prelink \ - protoc \ - psql \ - puppet \ - pwck \ - pwd \ - pwdx \ - pwgen \ - pydoc \ - pylint \ - python \ - qdbus \ - qemu \ - qrunner \ - querybts \ - quota \ - rcs \ - rdesktop \ - remove_members \ - removepkg \ - renice \ - reportbug \ - reptyr \ - resolvconf \ - rfkill \ - ri \ - rmlist \ - rmmod \ - route \ - rpcdebug \ - rpm \ - rpm2tgz \ - rpmcheck \ - rrdtool \ - rsync \ - rtcwake \ - sbcl \ - sbopkg \ - screen \ - sh \ - sitecopy \ - slackpkg \ - slapt-get \ - slapt-src \ - smartctl \ - smbclient \ - snownews \ - sqlite3 \ - ss \ - ssh \ - ssh-add \ - ssh-copy-id \ - sshfs \ - sshmitm \ - sshow \ - strace \ - strings \ - su \ - sudo \ - svcadm \ - svk \ - sync_members \ - sysbench \ - sysctl \ - tar \ - tcpdump \ - tcpkill \ - tcpnice \ - tracepath \ - tshark \ - tune2fs \ - 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 \ - wsimport \ - wtf \ - wvdial \ - xfreerdp \ - xgamma \ - xhost \ - xm \ - xmllint \ - xmlwf \ - xmms \ - xmodmap \ - xrandr \ - xrdb \ - xsltproc \ - xxd \ - xz \ - xzdec \ - ypmatch \ - yum-arch - -EXTRA_DIST = $(bashcomp_DATA) \ - _mock _modules _subversion _udevadm _yum _yum-utils - -CLEANFILES = \ - aclocal-1.11 \ - alpine \ - alternatives \ - animate \ - apropos \ - arm-koji \ - asciidoc.py \ - autoheader \ - automake-1.11 \ - autossh \ - autoupdate \ - btdownloadcurses.py \ - btdownloadgui.py \ - c++ \ - cc \ - cdrecord \ - ci \ - ciptool \ - civclient \ - civserver \ - clzip \ - co \ - colormake \ - compare \ - compgen \ - composite \ - conjure \ - cowthink \ - createdb \ - dcop \ - declare \ - dfutool \ - display \ - dpkg-deb \ - dpkg-query \ - dpkg-reconfigure \ - dropdb \ - edquota \ - filebucket \ - freeciv-sdl \ - freeciv-xaw \ - g++ \ - g4 \ - g77 \ - gcj \ - 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 \ - mailsnarf \ - mdecrypt \ - mencoder \ - 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 \ - pydoc3 \ - python2 \ - python3 \ - quotacheck \ - quotaoff \ - quotaon \ - ralsh \ - rcsdiff \ - rdict \ - repquota \ - rfcomm \ - rlog \ - rpm2targz \ - rpm2txz \ - rpmbuild \ - rpmbuild-md5 \ - s390-koji \ - sbcl-mt \ - scp \ - sdptool \ - setquota \ - sftp \ - slogin \ - smbcacls \ - smbcquotas \ - smbget \ - smbpasswd \ - smbtar \ - smbtree \ - sparc-koji \ - spovray \ - 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 -.PRECIOUS: 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 -TAGS: - -ctags: CTAGS -CTAGS: - - -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 -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: install-am install-strip - -.PHONY: all all-am all-local check check-am clean clean-generic \ - 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 uninstall uninstall-am \ - uninstall-bashcompDATA - - -symlinks: $(targetdir) $(DATA) - for file in aclocal-1.11 ; 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.11 ; 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 g++ c++ g77 gcj gpc cc ; 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 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 dropdb ; 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 pydoc3 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pydoc $(targetdir)/$$file ; \ - done - for file in python2 python3 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) python $(targetdir)/$$file ; \ - done - for file in dcop ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) qdbus $(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 ; 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 - -# 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 index 880b0b35..dfe49903 100644 --- a/completions/cal +++ b/completions/_cal @@ -1,5 +1,8 @@ # 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 @@ -31,4 +34,4 @@ _cal() } && complete -F _cal cal ncal -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_chfn b/completions/_chfn new file mode 100644 index 00000000..334967fa --- /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 index f65291a1..88e8522e 100644 --- a/completions/chsh +++ b/completions/_chsh @@ -1,5 +1,8 @@ # 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 @@ -7,11 +10,11 @@ _chsh() case $prev in --list-shells|--help|-v|--version) - return 0 + return ;; -s|--shell) _shells - return 0 + return ;; esac @@ -21,8 +24,7 @@ _chsh() _allowed_users fi - return 0 } && complete -F _chsh chsh -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dmesg b/completions/_dmesg index 3d9bc662..2ca7fdf1 100644 --- a/completions/dmesg +++ b/completions/_dmesg @@ -1,5 +1,8 @@ # 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 @@ -28,4 +31,4 @@ _dmesg() } && complete -F _dmesg dmesg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/eject b/completions/_eject index d6b1f6d9..8f800f15 100644 --- a/completions/eject +++ b/completions/_eject @@ -1,5 +1,8 @@ # 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 @@ -27,4 +30,4 @@ _eject() } && complete -F _eject eject -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hexdump b/completions/_hexdump index c566f9d6..ed5cb08b 100644 --- a/completions/hexdump +++ b/completions/_hexdump @@ -1,5 +1,8 @@ # 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 @@ -26,4 +29,4 @@ _hexdump() } && complete -F _hexdump hexdump hd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hwclock b/completions/_hwclock index 9f8f9b15..2d190283 100644 --- a/completions/hwclock +++ b/completions/_hwclock @@ -1,5 +1,8 @@ # 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 @@ -20,4 +23,4 @@ _hwclock() } && complete -F _hwclock hwclock -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ionice b/completions/_ionice index 6d9bdd46..9b378ee8 100644 --- a/completions/ionice +++ b/completions/_ionice @@ -1,5 +1,8 @@ # 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 @@ -54,4 +57,4 @@ _ionice() } && complete -F _ionice ionice -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/look b/completions/_look index df914452..6ea41cce 100644 --- a/completions/look +++ b/completions/_look @@ -1,5 +1,8 @@ # 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 @@ -11,4 +14,4 @@ _look() } && complete -F _look -o default look -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_mock b/completions/_mock index c616aed0..9649d306 100644 --- a/completions/_mock +++ b/completions/_mock @@ -24,20 +24,20 @@ _mock() case $prev in -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\ --uniqueext|--rpmbuild_timeout|--sources|--cwd) - return 0 + return ;; -r|--root) COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- "$cur" ) ) COMPREPLY=( ${COMPREPLY[@]/%.cfg/} ) - return 0 + return ;; --configdir|--resultdir) _filedir -d - return 0 + return ;; --spec) _filedir spec - return 0 + return ;; --target) # Yep, compatible archs, not compatible build archs @@ -45,17 +45,17 @@ _mock() # This would actually depend on what the target root # can be used to build for... COMPREPLY=( $( compgen -W "$( command rpm --showrc | \ - sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ + command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ -- "$cur" ) ) - return 0 + return ;; --enable-plugin|--disable-plugin) COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -66,4 +66,4 @@ _mock() } && complete -F _mock mock -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_modules b/completions/_modules index b5a1d94a..9e48589b 100644 --- a/completions/_modules +++ b/completions/_modules @@ -23,13 +23,13 @@ _module_list () { - local modules="$( sed 's/:/ /g' <<<$LOADEDMODULES | sort )" + local modules="$( command sed 's/:/ /g' <<<$LOADEDMODULES | sort )" compgen -W "$modules" -- $1 } _module_path () { - local modules="$( sed 's/:/ /g' <<<$MODULEPATH | sort )" + local modules="$( command sed 's/:/ /g' <<<$MODULEPATH | sort )" compgen -W "$modules" -- $1 } @@ -38,7 +38,7 @@ _module_avail () local modules="$( \ module avail 2>&1 | \ command grep -E -v '^(-|$)' | \ - xargs printf '%s\n' | sed -e 's/(default)//g' | sort )" + xargs printf '%s\n' | command sed -e 's/(default)//g' | sort )" compgen -W "$modules" -- $1 } @@ -54,7 +54,7 @@ _module () local options options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \ - awk '{print $2}' | sed -e 's/|/ /g' | sort )" + awk '{print $2}' | command sed -e 's/|/ /g' | sort )" COMPREPLY=( $(compgen -W "$options" -- "$cur") ) @@ -77,8 +77,8 @@ _module () ;; esac fi - return 0 + } && complete -F _module -o default module -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/newgrp b/completions/_newgrp index ddcd79e8..0f0d3f93 100644 --- a/completions/newgrp +++ b/completions/_newgrp @@ -1,5 +1,8 @@ # 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 @@ -13,4 +16,4 @@ _newgrp() } && complete -F _newgrp newgrp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/nmcli b/completions/_nmcli index 00628b41..f77f0505 100644 --- a/completions/nmcli +++ b/completions/_nmcli @@ -1,4 +1,7 @@ -# nmcli completion -*- shell-script -*- +# 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() { @@ -39,35 +42,35 @@ _nmcli() case $prev in -m|--mode) COMPREPLY=( $( compgen -W 'tabular multiline' -- "$cur" ) ) - return 0 + return ;; -f|--fields) COMPREPLY=( $( compgen -W 'all common' -- "$cur" ) ) - return 0 + return ;; -e|--escape) _nmcli_list "yes no" - return 0 + return ;; id) _nmcli_con_id - return 0 + return ;; uuid) _nmcli_con_uuid - return 0 + return ;; iface) _available_interfaces - return 0 + return ;; bssid) _nmcli_ab_bssid - return 0 + return ;; wep-key-type) _nmcli_list "key phrase" - return 0 + return ;; esac @@ -87,23 +90,23 @@ _nmcli() case $command in enable) _nmcli_list "true false" - return 0 + return ;; sleep) _nmcli_list "true false" - return 0 + return ;; wifi) _nmcli_list "on off" - return 0 + return ;; wwan) _nmcli_list "on off" - return 0 + return ;; wimax) _nmcli_list "on off" - return 0 + return ;; esac @@ -114,7 +117,7 @@ _nmcli() case $command in list) COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) - return 0 + return ;; up) if [[ "$cur" == -* ]]; then @@ -124,15 +127,15 @@ _nmcli() COMPREPLY=( $( compgen -W 'id uuid iface ap nsp' \ -- "$cur" ) ) fi - return 0 + return ;; down) COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) - return 0 + return ;; delete) COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) - return 0 + return ;; esac @@ -143,7 +146,7 @@ _nmcli() case $command in list) COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) - return 0 + return ;; disconnect) if [[ "$cur" == -* ]]; then @@ -152,7 +155,7 @@ _nmcli() else COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) fi - return 0 + return ;; wifi) local subcommand=${words[3]} @@ -161,7 +164,7 @@ _nmcli() list) COMPREPLY=( $( compgen -W 'iface bssid' \ -- "$cur" ) ) - return 0 + return ;; connect) if [[ "$cur" == -* ]]; then @@ -176,12 +179,12 @@ _nmcli() -- "$cur" ) ) fi fi - return 0 + return ;; esac COMPREPLY=( $( compgen -W 'list connect' -- "$cur" ) ) - return 0 + return ;; esac @@ -192,8 +195,7 @@ _nmcli() fi - return 0 } && complete -F _nmcli nmcli -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/renice b/completions/_renice index 60968eef..1f1a6102 100644 --- a/completions/renice +++ b/completions/_renice @@ -1,5 +1,8 @@ # 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 @@ -26,4 +29,4 @@ _renice() } && complete -F _renice renice -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_yum-utils b/completions/_repomanage index 22b97af8..c1072e79 100644 --- a/completions/_yum-utils +++ b/completions/_repomanage @@ -8,7 +8,7 @@ _repomanage() local cur prev words cword split _init_completion -s || return - [[ "$prev" == -@(h|-help|k|-keep) ]] && return 0 + [[ "$prev" == -@([hk]|-help|-keep) ]] && return $split && return @@ -21,4 +21,4 @@ _repomanage() } && complete -F _repomanage repomanage -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/reptyr b/completions/_reptyr index 3097daa9..4a087b49 100644 --- a/completions/reptyr +++ b/completions/_reptyr @@ -1,5 +1,8 @@ # 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 @@ -7,17 +10,17 @@ _reptyr() case $prev in -l) - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi [[ $prev != +([0-9]) ]] && _pids } && complete -F _reptyr reptyr -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rtcwake b/completions/_rtcwake index f276c1be..b03c1244 100644 --- a/completions/rtcwake +++ b/completions/_rtcwake @@ -1,5 +1,8 @@ # 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 @@ -7,23 +10,23 @@ _rtcwake() case "$prev" in --help|-h|--version|-V|--seconds|-s|--time|-t) - return 0 + return ;; --mode|-m) COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) ) - return 0 + return ;; --device|-d) COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) } && complete -F _rtcwake rtcwake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_runuser b/completions/_runuser new file mode 100644 index 00000000..95cf930a --- /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 index fccca47b..2b069498 100644 --- a/completions/su +++ b/completions/_su @@ -1,5 +1,8 @@ # 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 @@ -32,6 +35,7 @@ _su() # linux-specific completion fi COMPREPLY=( $( compgen -u -- "$cur" ) ) -} && complete -F _su su +} && +complete -F _su su -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_subversion b/completions/_subversion deleted file mode 100644 index 2f1752c0..00000000 --- a/completions/_subversion +++ /dev/null @@ -1,344 +0,0 @@ -# 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 0 - ;; - -F|--file|--targets) - _filedir - return 0 - ;; - --encoding) - COMPREPLY=( $( compgen -W '$( iconv --list | \ - sed -e "s@//@@;" )' -- "$cur" ) ) - return 0 - ;; - --editor-cmd|--diff-cmd|--diff3-cmd) - words=(words[0] $cur) - cword=1 - _command - return 0 - ;; - 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 - - return 0 -} && -complete -F _svn svn - -_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 0 - ;; - --fs-type) - COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) ) - return 0 - ;; - 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 - - return 0 -} && -complete -F _svnadmin -o default svnadmin - -_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 - - return 0 -} && -complete -F _svnlook -o default svnlook - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/_svn b/completions/_svn new file mode 100644 index 00000000..37b6b2b4 --- /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 00000000..395ae119 --- /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 00000000..a4f34243 --- /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 index 51ec0e5d..80424dca 100644 --- a/completions/_udevadm +++ b/completions/_udevadm @@ -61,7 +61,7 @@ _udevadm() ;; *) COMPREPLY=( $( compgen -W "$( "$1" --help 2>/dev/null | - awk '/^[[:space:]]+/ { print $1 }' )" -- "$cur" ) ) + awk '/^[ \t]/ { print $1 }' )" -- "$cur" ) ) ;; esac return @@ -76,4 +76,4 @@ _udevadm() } && complete -F _udevadm udevadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_write b/completions/_write new file mode 100644 index 00000000..49e56ffe --- /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 index 7b3f76a4..f3a104bd 100644 --- a/completions/_yum +++ b/completions/_yum @@ -9,12 +9,12 @@ _yum_list() # 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 | \ - sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ + 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 | \ - sed -ne 1d -e 's/[[:space:]].*//p' ) ) + command sed -ne 1d -e 's/[[:space:]].*//p' ) ) fi } @@ -24,13 +24,13 @@ _yum_repolist() # http://yum.baseurl.org/ticket/83 # Drop first ("repo id repo name") and last ("repolist: ...") rows yum --noplugins -C repolist $1 2>/dev/null | \ - sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' + 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 \ - | sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u + | command sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u } _yum() @@ -50,25 +50,25 @@ _yum() if [[ "$cur" == @(*/|[.~])* && \ "$special" == @(deplist|install|update|upgrade) ]]; then _filedir rpm - return 0 + return fi case $special in install) _yum_list available - return 0 + return ;; deplist|info) _yum_list all - return 0 + return ;; upgrade|update) _yum_list updates - return 0 + return ;; remove|erase) # _rpm_installed_packages is not arch-qualified _yum_list installed - return 0 + return ;; esac fi @@ -117,11 +117,11 @@ _yum() ;; -R|-x|--exclude) # argument required but no completions available - return 0 + return ;; -h|--help|--version) # no other options useful with these - return 0 + return ;; *) COMPREPLY=( $( compgen -W 'install update check-update upgrade @@ -132,14 +132,13 @@ _yum() ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _yum yum -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/a2x b/completions/a2x index 7c330908..06c7c3a4 100644 --- a/completions/a2x +++ b/completions/a2x @@ -37,4 +37,4 @@ _a2x() } && complete -F _a2x a2x -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/abook b/completions/abook index 07a0f090..4bb0e8e3 100644 --- a/completions/abook +++ b/completions/abook @@ -10,43 +10,40 @@ _abook() { compopt -o nospace COMPREPLY=( "-" ) - return 0 + return } case $cur in -*) - _longopt abook - return 0 + _longopt "$1" + return ;; esac case $prev in --informat) - COMPREPLY=( $( compgen -W "$(abook --formats | \ - sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ + -- "$cur" ) ) ;; --outformat) - COMPREPLY=( $( compgen -W "$(abook --formats | \ - sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ + -- "$cur" ) ) ;; --infile) COMPREPLY=( $( compgen -W stdin -- "$cur" ) ) _filedir - return 0 ;; --outfile) COMPREPLY=( $( compgen -W stdout -- "$cur" ) ) _filedir - return 0 ;; --config|--datafile) _filedir - return 0 ;; esac } && complete -F _abook abook -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aclocal b/completions/aclocal index 2bbc3152..7a3d6467 100644 --- a/completions/aclocal +++ b/completions/aclocal @@ -7,29 +7,29 @@ _aclocal() case "$prev" in --help|--print-ac-dir|--version) - return 0 + return ;; --acdir|-I) _filedir -d - return 0 + return ;; --output) _filedir - return 0 + return ;; --warnings|-W) local cats=( syntax unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && -complete -F _aclocal aclocal aclocal-1.11 +complete -F _aclocal aclocal aclocal-1.1{0..5} -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/acpi b/completions/acpi index 16ae0d6e..b748cbde 100644 --- a/completions/acpi +++ b/completions/acpi @@ -19,4 +19,4 @@ _acpi() } && complete -F _acpi acpi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/adb b/completions/adb new file mode 100644 index 00000000..d069b425 --- /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 index 70b916be..d582d94b 100644 --- a/completions/add_members +++ b/completions/add_members @@ -8,15 +8,15 @@ _add_members() case $prev in -r|-d|--regular-members-file|--digest-members-file) _filedir - return 0 + return ;; -w|-a|--welcome-msg|--admin-notify) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--regular-members-file --digest-members-file @@ -28,4 +28,4 @@ _add_members() } && complete -F _add_members add_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/alias b/completions/alias index 112dea3b..de2a57e8 100644 --- a/completions/alias +++ b/completions/alias @@ -10,11 +10,11 @@ _alias() COMPREPLY=( $( compgen -A alias -- "$cur" ) ) ;; *=) - COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \ + COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | command sed \ -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) ;; esac } && complete -F _alias -o nospace alias -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ant b/completions/ant index dd3606dc..639cde97 100644 --- a/completions/ant +++ b/completions/ant @@ -1,38 +1,66 @@ # 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 =~ \<import[[:space:]].*file=[\"\']([^\"\']+) ]]; then + local imported_buildfile + imported_buildfile="${basedir}/${BASH_REMATCH[1]}" + if [[ -f $imported_buildfile ]]; then + _ant_parse_targets $imported_buildfile + fi + fi + done < $1 +} + _ant() { local cur prev words cword _init_completion || return case $prev in + -h|-help|--h|--help|-projecthelp|-p|-version|-diagnostics) + return + ;; -buildfile|-file|-f) _filedir 'xml' - return 0 + return ;; -logfile|-l) _filedir - return 0 + return ;; -propertyfile) _filedir properties - return 0 + return ;; -nice) COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) ) - return 0 + return ;; -lib) _filedir -d - return 0 + return ;; -logger|-listener|-inputhandler|-main|-find|-s) - return 0 + return ;; esac if [[ $cur == -D* ]]; then - return 0 + return elif [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) else @@ -45,15 +73,22 @@ _ant() break fi done - [[ ! -f $buildfile ]] && return 0 + if [[ $i -eq $cword ]]; then + for i in $ANT_ARGS; do + if [[ $prev == -@(?(build)file|f) ]]; then + buildfile=$i + break + fi + prev=$i + done + fi + [[ ! -f $buildfile ]] && return + + local targets + + # fill targets + _ant_parse_targets $buildfile - # parse buildfile for targets - local line targets - while read -rd '>' line; do - [[ $line =~ \ - \<(targe|extension-poin)t[[:space:]].*name=[\"\']([^\"\']+) ]] \ - && targets+=" ${BASH_REMATCH[2]}" - done < $buildfile COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) ) fi } && @@ -61,4 +96,4 @@ complete -F _ant ant phing type complete-ant-cmd.pl &>/dev/null && \ complete -C complete-ant-cmd.pl -F _ant ant || : -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apache2ctl b/completions/apache2ctl index f6fdeb30..74789744 100644 --- a/completions/apache2ctl +++ b/completions/apache2ctl @@ -6,11 +6,11 @@ _apache2ctl() _init_completion || return local APWORDS - APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ + APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ tr "|" " ") COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) } && complete -F _apache2ctl apache2ctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/appdata-validate b/completions/appdata-validate new file mode 100644 index 00000000..3285a3b3 --- /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 index 3812b20d..0723bcc4 100644 --- a/completions/apt-build +++ b/completions/apt-build @@ -16,27 +16,23 @@ _apt_build() case $special in install|source|info) COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) ) - return 0 ;; remove) COMPREPLY=( \ $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) - return 0 - ;; - *) - return 0 ;; esac + return fi case $prev in - --patch|--build-dir|--repository-dir) - _filedir - return 0 - ;; - -h|--help) - return 0 - ;; + --patch|--build-dir|--repository-dir) + _filedir + return + ;; + -h|--help) + return + ;; esac if [[ "$cur" == -* ]]; then @@ -51,9 +47,7 @@ _apt_build() -- "$cur" ) ) fi - - return 0 } && complete -F _apt_build apt-build -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apt-cache b/completions/apt-cache index 085a964d..bedae4e9 100644 --- a/completions/apt-cache +++ b/completions/apt-cache @@ -1,5 +1,20 @@ # 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 @@ -19,34 +34,31 @@ _apt_cache() case $special in add) _filedir - return 0 ;; showsrc) - COMPREPLY=( $( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) - return 0 + COMPREPLY=( $( _apt_cache_sources "$cur" ) ) ;; *) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) - return 0 + COMPREPLY=( $( _apt_cache_packages ) ) ;; esac + return fi case $prev in - -c|-p|-s|--config-file|--pkg-cache|--src-cache) - _filedir - return 0 - ;; - search) - if [[ "$cur" != -* ]]; then - return 0 - fi - ;; + -c|-p|-s|--config-file|--pkg-cache|--src-cache) + _filedir + return + ;; + search) + if [[ "$cur" != -* ]]; then + return + fi + ;; esac if [[ "$cur" == -* ]]; then @@ -64,9 +76,7 @@ _apt_cache() fi - - return 0 } && complete -F _apt_cache apt-cache -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apt-get b/completions/apt-get index 8fe36f13..ce951050 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -23,33 +23,31 @@ _apt_get() # assume RPM based _xfunc rpm _rpm_installed_packages fi - return 0 ;; source) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) $( apt-cache dumpavail | \ command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) - return 0 ;; *) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) ) - return 0 ;; esac + return fi case $prev in -c|--config-file) - _filedir - return 0 - ;; + _filedir + return + ;; -t|--target-release|--default-release) - COMPREPLY=( $( apt-cache policy | \ - command grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) - return 0 - ;; + 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 @@ -68,8 +66,7 @@ _apt_get() changelog check clean autoclean autoremove' -- "$cur" ) ) fi - return 0 } && complete -F _apt_get apt-get -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aptitude b/completions/aptitude index 3bcfa5cf..32c1dacf 100644 --- a/completions/aptitude +++ b/completions/aptitude @@ -9,7 +9,7 @@ _comp_dpkg_hold_packages() _comp_dpkg_hold_packages() { command grep -B 2 'hold' /var/lib/dpkg/status | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" } } @@ -26,7 +26,7 @@ _aptitude() local special i for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then + 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 @@ -35,39 +35,39 @@ _aptitude() done if [[ -n "$special" ]]; then - case $special in - install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \ - download|show|changelog|why|why-not|build-dep|add-user-tag| \ - remove-user-tag|versions) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - purge|remove|reinstall|forbid-version) - COMPREPLY=( \ - $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) - return 0 - ;; - unhold) - COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) - return 0 - ;; - esac + 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|safe-upgrade|upgrade|update|keep-all) - return 0 + autoclean|clean|forget-new|search|upgrade|update|keep-all) + return ;; -S) _filedir - return 0 + return ;; -t|--target-release|--default-release) COMPREPLY=( $( apt-cache policy | \ command grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) - return 0 + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) + return ;; esac @@ -81,8 +81,7 @@ _aptitude() remove-user-tag versions' -- "$cur" ) ) fi - return 0 } && complete -F _aptitude -o default aptitude -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arch b/completions/arch index 74e9adec..cd33b4f0 100644 --- a/completions/arch +++ b/completions/arch @@ -11,19 +11,18 @@ _arch() case $prev in -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -d|--file) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--wipe --start --end --quiet --help' \ - -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) else local args=$cword for (( i=1; i < cword; i++ )); do @@ -44,4 +43,4 @@ _arch() } && complete -F _arch arch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arping b/completions/arping index 231a63be..a719e916 100644 --- a/completions/arping +++ b/completions/arping @@ -28,4 +28,4 @@ _arping() } && complete -F _arping arping -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arpspoof b/completions/arpspoof index cf9c497a..7b515edb 100644 --- a/completions/arpspoof +++ b/completions/arpspoof @@ -8,11 +8,11 @@ _arpspoof() case $prev in -i) _available_interfaces -a - return 0 + return ;; -t) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -25,4 +25,4 @@ _arpspoof() } && complete -F _arpspoof arpspoof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/asciidoc b/completions/asciidoc index 722614f6..fb29fad4 100644 --- a/completions/asciidoc +++ b/completions/asciidoc @@ -49,4 +49,4 @@ _asciidoc() } && complete -F _asciidoc asciidoc asciidoc.py -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aspell b/completions/aspell index b1cd4c5d..9457a5fa 100644 --- a/completions/aspell +++ b/completions/aspell @@ -2,15 +2,15 @@ _aspell_dictionary() { - local datadir - datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) + 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=( $( command ls $datadir/*.alias 2>/dev/null ) ) - COMPREPLY=( ${COMPREPLY[@]%.alias} ) - COMPREPLY=( ${COMPREPLY[@]#$datadir/} ) + 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 -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY+=( $( $aspell dicts 2>/dev/null ) ) + COMPREPLY=( $( compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur" ) ) } _aspell() @@ -21,42 +21,42 @@ _aspell() case $prev in -c|-p|check|--conf|--personal|--repl|--per-conf) _filedir - return 0 + return ;; --conf-dir|--data-dir|--dict-dir|--home-dir|--local-data-dir|--prefix) _filedir -d - return 0 + return ;; dump|create|merge) COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) ) - return 0 + return ;; --mode) COMPREPLY=( $( compgen -W "$( $1 modes 2>/dev/null | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; --sug-mode) COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' \ -- "$cur" ) ) - return 0 + return ;; --keymapping) COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) ) - return 0 + return ;; -d|--master) - _aspell_dictionary - return 0 + _aspell_dictionary "$1" + return ;; --add-filter|--rem-filter) COMPREPLY=( $( compgen -W "$( $1 filters 2>/dev/null | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= @@ -85,4 +85,4 @@ _aspell() } && complete -F _aspell aspell -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoconf b/completions/autoconf index fea524e7..c67f1bdb 100644 --- a/completions/autoconf +++ b/completions/autoconf @@ -7,25 +7,25 @@ _autoconf() case "$prev" in --help|-h|--version|-V|--trace|-t) - return 0 + return ;; --output|-o) _filedir - return 0 + return ;; --warnings|-W) local cats=( cross obsolete syntax ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -37,4 +37,4 @@ _autoconf() } && complete -F _autoconf autoconf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/automake b/completions/automake index 78bc6db2..c5fe1a10 100644 --- a/completions/automake +++ b/completions/automake @@ -7,21 +7,21 @@ _automake() case "$prev" in --help|--version) - return 0 + return ;; --warnings|-W) local cats=( gnu obsolete override portability syntax unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --libdir) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -31,6 +31,6 @@ _automake() _filedir } && -complete -F _automake automake automake-1.11 +complete -F _automake automake automake-1.1{0..5} -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoreconf b/completions/autoreconf index 8de40c88..c067cec1 100644 --- a/completions/autoreconf +++ b/completions/autoreconf @@ -7,27 +7,27 @@ _autoreconf() case "$prev" in --help|-h|--version|-V) - return 0 + return ;; --warnings|-W) local cats=( cross gnu obsolete override portability syntax \ unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi if [[ $1 == autoheader ]] ; then @@ -38,4 +38,4 @@ _autoreconf() } && complete -F _autoreconf autoreconf autoheader -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autorpm b/completions/autorpm index 616ad8b6..8c6e299a 100644 --- a/completions/autorpm +++ b/completions/autorpm @@ -11,4 +11,4 @@ _autorpm() } && complete -F _autorpm autorpm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoscan b/completions/autoscan index 80b051cf..054a58af 100644 --- a/completions/autoscan +++ b/completions/autoscan @@ -7,20 +7,20 @@ _autoscan() case "$prev" in --help|-h|--version|-V) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi if [[ $1 == autoupdate ]] ; then @@ -31,4 +31,4 @@ _autoscan() } && complete -F _autoscan autoscan autoupdate -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/avctrl b/completions/avctrl index bac38cd6..acd9aeb7 100644 --- a/completions/avctrl +++ b/completions/avctrl @@ -17,4 +17,4 @@ _avctrl() } && complete -F _avctrl avctrl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/badblocks b/completions/badblocks index 2dc8eb43..d70affe2 100644 --- a/completions/badblocks +++ b/completions/badblocks @@ -7,11 +7,11 @@ _badblocks() case $prev in -b|-c|-e|-d|-p|-t) - return 0 + return ;; -i|-o) _filedir - return 0 + return ;; esac @@ -19,9 +19,9 @@ _badblocks() 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] + [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]' done - return 0 + return fi cur=${cur:=/dev/} @@ -29,4 +29,4 @@ _badblocks() } && complete -F _badblocks badblocks -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/bind b/completions/bind new file mode 100644 index 00000000..ec5d0b81 --- /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 index 8be6fb76..334e25b4 100644 --- a/completions/bk +++ b/completions/bk @@ -7,13 +7,12 @@ _bk() _init_completion || return local BKCMDS="$( bk help topics 2>/dev/null | \ - awk '/^ bk/ { print $4 }' | xargs printf '%s ' )" + awk '/^ bk/ { print $2 }' | xargs printf '%s ' )" COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) _filedir - return 0 } && complete -F _bk bk -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/brctl b/completions/brctl index 27207158..01370654 100644 --- a/completions/brctl +++ b/completions/brctl @@ -18,7 +18,7 @@ _brctl() show) ;; *) - COMPREPLY=( $( compgen -W "$(brctl show | \ + COMPREPLY=( $( compgen -W "$($1 show | \ awk 'NR>1 {print $1}' )" -- "$cur" ) ) esac ;; @@ -36,4 +36,4 @@ _brctl() } && complete -F _brctl -o default brctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/btdownloadheadless.py b/completions/btdownloadheadless.py index dc9789a9..f0b74615 100644 --- a/completions/btdownloadheadless.py +++ b/completions/btdownloadheadless.py @@ -8,11 +8,11 @@ _btdownload() case $prev in --responsefile|--saveas) _filedir - return 0 + return ;; esac - if [[ "$cur" == -* ]]; then + 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 @@ -29,4 +29,4 @@ _btdownload() complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \ btdownloadgui.py -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/bts b/completions/bts new file mode 100644 index 00000000..ba33fd66 --- /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:<src_package>" is being completed + # COMP_WORDS would be: "bts cleancache src : <partial_pkg_name>" + 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 index 1bc98288..8362a595 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -7,11 +7,11 @@ _bzip2() case $prev in -b|-h|--help|-p) - return 0 + return ;; -n) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac @@ -19,22 +19,20 @@ _bzip2() local helpopts=$( _parse_help "$1" ) COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' xspec="*.bz2" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --compress ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*z* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -42,4 +40,4 @@ _bzip2() } && complete -F _bzip2 bzip2 pbzip2 lbzip2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cancel b/completions/cancel index 3e9a3781..2722d2a8 100644 --- a/completions/cancel +++ b/completions/cancel @@ -9,4 +9,4 @@ _cancel() } && complete -F _cancel cancel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cardctl b/completions/cardctl index 5b5bb5d5..273d1a90 100644 --- a/completions/cardctl +++ b/completions/cardctl @@ -12,4 +12,4 @@ _cardctl() } && complete -F _cardctl cardctl pccardctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ccache b/completions/ccache index 63f5a1c6..7184d74e 100644 --- a/completions/ccache +++ b/completions/ccache @@ -5,15 +5,27 @@ _ccache() local cur prev words cword split _init_completion -s || return - if [[ $COMP_CWORD -eq 1 && ${COMP_WORDS[COMP_CWORD]} != -* ]]; then - _command_offset 1 - return - fi + 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 @@ -23,4 +35,4 @@ _ccache() } && complete -F _ccache ccache -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cfagent b/completions/cfagent index f3e227a4..fbf364ed 100644 --- a/completions/cfagent +++ b/completions/cfagent @@ -8,7 +8,7 @@ _cfagent() case $prev in -f|--file) _filedir - return 0 + return ;; esac @@ -18,4 +18,4 @@ _cfagent() } && complete -F _cfagent cfagent -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cfrun b/completions/cfrun index 7dd1beff..f4d1f265 100644 --- a/completions/cfrun +++ b/completions/cfrun @@ -17,7 +17,7 @@ _cfrun() case $prev in -f) _filedir - return 0 + return ;; esac @@ -31,7 +31,7 @@ _cfrun() break fi done - [[ ! -f $hostfile ]] && return 0 + [[ ! -f $hostfile ]] && return COMPREPLY=( $(compgen -W "$( command grep -v \ -E '(=|^$|^#)' $hostfile )" -- "$cur" ) ) @@ -44,4 +44,4 @@ _cfrun() } && complete -F _cfrun cfrun -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chage b/completions/chage index 1842bb8a..9b11f169 100644 --- a/completions/chage +++ b/completions/chage @@ -8,19 +8,19 @@ _chage() case $prev in -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ -M|--maxdays|-W|--warndays) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -u -- "$cur" ) ) } && complete -F _chage chage -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/change_pw b/completions/change_pw index abc7d6b1..b0f2061f 100644 --- a/completions/change_pw +++ b/completions/change_pw @@ -8,11 +8,11 @@ _change_pw() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--all --domain --listname --password --quiet @@ -22,4 +22,4 @@ _change_pw() } && complete -F _change_pw change_pw -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/check_db b/completions/check_db index 651b375c..6f666173 100644 --- a/completions/check_db +++ b/completions/check_db @@ -14,4 +14,4 @@ _check_db() } && complete -F _check_db check_db -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/check_perms b/completions/check_perms index 472b9266..0fb05b11 100644 --- a/completions/check_perms +++ b/completions/check_perms @@ -12,4 +12,4 @@ _check_perms() } && complete -F _check_perms check_perms -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/checksec b/completions/checksec new file mode 100644 index 00000000..4e9fb601 --- /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 index 26220d9e..986a77a6 100644 --- a/completions/chgrp +++ b/completions/chgrp @@ -9,10 +9,10 @@ _chgrp() if [[ "$prev" == --reference ]]; then _filedir - return 0 + return fi - $split && return 0 + $split && return # options completion if [[ "$cur" == -* ]]; then @@ -23,18 +23,17 @@ _chgrp() COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference --no-dereference --silent --quiet --reference --recursive --verbose --help --version $opts' -- "$cur" ) ) - return 0 + return fi # first parameter on line or first since an option? if [[ $cword -eq 1 && "$cur" != -* || "$prev" == -* ]]; then _allowed_groups "$cur" else - _filedir || return 0 + _filedir fi - return 0 } && complete -F _chgrp chgrp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chkconfig b/completions/chkconfig index b1dd925e..8766b3a2 100644 --- a/completions/chkconfig +++ b/completions/chkconfig @@ -9,15 +9,15 @@ _chkconfig() --level=[1-6]|[1-6]|--list|--add|--del|--override) _services _xinetd_services - return 0 + return ;; --level) COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--list --add --del --override --level' \ @@ -34,4 +34,4 @@ _chkconfig() } && complete -F _chkconfig chkconfig -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chown b/completions/chown index 54d89fb8..c4479dd2 100644 --- a/completions/chown +++ b/completions/chown @@ -9,15 +9,15 @@ _chown() case "$prev" in --from) _usergroup - return 0 + return ;; --reference) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then # Complete -options @@ -43,4 +43,4 @@ _chown() } && complete -F _chown chown -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chpasswd b/completions/chpasswd index 499ec93b..93e74f8c 100644 --- a/completions/chpasswd +++ b/completions/chpasswd @@ -9,18 +9,18 @@ _chpasswd() -c|--crypt) COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ -- "$cur" ) ) - return 0 + return ;; -s|--sha-rounds) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _chpasswd chpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chronyc b/completions/chronyc index 3544c753..ede6bb09 100644 --- a/completions/chronyc +++ b/completions/chronyc @@ -1,5 +1,16 @@ # 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 + \<address\>) _known_hosts_real "$cur" ;; + \<*) ;; + *) COMPREPLY+=( $( compgen -W '${args[@]}' -- "$cur" ) ) ;; + esac +} + _chronyc() { local cur prev words cword @@ -16,7 +27,7 @@ _chronyc() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -6' -- "$cur" ) ) return fi @@ -24,40 +35,19 @@ _chronyc() 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 'NR > 1 { sub("\\|", " ", $1); print $1 }' )" -- "$cur" ) ) + awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }' )" \ + -- "$cur" ) ) ;; 1) - case $prev in - accheck|cmdaccheck|delete|maxdelay|maxdelayratio|\ - maxdelaydevratio|maxpoll|minpoll|minstratum|polltarget) - _known_hosts_real "$cur" - ;; - add) - COMPREPLY=( $( compgen -W 'peer server' -- "$cur" ) ) - ;; - allow|cmdallow|cmddeny|deny) - COMPREPLY=( $( compgen -W 'all' -- "$cur" ) ) - ;; - authhash) - COMPREPLY=( $( compgen -W 'MD5 SHA1' -- "$cur" ) ) - ;; - dns) - COMPREPLY=( $( compgen -W '-n +n -4 -6 -46' -- "$cur" ) ) - ;; - local) - COMPREPLY=( $( compgen -W 'off stratum' -- "$cur" ) ) - ;; - manual) - COMPREPLY=( $( compgen -W 'list on off reset' -- "$cur" ) ) - ;; - sources|sourcestats) - COMPREPLY=( $( compgen -W '-v' -- "$cur" ) ) - ;; - esac + _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" @@ -66,4 +56,4 @@ _chronyc() } && complete -F _chronyc chronyc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chrpath b/completions/chrpath index 29a71851..13e43ad0 100644 --- a/completions/chrpath +++ b/completions/chrpath @@ -24,4 +24,4 @@ _chrpath() } && complete -F _chrpath chrpath -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cksfv b/completions/cksfv index eabe3730..dd90816e 100644 --- a/completions/cksfv +++ b/completions/cksfv @@ -7,23 +7,23 @@ _cksfv() if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi case "$prev" in -C|-g) _filedir -d - return 0 + return ;; -f) _filedir 'sfv' - return 0 + return ;; esac _filedir - return 0 + } && complete -F _cksfv cksfv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cleanarch b/completions/cleanarch index 7fb05299..edac34f8 100644 --- a/completions/cleanarch +++ b/completions/cleanarch @@ -13,4 +13,4 @@ _cleanarch() } && complete -F _cleanarch cleanarch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/clisp b/completions/clisp index cdbf6bd2..23b04f04 100644 --- a/completions/clisp +++ b/completions/clisp @@ -16,8 +16,7 @@ _clisp() _filedir fi - return 0 } && complete -F _clisp -o default clisp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/clone_member b/completions/clone_member index 9dd55fe8..fe45e494 100644 --- a/completions/clone_member +++ b/completions/clone_member @@ -8,11 +8,11 @@ _clone_member() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --remove --admin --quiet @@ -22,4 +22,4 @@ _clone_member() } && complete -F _clone_member clone_member -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/complete b/completions/complete index bcac435d..5de2d168 100644 --- a/completions/complete +++ b/completions/complete @@ -9,7 +9,7 @@ _complete() -o) COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames nospace plusdirs' -- "$cur" ) ) - return 0 + return ;; -A) @@ -17,21 +17,21 @@ _complete() directory disabled enabled export file function group helptopic hostname job keyword running service setopt shopt signal stopped user variable' -- "$cur" ) ) - return 0 + return ;; -C) COMPREPLY=( $( compgen -A command -- "$cur" ) ) - return 0 + return ;; -F) COMPREPLY=( $( compgen -A function -- "$cur" ) ) - return 0 + return ;; -p|-r) - COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) ) + COMPREPLY=( $( complete -p | command sed -e 's|.* ||' ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 + return ;; esac @@ -47,4 +47,4 @@ _complete() } && complete -F _complete compgen complete -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/config_list b/completions/config_list index 68ab6cb7..653c628a 100644 --- a/completions/config_list +++ b/completions/config_list @@ -8,11 +8,11 @@ _config_list() case $prev in -i|-o|--inputfile|--outputfile) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--inputfile --outputfile --checkonly @@ -24,4 +24,4 @@ _config_list() } && complete -F _config_list config_list -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/configure b/completions/configure index 2337c497..0e37726b 100644 --- a/completions/configure +++ b/completions/configure @@ -20,16 +20,16 @@ _configure() ;; esac - $split && return 0 + $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 0 + [[ "$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 }' | sed -e 's/[[,].*//g' )" \ + if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g' )" \ -- "$cur" ) ) [[ $COMPREPLY == *=* ]] && compopt -o nospace else @@ -39,4 +39,4 @@ _configure() } && complete -F _configure configure -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/convert b/completions/convert index ffb320e2..59647d59 100644 --- a/completions/convert +++ b/completions/convert @@ -6,88 +6,88 @@ _ImageMagick() -channel) COMPREPLY=( $( compgen -W 'Red Green Blue Opacity Matte Cyan Magenta Yellow Black' -- "$cur" ) ) - return 0 + return ;; -colormap) COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) ) - return 0 + return ;; -colorspace) COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) ) - return 0 + return ;; -compose) COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus Minus Add Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) ) - return 0 + return ;; -compress) COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG Lossless LZW RLE Zip' -- "$cur" ) ) - return 0 + return ;; -dispose) COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \ -- "$cur" ) ) - return 0 + return ;; -encoding) COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert AdobeStandard AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode Wansung' -- "$cur" ) ) - return 0 + return ;; -endian) COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) ) - return 0 + return ;; -filter) COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) ) - return 0 + return ;; -format) COMPREPLY=( $( compgen -W "$( convert -list format | awk \ '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }' )" \ -- "$cur" ) ) - return 0 + return ;; -gravity) COMPREPLY=( $( compgen -W 'Northwest North NorthEast West Center East SouthWest South SouthEast' -- "$cur" ) ) - return 0 + return ;; -intent) COMPREPLY=( $( compgen -W 'Absolute Perceptual Relative Saturation' -- "$cur" ) ) - return 0 + return ;; -interlace) COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) ) - return 0 + return ;; -limit) COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) ) - return 0 + return ;; -list) COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource Type' -- "$cur" ) ) - return 0 + return ;; -map) COMPREPLY=( $( compgen -W 'best default gray red green blue' \ -- "$cur" ) ) _filedir - return 0 + return ;; -noise) COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative Impulse Laplacian Poisson' -- "$cur" ) ) - return 0 + return ;; -preview) COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue Saturation @@ -95,32 +95,32 @@ _ImageMagick() ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) ) - return 0 + return ;; -mask|-profile|-texture|-tile|-write) _filedir - return 0 + return ;; -type) COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte Optimize' -- "$cur" ) ) - return 0 + return ;; -units) COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch PixelsPerCentimeter' -- "$cur" ) ) - return 0 + return ;; -virtual-pixel) COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) ) - return 0 + return ;; -visual) COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor defaut visualid' \ -- "$cur" ) ) - return 0 + return ;; esac @@ -321,4 +321,4 @@ _stream() } && complete -F _stream stream -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cowsay b/completions/cowsay index 8e96b91e..4f4411ac 100644 --- a/completions/cowsay +++ b/completions/cowsay @@ -9,7 +9,7 @@ _cowsay() -f) COMPREPLY=( $( compgen -W \ '$( cowsay -l 2>/dev/null | tail -n +2 )' -- "$cur" ) ) - return 0 + return ;; esac @@ -20,4 +20,4 @@ _cowsay() } && complete -F _cowsay -o default cowsay cowthink -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cpan2dist b/completions/cpan2dist index f6a67ac6..9704782d 100644 --- a/completions/cpan2dist +++ b/completions/cpan2dist @@ -11,11 +11,11 @@ _cpan2dist() COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ -- "$cur" ) ) - return 0 + return ;; --banlist|--ignorelist|--modulelist|--logfile) _filedir - return 0 + return ;; esac @@ -29,9 +29,9 @@ _cpan2dist() packagelist="$dir/02packages.details.txt.gz" done [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \ - $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ) ) + $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g' ) ) fi } && complete -F _cpan2dist -o default cpan2dist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cpio b/completions/cpio index d63d15a9..36e3fe90 100644 --- a/completions/cpio +++ b/completions/cpio @@ -10,24 +10,24 @@ _cpio() -H|--format) COMPREPLY=( $( compgen -W \ 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) - return 0 + return ;; -E|-F|-I|--file|--pattern-file) _filedir - return 0 + return ;; -R|--owner) _usergroup - return 0 + return ;; --rsh-command) compopt -o filenames COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through @@ -75,4 +75,4 @@ _cpio() } && complete -F _cpio cpio -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cppcheck b/completions/cppcheck index 64bb9b02..86990dd5 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -6,12 +6,13 @@ _cppcheck() _init_completion -s || return case $prev in - --append|--exitcode-suppressions|--file-list|--rule-file|\ + --append|--exitcode-suppressions|--rule-file|--config-excludes-file|\ --suppressions-list|--includes-file|--include|-i) _filedir return ;; - -D|-U|--rule|--suppress|--template|--max-configs) + -D|-U|--rule|--suppress|--template|--max-configs|-h|--help|--version|\ + --errorlist|--config-exclude|-l) return ;; --enable) @@ -22,8 +23,9 @@ _cppcheck() cur="${cur##*,}" split=true fi - COMPREPLY=( $( compgen -W 'all style performance portability - information unusedFunction missingInclude' -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'all warning style performance + portability information unusedFunction missingInclude' \ + -- "$cur" ) ) $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) return ;; @@ -31,6 +33,11 @@ _cppcheck() COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) return ;; + --file-list) + _filedir + [[ -z $cur || $cur == - ]] && COMPREPLY+=( - ) + return + ;; -I) _filedir -d return @@ -49,8 +56,9 @@ _cppcheck() return ;; --platform) - COMPREPLY=( $( compgen -W 'unix32 unix64 win32A win32W win64' \ - -- "$cur" ) ) + _filedir + COMPREPLY+=( $( compgen -W 'unix32 unix64 win32A win32W win64 + native' -- "$cur" ) ) return ;; -rp|--relative-paths) @@ -59,6 +67,10 @@ _cppcheck() return fi ;; + --library) + _filedir cfg + return + ;; --xml-version) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) return @@ -71,9 +83,9 @@ _cppcheck() COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - _filedir @(cpp|cxx|cc|c++|c|h|hpp|hxx|h++|tpp|txx) + _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' fi } && complete -F _cppcheck cppcheck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/crontab b/completions/crontab index ddd0066c..bb8d0e24 100644 --- a/completions/crontab +++ b/completions/crontab @@ -8,7 +8,7 @@ _crontab() case $prev in -u) _allowed_users - return 0 + return ;; esac @@ -18,31 +18,31 @@ _crontab() local i for (( i=0; i < ${#words[@]}-1; i++ )); do - [[ ${words[i]} ]] && unset opts[${words[i]}] + [[ ${words[i]} ]] && unset "opts[${words[i]}]" case "${words[i]}" in -l) - unset opts[-r] opts[-e] opts[-i] opts[-s] + unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' ;; -e) - unset opts[-l] opts[-r] opts[-i] + unset 'opts[-l]' 'opts[-r]' 'opts[-i]' ;; -r) - unset opts[-l] opts[-e] + unset 'opts[-l]' 'opts[-e]' ;; -u) - unset opts[-i] + unset 'opts[-i]' ;; esac done if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '${!opts[@]}' -- "$cur" ) ) - return 0 + return fi # do filenames only if we did not have -l, -r, or -e - [[ "${words[@]}" == *\ -@(l|r|e)* ]] || _filedir + [[ "${words[@]}" == *\ -[lre]* ]] || _filedir } && complete -F _crontab crontab -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cryptsetup b/completions/cryptsetup index a295a147..9411ad7a 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -20,7 +20,7 @@ _cryptsetup() case $prev in --key-file|--master-key-file|--header-backup-file|-d) _filedir - return 0 + return ;; esac @@ -99,8 +99,7 @@ _cryptsetup() esac fi - return 0 } && complete -F _cryptsetup cryptsetup -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/curl b/completions/curl index 6b56aa57..8251674c 100644 --- a/completions/curl +++ b/completions/curl @@ -92,4 +92,4 @@ _curl() } && complete -F _curl curl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cvs b/completions/cvs index 71277556..fee256f2 100644 --- a/completions/cvs +++ b/completions/cvs @@ -51,7 +51,7 @@ _cvs() _init_completion -n : || return local count mode i cvsroot cvsroots pwd - local -a flags miss files entries changed newremoved + local -a flags files entries changed newremoved count=0 for i in "${words[@]}"; do @@ -64,7 +64,7 @@ _cvs() case $i in -H|--help) COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) ) - return 0 + return ;; -d) mode=cvsroot @@ -131,7 +131,7 @@ _cvs() mode=version ;; esac - elif [[ "$i" = -* ]]; then + elif [[ "$i" == -* ]]; then flags+=( $i ) fi count=$((++count)) @@ -141,11 +141,11 @@ _cvs() add) case $prev in -m) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -156,11 +156,11 @@ _cvs() local f for i in ${!files[@]}; do if [[ ${files[i]} == ?(*/)CVS ]]; then - unset files[i] + unset 'files[i]' else for f in "${entries[@]}"; do if [[ ${files[i]} == $f && ! -d $f ]]; then - unset files[i] + unset 'files[i]' break fi done @@ -175,19 +175,19 @@ _cvs() admin) case $prev in -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u) - return 0 + return ;; -t) _filedir - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -195,9 +195,9 @@ _cvs() fi ;; annotate) - [[ "$prev" == -@(r|D) ]] && return 0 + [[ "$prev" == -[rD] ]] && return - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -206,16 +206,16 @@ _cvs() ;; checkout) case $prev in - -r|-D|j) - return 0 + -r|-D|-j) + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -231,11 +231,11 @@ _cvs() commit) case $prev in -m|-r) - return 0 + return ;; -F) _filedir - return 0 + return ;; esac @@ -248,9 +248,9 @@ _cvs() # far, but other changes (something other than # changed/removed/new) may be missing changed=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) newremoved=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) COMPREPLY=( $( compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- "$cur" ) ) else @@ -274,7 +274,7 @@ _cvs() fi ;; editors|watchers) - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -284,15 +284,15 @@ _cvs() export) case $prev in -r|-D) - return 0 + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -307,11 +307,11 @@ _cvs() import) case $prev in -I|-b|-m|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -334,11 +334,13 @@ _cvs() remove) if [[ "$cur" != -* ]]; then _cvs_entries - # find out what files are missing - for i in "${entries[@]}"; do - [[ ! -r $i ]] && miss+=( $i ) - done - COMPREPLY=( $( compgen -W '${miss[@]:-}' -- "$cur" ) ) + 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 @@ -346,15 +348,15 @@ _cvs() update) case $prev in -r|-D|-j|-I|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -365,14 +367,14 @@ _cvs() case $prev in -T) _filedir -d - return 0 + return ;; -e|-s) - return 0 + return ;; -z) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; esac @@ -382,8 +384,7 @@ _cvs() ;; esac - return 0 } && complete -F _cvs cvs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cvsps b/completions/cvsps index 8b986f57..64dab54f 100644 --- a/completions/cvsps +++ b/completions/cvsps @@ -7,43 +7,43 @@ _cvsps() case $prev in -h|-z|-f|-d|-l|--diff-opts|--debuglvl) - return 0 + return ;; -s) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^PatchSet:?[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -a) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Author:[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -b) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Branch:[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -r) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Tag:[ \t]+[^(]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -p) _filedir -d - return 0 + return ;; --test-log) _filedir - return 0 + return ;; -Z) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; --root) _xfunc cvs _cvs_roots - return 0 + return ;; esac @@ -55,4 +55,4 @@ _cvsps() } && complete -F _cvsps cvsps -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dd b/completions/dd index 53132dcc..daaebbe1 100644 --- a/completions/dd +++ b/completions/dd @@ -9,22 +9,35 @@ _dd() if=*|of=*) cur=${cur#*=} _filedir - return 0 + return ;; conv=*) cur=${cur#*=} COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase - notrunc ucase swab noerror sync' -- "$cur" ) ) - return 0 + 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 0 + _expand || return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \ - $( compgen -W 'bs cbs conv count ibs if obs of seek skip' \ - -S '=' -- "$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: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/deja-dup b/completions/deja-dup new file mode 100644 index 00000000..a508bb1e --- /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 index faae6c37..93f21061 100644 --- a/completions/desktop-file-validate +++ b/completions/desktop-file-validate @@ -20,4 +20,4 @@ _desktop_file_validate() } && complete -F _desktop_file_validate desktop-file-validate -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dhclient b/completions/dhclient index 54d89d31..8b44f6c3 100644 --- a/completions/dhclient +++ b/completions/dhclient @@ -8,11 +8,11 @@ _dhclient() case $prev in -cf|-lf|-pf|-sf) _filedir - return 0 + return ;; -s) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -25,4 +25,4 @@ _dhclient() } && complete -F _dhclient dhclient -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dict b/completions/dict index a2ecd9b1..ac7df3fc 100644 --- a/completions/dict +++ b/completions/dict @@ -2,8 +2,8 @@ _dictdata() { - dict $host $port $1 2>/dev/null | sed -ne \ - 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p' + dict $host $port $1 2>/dev/null | command sed -ne \ + 's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p' } _dict() @@ -30,26 +30,22 @@ _dict() [[ -n $db ]] && host="-d $db" i=$((++i)) ;; - *) - ;; esac done - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi case $prev in -d|--database|-i|-info) COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) - return 0 + return ;; -s|--strategy) COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) - return 0 - ;; - *) + return ;; esac @@ -68,4 +64,4 @@ _dict() } && complete -F _dict -o default dict rdict -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dnsspoof b/completions/dnsspoof index 2518af69..d6b7872b 100644 --- a/completions/dnsspoof +++ b/completions/dnsspoof @@ -8,11 +8,11 @@ _dnsspoof() case $prev in -i) _available_interfaces -a - return 0 + return ;; -f) _filedir - return 0 + return ;; esac @@ -23,4 +23,4 @@ _dnsspoof() } && complete -F _dnsspoof dnsspoof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dot b/completions/dot index ef946e4b..bc3531bb 100644 --- a/completions/dot +++ b/completions/dot @@ -5,7 +5,7 @@ _dot() local cur prev words cword _init_completion -n := || return - [[ $prev == -@(V|\?) ]] && return + [[ $prev == -[V?] ]] && return case $cur in -G*|-N*|-E*|-l?*|-q?*|-s?*|-Ln*|-LU*|-LC*|-LT*) @@ -13,13 +13,13 @@ _dot() ;; -T*) local langs=( $( "$1" -TNON_EXISTENT 2>&1 | \ - sed -ne 's/.*one of://p' ) ) + command sed -ne 's/.*one of://p' ) ) COMPREPLY=( $( compgen -P -T -W '${langs[@]}' -- "${cur#-T}" ) ) return ;; -K*) local layouts=( $( "$1" -KNON_EXISTENT 2>&1 | \ - sed -ne 's/.*one of://p' ) ) + command sed -ne 's/.*one of://p' ) ) COMPREPLY=( $( compgen -P -K -W '${layouts[@]}' -- "${cur#-K}" ) ) return ;; @@ -34,7 +34,7 @@ _dot() 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 == -@(G|N|E|T|K|o|L[nUCT]) ]] && compopt -o nospace + [[ $COMPREPLY == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace return fi @@ -42,4 +42,4 @@ _dot() } && complete -F _dot dot -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dpkg b/completions/dpkg index d14e5e3e..725542a7 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -8,11 +8,11 @@ _comp_dpkg_installed_packages() } || { _comp_dpkg_installed_packages() { - command grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + 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" | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" 2>/dev/null } } @@ -24,11 +24,11 @@ _comp_dpkg_purgeable_packages() } || { _comp_dpkg_purgeable_packages() { - command grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + 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" | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" 2>/dev/null } } @@ -39,8 +39,6 @@ _dpkg() local cur prev words cword split _init_completion -s || return - _expand || return 0 - local i=$cword # find the last option flag @@ -55,28 +53,28 @@ _dpkg() -c|-i|-A|-I|-f|-e|-x|-X|-W|--install|--unpack|--record-avail| \ --contents|--info|--fsys-tarfile|--field|--control|--extract| \ --show) - _filedir '?(u)deb' - return 0 + _filedir '?(u|d)deb' + return ;; -b|--build) _filedir -d - return 0 + return ;; -s|-p|-l|--status|--print-avail|--list) COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) - return 0 + return ;; -S|--search) _filedir - return 0 + return ;; -r|--remove) COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) - return 0 + return ;; -L|-P|--listfiles|--purge) COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) ) - return 0 + return ;; esac @@ -98,25 +96,25 @@ _dpkg_reconfigure() 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 0 - ;; + 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 0 - ;; + 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" ) ) + --help --showold --force --terse' -- "$cur" ) ) else COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) fi } && complete -F _dpkg_reconfigure -o default dpkg-reconfigure -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dpkg-source b/completions/dpkg-source index 6cd9bde3..54403851 100644 --- a/completions/dpkg-source +++ b/completions/dpkg-source @@ -8,7 +8,7 @@ _dpkg_source() 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" + -sU -sR" unpackopts="-sp -sn -su" options="-x -b $packopts $unpackopts" fields="Format Source Version Binary Maintainer Uploader Architecture \ @@ -31,22 +31,19 @@ _dpkg_source() -x) _filedir -d _filedir 'dsc' - return 0 ;; *) COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) _filedir -d _filedir - return 0 ;; esac - return 0 + return ;; pack) case $prev in -b) _filedir -d - return 0 ;; -c|-l|-T|-i|-I) # -c: get controlfile @@ -57,19 +54,16 @@ _dpkg_source() # return directory names and file names _filedir -d _filedir - return 0 ;; -F) # -F: force change log format COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) - return 0 ;; -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=() - return 0 ;; -D) # -D: override or add a .dsc field and value @@ -77,31 +71,28 @@ _dpkg_source() if [[ "$cur" == *=* ]]; then # $cur contains a "=" COMPREPLY=() - return 0 else COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 fi ;; -U) # -U: remove a field # Suggest possible fieldnames COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 ;; *) - COMPREPLY=( $( compgen -W "$packopts $unpackopts" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$packopts $unpackopts" \ + -- "$cur" ) ) ;; esac - return 0 + return ;; *) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - return 0 + return ;; esac } && complete -F _dpkg_source dpkg-source -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dselect b/completions/dselect index ee3cb2a7..e5f148cb 100644 --- a/completions/dselect +++ b/completions/dselect @@ -8,11 +8,11 @@ _dselect() case $prev in --admindir) _filedir -d - return 0 + return ;; -D|-debug) _filedir - return 0 + return ;; esac @@ -24,8 +24,7 @@ _dselect() quit' -- "$cur" ) ) fi - return 0 } && complete -F _dselect dselect -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dsniff b/completions/dsniff index db9b02ac..165ab74b 100644 --- a/completions/dsniff +++ b/completions/dsniff @@ -8,11 +8,11 @@ _dsniff() case $prev in -r|-w|-f|-p) _filedir - return 0 + return ;; -i) _available_interfaces -a - return 0 + return ;; esac @@ -23,4 +23,4 @@ _dsniff() } && complete -F _dsniff dsniff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dumpdb b/completions/dumpdb index f097f895..ced754f5 100644 --- a/completions/dumpdb +++ b/completions/dumpdb @@ -15,4 +15,4 @@ _dumpdb() } && complete -F _dumpdb dumpdb -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dumpe2fs b/completions/dumpe2fs index 127b46fc..90f84791 100644 --- a/completions/dumpe2fs +++ b/completions/dumpe2fs @@ -7,17 +7,17 @@ _dumpe2fs() case $prev in -o|-V) - return 0 + return ;; -i) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi cur=${cur:=/dev/} @@ -25,4 +25,4 @@ _dumpe2fs() } && complete -F _dumpe2fs dumpe2fs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/e2freefrag b/completions/e2freefrag index 6a971156..bee4a169 100644 --- a/completions/e2freefrag +++ b/completions/e2freefrag @@ -7,13 +7,13 @@ _e2freefrag() case $prev in -c|-h) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) - return 0 + return fi cur=${cur:=/dev/} @@ -21,4 +21,4 @@ _e2freefrag() } && complete -F _e2freefrag e2freefrag -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/e2label b/completions/e2label index 94bcc1c8..c145c3a0 100644 --- a/completions/e2label +++ b/completions/e2label @@ -12,4 +12,4 @@ _e2label() } && complete -F _e2label e2label -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/eog b/completions/eog index 6da35e15..d5621119 100644 --- a/completions/eog +++ b/completions/eog @@ -20,8 +20,8 @@ _eog() return fi - _filedir '@(ani|?(w)bmp|gif|ico|j2k|jp[cefgx2]|jpeg|pcx|pn[gm]|ras|svg?(z)|tga|tif?(f)|x[bp]m)' + _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: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ether-wake b/completions/ether-wake index 4957e055..387b2d64 100644 --- a/completions/ether-wake +++ b/completions/ether-wake @@ -8,20 +8,20 @@ _ether_wake() case $prev in -i) _available_interfaces -a - return 0 + return ;; -p) - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) - return 0 + return fi _mac_addresses } && complete -F _ether_wake ether-wake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/evince b/completions/evince index 8ef75160..eb6c7305 100644 --- a/completions/evince +++ b/completions/evince @@ -17,7 +17,7 @@ _evince() ;; esac - $split && return 0 + $split && return if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ @@ -30,4 +30,4 @@ _evince() } && complete -F _evince evince -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/explodepkg b/completions/explodepkg index b6914750..a281f81e 100644 --- a/completions/explodepkg +++ b/completions/explodepkg @@ -2,4 +2,4 @@ complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/export b/completions/export index 42273a9e..31715f9a 100644 --- a/completions/export +++ b/completions/export @@ -24,7 +24,12 @@ _export() break done - [[ $cur == *=\$* ]] && { cur=${cur#*=}; _variables; } && return + if [[ $cur == *=* ]]; then + local ocur=$cur oprev=$prev + prev=${cur%%=*} cur=${cur#*=} + _variables && return + cur=$ocur prev=$oprev + fi case $cur in *=) @@ -58,4 +63,4 @@ _export() } && complete -F _export export -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/faillog b/completions/faillog index 77ca9c72..3b4a23d0 100644 --- a/completions/faillog +++ b/completions/faillog @@ -7,22 +7,21 @@ _faillog() case $prev in -h|--help|-l|--lock-time|-m|--maximum|-t|--time) - return 0 + return ;; -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _faillog faillog -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fbgs b/completions/fbgs index 8058e01a..c58a7af9 100644 --- a/completions/fbgs +++ b/completions/fbgs @@ -12,7 +12,7 @@ _fbgs() return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( sed \ + COMPREPLY=( $( compgen -W '$( command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return @@ -44,6 +44,7 @@ _fbgs() fi _filedir '?(e)ps|pdf' -} && complete -F _fbgs fbgs +} && +complete -F _fbgs fbgs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fbi b/completions/fbi index 5073607a..75b46b61 100644 --- a/completions/fbi +++ b/completions/fbi @@ -20,7 +20,7 @@ _fbi() return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( sed \ + COMPREPLY=( $( compgen -W '$( command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return @@ -48,6 +48,7 @@ _fbi() # 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 +} && +complete -F _fbi fbi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/feh b/completions/feh index e53ca2b1..1cd75420 100644 --- a/completions/feh +++ b/completions/feh @@ -52,8 +52,8 @@ _feh() return ;; -S|--sort) - COMPREPLY=( $( compgen -W 'name filename width height pixels size - format' -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'name filename mtime width height + pixels size format' -- "$cur" ) ) return ;; -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\ @@ -100,6 +100,7 @@ _feh() $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 @@ -108,6 +109,7 @@ _feh() # 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 +} && +complete -F _feh feh -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/file b/completions/file index 172fd5e0..f3f6df88 100644 --- a/completions/file +++ b/completions/file @@ -29,4 +29,4 @@ _file() } && complete -F _file file -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/file-roller b/completions/file-roller index c05565d9..3c627585 100644 --- a/completions/file-roller +++ b/completions/file-roller @@ -5,7 +5,7 @@ _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|[ejrw]ar|exe|?(g)tar|gem|lh[az]|lzh|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zip|zoo)' + 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) @@ -16,6 +16,7 @@ _file_roller() return ;; -a|--add-to) + _filedir_xspec unzip _filedir "$exts" return ;; @@ -34,8 +35,9 @@ _file_roller() return fi + _filedir_xspec unzip _filedir "$exts" } && complete -F _file_roller file-roller -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/filefrag b/completions/filefrag index ee9d0d81..b4866dc0 100644 --- a/completions/filefrag +++ b/completions/filefrag @@ -7,11 +7,11 @@ _filefrag() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _filefrag filefrag -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/filesnarf b/completions/filesnarf index dbadd434..0cdcfe27 100644 --- a/completions/filesnarf +++ b/completions/filesnarf @@ -8,7 +8,7 @@ _snarf() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _snarf() } && complete -F _snarf filesnarf mailsnarf msgsnarf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/find b/completions/find index 1896fc22..39029345 100644 --- a/completions/find +++ b/completions/find @@ -10,70 +10,70 @@ _find() case $prev in -maxdepth|-mindepth) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return 0 + return ;; -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\ -lname|-ilname|-wholename|-iwholename|-samefile) _filedir - return 0 + return ;; -fstype) _fstypes [[ $OSTYPE == *bsd* ]] && \ COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) ) - return 0 + return ;; -gid) _gids - return 0 + return ;; -group) COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) ) - return 0 + return ;; -xtype|-type) COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) ) - return 0 + return ;; -uid) _uids - return 0 + return ;; -user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -exec|-execdir|-ok|-okdir) words=(words[0] "$cur") cword=1 _command - return 0 + 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 0 + return ;; -regextype) COMPREPLY=( $( compgen -W 'emacs posix-awk posix-basic posix-egrep posix-extended' -- "$cur" ) ) - return 0 + return ;; esac - _expand || return 0 + _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 + [[ "$i" == [-\(\),\!]* ]] && exprfound=true && break done # handle case where first parameter is not a dash option if ! $exprfound && [[ "$cur" != [-\(\),\!]* ]]; then _filedir -d - return 0 + return fi # complete using basic options @@ -101,15 +101,14 @@ _find() for i in "${words[@]}"; do [[ $i && ${onlyonce[$i]} ]] || continue for j in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[j]} == $i ]] && unset COMPREPLY[j] + [[ ${COMPREPLY[j]} == $i ]] && unset 'COMPREPLY[j]' done done fi _filedir - return 0 } && complete -F _find find -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/find_member b/completions/find_member index b1fcaf62..df1a24f9 100644 --- a/completions/find_member +++ b/completions/find_member @@ -8,11 +8,11 @@ _find_member() case $prev in -l|-x|--listname|--exclude) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --exclude --owners --help' \ @@ -22,4 +22,4 @@ _find_member() } && complete -F _find_member find_member -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/flake8 b/completions/flake8 new file mode 100644 index 00000000..60ad9e2b --- /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 00000000..6ee2438b --- /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 index c818433d..246d4f20 100644 --- a/completions/freeciv-gtk2 +++ b/completions/freeciv-gtk2 @@ -8,15 +8,15 @@ _civclient() case $prev in -l|-S|-t|--log|--Sound|--tiles) _filedir - return 0 + return ;; -P|--Plugin) COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) ) - return 0 + return ;; -s|--server) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -27,4 +27,4 @@ _civclient() } && complete -F _civclient civclient freeciv-gtk2 freeciv-sdl freeciv-xaw -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/freeciv-server b/completions/freeciv-server index 7daa30ce..78f57afa 100644 --- a/completions/freeciv-server +++ b/completions/freeciv-server @@ -8,7 +8,7 @@ _civserver() case $prev in -f|-g|-l|-r|--file|--log|--gamelog|--read) _filedir - return 0 + return ;; esac @@ -19,4 +19,4 @@ _civserver() } && complete -F _civserver civserver freeciv-server -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/function b/completions/function index e8e4d751..fbcf10d2 100644 --- a/completions/function +++ b/completions/function @@ -6,17 +6,32 @@ _function() _init_completion || return if [[ $1 == @(declare|typeset) ]]; then - if [[ $prev == -f ]]; then - COMPREPLY=( $( compgen -A function -- "$cur" ) ) - elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + 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]} | sed -e 1,2d )" ) + COMPREPLY=( "() $( type -- ${words[1]} | command sed -e 1,2d )" ) fi } && complete -F _function function declare typeset -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fusermount b/completions/fusermount index e711e791..23671bd6 100644 --- a/completions/fusermount +++ b/completions/fusermount @@ -7,13 +7,13 @@ _fusermount() case $prev in -h|-V|-o) - return 0 + return ;; -u) COMPREPLY=( $( compgen -W "$( awk \ '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ 2>/dev/null )" -- "$cur" ) ) - return 0 + return ;; esac @@ -25,4 +25,4 @@ _fusermount() } && complete -F _fusermount fusermount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gcc b/completions/gcc index c86fd7e6..174e0718 100644 --- a/completions/gcc +++ b/completions/gcc @@ -13,7 +13,7 @@ _gcc() local cur prev words cword _init_completion || return - _expand || return 0 + _expand || return local cc backend @@ -27,6 +27,9 @@ _gcc() *77) backend=f771 ;; + *95) + backend=f951 + ;; *) backend=cc1 # (near-)universal backend ;; @@ -39,16 +42,26 @@ _gcc() # for C/C++/ObjectiveC it's useless # for FORTRAN/Java it's an error COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\ - sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) + command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir fi } && -complete -F _gcc gcc g++ g77 gcj gpc && +complete -F _gcc gcc g++ gfortran g77 g95 gcj gpc && { - cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc || : - c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || : + 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: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gcl b/completions/gcl index 385a2e06..5d1ca5f3 100644 --- a/completions/gcl +++ b/completions/gcl @@ -15,8 +15,7 @@ _gcl() _filedir fi - return 0 } && complete -F _gcl -o default gcl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gdb b/completions/gdb index 125d0b15..75414782 100644 --- a/completions/gdb +++ b/completions/gdb @@ -2,9 +2,18 @@ _gdb() { - local cur prev words cword + 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 @@ -18,7 +27,7 @@ _gdb() # names manually. IFS=":" local path_array=( $( \ - sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) ) + 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 \ @@ -34,4 +43,4 @@ _gdb() } && complete -F _gdb gdb -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/genaliases b/completions/genaliases index 32f5919a..f9a9890a 100644 --- a/completions/genaliases +++ b/completions/genaliases @@ -12,4 +12,4 @@ _genaliases() } && complete -F _genaliases genaliases -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gendiff b/completions/gendiff index 38c0828e..cb9bab39 100644 --- a/completions/gendiff +++ b/completions/gendiff @@ -3,10 +3,10 @@ _gendiff() { local cur prev words cword - _init_completion -o @(diff|patch) || return + _init_completion -o '@(diff|patch)' || return [[ $cword -eq 1 ]] && _filedir -d } && complete -F _gendiff gendiff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/genisoimage b/completions/genisoimage index 1d8f0401..caf6d457 100644 --- a/completions/genisoimage +++ b/completions/genisoimage @@ -9,20 +9,20 @@ _mkisofs() -o|-abstract|-biblio|-check-session|-copyright|-log-file| \ -root-info|-prep-boot|-*-list) _filedir - return 0 + return ;; -*-charset) COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \ help 2>&1 | tail -n +3 )' -- "$cur" ) ) - return 0 + return ;; -uid) _uids - return 0 + return ;; -gid) _gids - return 0 + return ;; esac @@ -35,4 +35,4 @@ _mkisofs() } && complete -F _mkisofs mkisofs genisoimage -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/getent b/completions/getent index 2e99f524..0658b0bb 100644 --- a/completions/getent +++ b/completions/getent @@ -26,30 +26,30 @@ _getent() case $db in passwd) - COMPREPLY=( $( compgen -u "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return ;; group) - COMPREPLY=( $( compgen -g "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return ;; services) - COMPREPLY=( $( compgen -s "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -s -- "$cur" ) ) + return ;; hosts) - COMPREPLY=( $( compgen -A hostname "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -A hostname -- "$cur" ) ) + return ;; protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) - COMPREPLY=( $( compgen -W "$( getent $db | \ + COMPREPLY=( $( compgen -W "$( $1 $db | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; aliases|shadow|gshadow) - COMPREPLY=( $( compgen -W "$( getent $db | cut -d: -f1 )" \ + COMPREPLY=( $( compgen -W "$( $1 $db | cut -d: -f1 )" \ -- "$cur" ) ) - return 0 + return ;; ethers|netgroup) return @@ -75,4 +75,4 @@ _getent() } && complete -F _getent getent -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gkrellm b/completions/gkrellm index db439ebd..cfe65429 100644 --- a/completions/gkrellm +++ b/completions/gkrellm @@ -8,27 +8,27 @@ _gkrellm() case $prev in -t|--theme) _filedir -d - return 0 + return ;; -p|--plugin) _filedir so - return 0 + return ;; -s|--server) _known_hosts_real "$cur" - return 0 + return ;; -l|--logfile) _filedir - return 0 + return ;; -g|--geometry|-c|--config|-P|--port|-d|--debug-level) # Argument required but no completions available - return 0 + return ;; -h|--help|-v|--version) # All other options are noop with these - return 0 + return ;; esac @@ -36,4 +36,4 @@ _gkrellm() } && complete -F _gkrellm gkrellm gkrellm2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gm b/completions/gm new file mode 100644 index 00000000..88c233c6 --- /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 index 458ad070..4cd24d2e 100644 --- a/completions/gnatmake +++ b/completions/gnatmake @@ -9,13 +9,13 @@ _gnatmake() 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" ) ) + -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)' @@ -23,4 +23,4 @@ _gnatmake() } && complete -F _gnatmake gnatmake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gnokii b/completions/gnokii new file mode 100644 index 00000000..95ccaeae --- /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 index 00701702..9a250419 100644 --- a/completions/gnome-mplayer +++ b/completions/gnome-mplayer @@ -36,4 +36,4 @@ _gnome_mplayer() } && complete -F _gnome_mplayer gnome-mplayer -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpasswd b/completions/gpasswd index eb5a7e48..ada12b8d 100644 --- a/completions/gpasswd +++ b/completions/gpasswd @@ -8,18 +8,18 @@ _gpasswd() case $prev in -a|--add|-d|--delete|-A|--administrators|-M|--members) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then # TODO: only -A and -M can be combined COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -g -- "$cur" ) ) } && complete -F _gpasswd gpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpg b/completions/gpg index 91436f7a..3fee3df3 100644 --- a/completions/gpg +++ b/completions/gpg @@ -8,31 +8,31 @@ _gpg() case $prev in -s|--sign|--clearsign|--decrypt-files|--load-extension) _filedir - return 0 + return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \ - sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \ - -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) - return 0 + 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 "$( gpg --list-keys 2>/dev/null | \ - sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + 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 "$( sed -ne \ + COMPREPLY+=( $( compgen -W "$( command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf )" -- "$cur" ) ) fi - return 0 + return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$(gpg --dump-options)' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) fi } && complete -F _gpg -o default gpg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpg2 b/completions/gpg2 index 3efc2dbb..66630590 100644 --- a/completions/gpg2 +++ b/completions/gpg2 @@ -8,35 +8,35 @@ _gpg2() case $prev in --homedir) _filedir -d - return 0 + return ;; -s|--sign|--clearsign|--options|--decrypt) _filedir - return 0 + return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \ - sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \ - -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) - return 0 + 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 "$( gpg2 --list-keys 2>/dev/null | \ - sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + 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 "$( sed -ne \ + COMPREPLY+=( $( compgen -W "$( command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf)" -- "$cur" ) ) fi - return 0 + return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$(gpg2 --dump-options)' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) fi } && complete -F _gpg2 -o default gpg2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gphoto2 b/completions/gphoto2 index 02ddf785..94bf0634 100644 --- a/completions/gphoto2 +++ b/completions/gphoto2 @@ -3,49 +3,52 @@ _gphoto2() { local cur prev words cword split - _init_completion -s || return + _init_completion -s -n : || return case $prev in --debug-logfile) _filedir - return 0 + return ;; --hook-script) _filedir - return 0 + return ;; --filename) _filedir - return 0 + return ;; -u|--upload-file) _filedir - return 0 + return ;; --port) - COMPREPLY=( $(compgen -W "$( gphoto2 --list-ports 2>/dev/null | \ - tail -n +4 | awk '{ print $1 }' )" -- "$cur") ) - return 0 + 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 "$( gphoto2 --list-cameras 2>/dev/null | \ - tail -n +3 | awk -F'"' '{ print $2 }' )" -- "$cur") ) - return 0 + 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 "$( gphoto2 --list-config 2>/dev/null \ + COMPREPLY=( $(compgen -W "$( $1 --list-config 2>/dev/null \ )" -- "$cur") ) - return 0 + return ;; esac + $split && return + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && complete -F _gphoto2 gphoto2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gprof b/completions/gprof index 810255a4..b9692bad 100644 --- a/completions/gprof +++ b/completions/gprof @@ -62,4 +62,4 @@ _gprof() } && complete -F _gprof gprof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupadd b/completions/groupadd index db5ff872..c5a74b7a 100644 --- a/completions/groupadd +++ b/completions/groupadd @@ -10,18 +10,17 @@ _groupadd() case $prev in -g|--gid|-K|--key|-p|--password) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _groupadd groupadd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupdel b/completions/groupdel index bf6e5c6a..91ba3583 100644 --- a/completions/groupdel +++ b/completions/groupdel @@ -2,4 +2,4 @@ complete -g groupdel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupmems b/completions/groupmems index 9c993eb7..3bb5d820 100644 --- a/completions/groupmems +++ b/completions/groupmems @@ -8,15 +8,15 @@ _groupmems() case $prev in -a|--add|-d|--delete) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -g|--group) COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 + return ;; -R|--root) _filedir -d - return 0 + return ;; esac @@ -24,4 +24,4 @@ _groupmems() } && complete -F _groupmems groupmems -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupmod b/completions/groupmod index 1a0241a7..51e23b5c 100644 --- a/completions/groupmod +++ b/completions/groupmod @@ -10,20 +10,20 @@ _groupmod() case $prev in -g|--gid|-h|--help|-n|--new-name|-p|--password) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi COMPREPLY=( $( compgen -g -- "$cur" ) ) } && complete -F _groupmod groupmod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/growisofs b/completions/growisofs index c4cb7162..04b29a55 100644 --- a/completions/growisofs +++ b/completions/growisofs @@ -7,19 +7,19 @@ _growisofs() case $prev in -version|-speed) - return 0 + return ;; -Z|-M) compopt -o nospace _dvd_devices - return 0 + return ;; /?(r)dev/*) if [[ $cur == =* ]] ; then # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero cur="${cur#=}" _filedir - return 0 + return fi ;; esac @@ -29,11 +29,11 @@ _growisofs() COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \ -- "$cur" ) ) [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace - return 0 + return fi _filedir } && complete -F _growisofs growisofs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/grpck b/completions/grpck index 0aff1439..18a53920 100644 --- a/completions/grpck +++ b/completions/grpck @@ -7,11 +7,11 @@ _grpck() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _grpck grpck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gzip b/completions/gzip index 35e5f231..8093e41e 100644 --- a/completions/gzip +++ b/completions/gzip @@ -7,11 +7,11 @@ _gzip() case $prev in -b|--blocksize|-S|--suffix|-h|--help|-V|--version) - return 0 + return ;; -p|--processes) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac @@ -19,22 +19,21 @@ _gzip() COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi local IFS=$'\n' xspec="*.@(gz|t[ag]z)" + [[ ${1##*/} == pigz ]] && xspec="*.@([gz]z|t[ag]z)" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --force ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec [[ "$prev" == -*f* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -42,4 +41,4 @@ _gzip() } && complete -F _gzip gzip pigz -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hcitool b/completions/hcitool index b650e205..38d66427 100644 --- a/completions/hcitool +++ b/completions/hcitool @@ -1,6 +1,6 @@ # bash completion for bluez utils -*- shell-script -*- -_bluetooth_adresses() +_bluetooth_addresses() { if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then COMPREPLY+=( $( compgen -W "$( hcitool scan | \ @@ -35,19 +35,19 @@ _hcitool() case $prev in -i) _bluetooth_devices - return 0 + return ;; --role) COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) ) - return 0 + return ;; --pkt-type) _bluetooth_packet_types - return 0 + return ;; esac - $split && return 0 + $split && return local arg _get_first_arg @@ -60,11 +60,12 @@ _hcitool() 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_adresses + _bluetooth_addresses fi ;; cc) @@ -73,14 +74,14 @@ _hcitool() else _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi fi ;; sr) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) ) fi @@ -88,7 +89,7 @@ _hcitool() cpt) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else _bluetooth_packet_types fi @@ -96,7 +97,7 @@ _hcitool() tpl|enc|clock) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) fi @@ -113,12 +114,12 @@ _sdptool() case $prev in --bdaddr) - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac - $split && return 0 + $split && return local arg _get_first_arg @@ -143,7 +144,7 @@ _sdptool() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) ) else - _bluetooth_adresses + _bluetooth_addresses fi ;; add) @@ -172,17 +173,17 @@ _l2ping() case $prev in -i) _bluetooth_devices - return 0 + return ;; -s|-c|-t|-d) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _bluetooth_adresses + _bluetooth_addresses fi } && complete -F _l2ping l2ping @@ -195,12 +196,12 @@ _rfcomm() case $prev in -f|--config) _filedir - return 0 + return ;; -i) _bluetooth_devices - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac @@ -214,6 +215,7 @@ _rfcomm() release' -- "$cur" ) ) fi else + local args _count_args if [[ $args -eq 2 ]]; then _bluetooth_devices @@ -221,7 +223,7 @@ _rfcomm() case $arg in connect|bind) if [[ $args -eq 3 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; esac @@ -238,8 +240,8 @@ _ciptool() case $prev in -i) _bluetooth_devices - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac @@ -253,11 +255,12 @@ _ciptool() -- "$cur" ) ) fi else + local args case $arg in connect|release|loopback) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; esac @@ -273,7 +276,7 @@ _dfutool() case $prev in -d|--device) _bluetooth_devices - return 0 + return ;; esac @@ -313,11 +316,12 @@ _hciconfig() version revision lm' -- "$cur" ) ) fi else + local args case $arg in putkey|delkey) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; lm) @@ -366,11 +370,11 @@ _hciattach() COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) ) ;; 5) - _bluetooth_adresses + _bluetooth_addresses ;; esac fi } && complete -F _hciattach hciattach -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hddtemp b/completions/hddtemp index 75641045..123b74a1 100644 --- a/completions/hddtemp +++ b/completions/hddtemp @@ -35,4 +35,4 @@ _hddtemp() } && complete -F _hddtemp hddtemp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hid2hci b/completions/hid2hci index d840166a..9221c4d0 100644 --- a/completions/hid2hci +++ b/completions/hid2hci @@ -12,4 +12,4 @@ _hid2hci() } && complete -F _hid2hci hid2hci -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hostname b/completions/hostname new file mode 100644 index 00000000..48f4222f --- /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 index 45c2c4c6..9d454622 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -8,19 +8,19 @@ _hping2() case $prev in -I|--interface) _available_interfaces - return 0 + return ;; -a|--spoof) _known_hosts_real "$cur" - return 0 + return ;; -o|--tos) COMPREPLY=( $( compgen -W '02 04 08 10' ) ) - return 0 + return ;; -E|--file) _filedir - return 0 + return ;; esac @@ -32,4 +32,4 @@ _hping2() } && complete -F _hping2 hping hping2 hping3 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/htop b/completions/htop index 7735f9b5..13c06b15 100644 --- a/completions/htop +++ b/completions/htop @@ -27,6 +27,7 @@ _htop() [[ $COMPREPLY == *= ]] && compopt -o nospace return fi -} && complete -F _htop htop +} && +complete -F _htop htop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/htpasswd b/completions/htpasswd index b0990fe1..bf3acb22 100644 --- a/completions/htpasswd +++ b/completions/htpasswd @@ -30,4 +30,4 @@ _htpasswd() } && complete -F _htpasswd htpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iconv b/completions/iconv index b33cc704..50edb4c5 100644 --- a/completions/iconv +++ b/completions/iconv @@ -8,27 +8,26 @@ _iconv() case $prev in -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ --widechar-subst) - return 0 + return ;; -f|--from-code|-t|--to-code) COMPREPLY=( $( compgen -W '$( iconv -l | \ - sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) - return 0 + command sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + return ;; -o|--output) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _iconv -o default iconv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/id b/completions/id index c985c9eb..137a5f7e 100644 --- a/completions/id +++ b/completions/id @@ -15,4 +15,4 @@ _id() } && complete -F _id id -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/idn b/completions/idn index 14e4cc1a..12f4bdd1 100644 --- a/completions/idn +++ b/completions/idn @@ -23,4 +23,4 @@ _idn() } && complete -F _idn idn -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iftop b/completions/iftop index 8c606172..831e327b 100644 --- a/completions/iftop +++ b/completions/iftop @@ -7,15 +7,15 @@ _iftop() case $prev in -h|-f|-F|-m) - return 0 + return ;; -i) _available_interfaces -a - return 0 + return ;; -c) _filedir - return 0 + return ;; esac @@ -23,4 +23,4 @@ _iftop() } && complete -F _iftop iftop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ifup b/completions/ifup index fcd34994..42cb8f80 100644 --- a/completions/ifup +++ b/completions/ifup @@ -12,8 +12,7 @@ _ifupdown() COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) fi - return 0 } && complete -F _ifupdown ifup ifdown ifstatus -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/info b/completions/info index 36550449..f71cbf5b 100644 --- a/completions/info +++ b/completions/info @@ -5,12 +5,12 @@ _info() local cur prev words cword split _init_completion -s || return - _expand || return 0 + _expand || return # default completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir - return 0 + return fi case $prev in @@ -62,14 +62,13 @@ _info() COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) # weed out info dir file for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do - [[ ${COMPREPLY[$i]} == dir ]] && unset COMPREPLY[$i] + [[ ${COMPREPLY[$i]} == dir ]] && unset "COMPREPLY[$i]" done # strip suffix from info pages COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) - return 0 } && complete -F _info info pinfo -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/inject b/completions/inject index da2d9a9e..20ea9b7f 100644 --- a/completions/inject +++ b/completions/inject @@ -8,11 +8,11 @@ _inject() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) @@ -23,4 +23,4 @@ _inject() } && complete -F _inject inject -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/insmod b/completions/insmod index 545f8bc5..ec81c93e 100644 --- a/completions/insmod +++ b/completions/insmod @@ -15,4 +15,4 @@ _insmod() } && complete -F _insmod insmod insmod.static -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/installpkg b/completions/installpkg index cdaf816c..f002f775 100644 --- a/completions/installpkg +++ b/completions/installpkg @@ -8,25 +8,26 @@ _installpkg() case "$prev" in --root) _filedir -d - return 0 + return ;; --priority) COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) - return 0 + return ;; --tagfile) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse --menu --ask --priority --tagfile' -- "$cur" ) ) - return 0 + return fi - _filedir "t[bglx]z" -} && complete -F _installpkg installpkg + _filedir 't[bglx]z' +} && +complete -F _installpkg installpkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/interdiff b/completions/interdiff index 8b07572f..cf71002e 100644 --- a/completions/interdiff +++ b/completions/interdiff @@ -30,4 +30,4 @@ _interdiff() } && complete -F _interdiff interdiff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d index d4e0d245..777f6ace 100644 --- a/completions/invoke-rc.d +++ b/completions/invoke-rc.d @@ -20,20 +20,19 @@ _invoke_rc_d() if [[ ($cword -eq 1) || ("$prev" == --* ) ]]; then valid_options=( $( \ tr " " "\n" <<<"${words[@]} ${options[@]}" \ - | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ + | 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 '`sed -e "y/|/ /" \ + COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ $sysvdir/$prev`' -- "$cur" ) ) else COMPREPLY=() fi - return 0 } && complete -F _invoke_rc_d invoke-rc.d -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ip b/completions/ip index b073c36f..00dd839d 100644 --- a/completions/ip +++ b/completions/ip @@ -14,25 +14,25 @@ _ip() case $prev in -V|-Version|-rc|-rcvbuf) - return 0 + return ;; -f|-family) COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) ) - return 0 + return ;; -b|-batch) _filedir - return 0 + return ;; -force) COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) - return 0 + return ;; esac local subcword cmd subcmd for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do - [[ ${words[subcword]} == -b?(atch) ]] && return 0 + [[ ${words[subcword]} == -b?(atch) ]] && return [[ -n $cmd ]] && subcmd=${words[subcword]} && break [[ ${words[subcword]} != -* && \ ${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \ @@ -46,21 +46,23 @@ _ip() -oneline -timestamp -batch -rcvbuf" [[ $cword -eq 1 ]] && c+=" -force" COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) - return 0 + return ;; *) - COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | \ - sed -e '/OBJECT := /,/}/!d' \ - -e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" ) ) - return 0 + 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 0 + [[ $subcmd == help ]] && return case $cmd in - link) + l|link) case $subcmd in add) # TODO @@ -120,13 +122,25 @@ _ip() esac ;; - addr) + a|addr|address) case $subcmd in add|change|replace) - # TODO + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi ;; del) - # TODO + 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 @@ -151,7 +165,11 @@ _ip() addrlabel) case $subcmd in list|add|del|flush) - # TODO + if [[ $prev == dev ]]; then + _available_interfaces + else + : # TODO + fi ;; *) [[ $cword -eq $subcword ]] && \ @@ -164,7 +182,11 @@ _ip() route) case $subcmd in list|flush) - # TODO + if [[ $prev == proto ]]; then + _iproute2_etc rt_protos + else + : # TODO + fi ;; get) # TODO @@ -275,7 +297,7 @@ _ip() esac ;; - monitor) + monitor) case $subcmd in all) ;; *) @@ -285,7 +307,7 @@ _ip() esac ;; - xfrm) + xfrm) case $subcmd in state|policy|monitor) # TODO @@ -301,4 +323,4 @@ _ip() } && complete -F _ip ip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iperf b/completions/iperf index 721825e2..4652879c 100644 --- a/completions/iperf +++ b/completions/iperf @@ -45,10 +45,10 @@ _iperf() for i in ${words[@]}; do case $i in -s|--server) - filter='sed -e /^Client.specific/,/^$/d' + filter='command sed -e /^Client.specific/,/^$/d' ;; -c|--client) - filter='sed -e /^Server.specific/,/^$/d' + filter='command sed -e /^Server.specific/,/^$/d' ;; esac done @@ -60,4 +60,4 @@ _iperf() } && complete -F _iperf iperf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipmitool b/completions/ipmitool index 281d9eac..8e2637c7 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -3,7 +3,7 @@ _ipmitool_singleline_help() { COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ - sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) + command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) } _ipmitool() @@ -13,53 +13,53 @@ _ipmitool() case $prev in -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l) - return 0 + return ;; -d) COMPREPLY=( $( compgen -W "$( \ command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ - 2>/dev/null | sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ + 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; -I) COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \ - sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ + command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; -H) _known_hosts_real "$cur" - return 0 + return ;; -f|-S|-O) _filedir - return 0 + return ;; -C) COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) ) - return 0 + return ;; -L) COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ -- "$cur" ) ) - return 0 + return ;; -A) COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) ) - return 0 + return ;; -o) COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \ awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h)' -- "$cur" ) ) - return 0 + return fi # Find out command and subcommand @@ -77,7 +77,7 @@ _ipmitool() if [[ -z $cmd ]]; then COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) - return 0 + return fi # Command/subcommand completions @@ -197,4 +197,4 @@ _ipmitool() } && complete -F _ipmitool ipmitool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipsec b/completions/ipsec index b1161b0a..357d5055 100644 --- a/completions/ipsec +++ b/completions/ipsec @@ -7,7 +7,7 @@ _ipsec_connections() { local keyword name while read -r keyword name; do - if [[ $keyword = [#]* ]]; then continue; fi + if [[ $keyword == [#]* ]]; then continue; fi [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=( "$name" ) done COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) @@ -22,7 +22,7 @@ _ipsec_freeswan() COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp tncfg whack' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -45,8 +45,6 @@ _ipsec_freeswan() *) ;; esac - - return 0 } _ipsec_strongswan() @@ -64,7 +62,7 @@ _ipsec_strongswan() scencrypt scepclient secrets start starter status statusall stop stroke unroute uci up update version whack --confdir --copyright --directory --help --version --versioncode' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -91,8 +89,6 @@ _ipsec_strongswan() *) ;; esac - - return 0 } case "$( ipsec --version 2>/dev/null )" in @@ -104,4 +100,4 @@ case "$( ipsec --version 2>/dev/null )" in ;; esac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iptables b/completions/iptables index 0d54afbd..0ecb1ebd 100644 --- a/completions/iptables +++ b/completions/iptables @@ -18,7 +18,7 @@ _iptables() case $prev in -*[AIDRPFXLZ]) COMPREPLY=( $( compgen -W '`iptables $table -nL | \ - sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) + command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) ;; -*t) COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) @@ -26,17 +26,17 @@ _iptables() -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT - `iptables $table -nL | sed -ne "$chain" \ + `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 | \ - sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ + 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 | sed -ne "$chain" \ + `iptables $table -nL | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ "$cur" ) ) fi @@ -57,4 +57,4 @@ _iptables() } && complete -F _iptables iptables -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipv6calc b/completions/ipv6calc index 5db7271f..0dacff94 100644 --- a/completions/ipv6calc +++ b/completions/ipv6calc @@ -7,25 +7,25 @@ _ipv6calc() case "$prev" in -d|--debug) - return 0 + return ;; -I|--in|-O|--out|-A|--action) # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. - COMPREPLY=( $( compgen -W "$( ipv6calc "$prev" -h 2>&1 | \ - sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ + COMPREPLY=( $( compgen -W "$( $1 "$prev" -h 2>&1 | \ + command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6) _filedir - return 0 + return ;; --printstart|--printend) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --debug --quiet --in --out --action @@ -35,11 +35,9 @@ _ipv6calc() --masksuffix --printstart --printend --printcompressed --printuncompressed --printfulluncompressed --printmirrored' \ -- "$cur" ) ) - return 0 fi - return 0 } && complete -F _ipv6calc ipv6calc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iscsiadm b/completions/iscsiadm index 326dc208..e5218d75 100644 --- a/completions/iscsiadm +++ b/completions/iscsiadm @@ -9,23 +9,23 @@ _iscsiadm() -m|--mode) COMPREPLY=( $( compgen -W 'discovery node session iface fw host' \ -- "$cur" ) ) - return 0 + return ;; -o|--op) COMPREPLY=( $( compgen -W 'new delete update show' -- "$cur" ) ) - return 0 + return ;; -t|--type) COMPREPLY=( $( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) ) - return 0 + return ;; -L|-U|--loginall|--logoutall) COMPREPLY=( $( compgen -W 'all manual automatic' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return local options if [[ $cword -gt 1 ]] ; then @@ -63,4 +63,4 @@ _iscsiadm() } && complete -F _iscsiadm iscsiadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/isql b/completions/isql index 43cd6dd3..862a9304 100644 --- a/completions/isql +++ b/completions/isql @@ -7,8 +7,8 @@ _isql() _init_completion || return [[ -f $ODBCINI ]] \ - && COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) ) + && COMPREPLY=( $( command grep "\[$cur" "$ODBCINI" | tr -d \[\] ) ) } && complete -F _isql isql -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwconfig b/completions/iwconfig index 36213d2c..114081dd 100644 --- a/completions/iwconfig +++ b/completions/iwconfig @@ -9,7 +9,7 @@ _iwconfig() mode) COMPREPLY=( $( compgen -W 'managed ad-hoc master repeater secondary monitor' -- "$cur" ) ) - return 0 + return ;; essid) COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) @@ -18,22 +18,22 @@ _iwconfig() "$( iwlist ${words[1]} scan | \ awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) ) fi - return 0 + return ;; nwid) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; channel) COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) ) - return 0 + return ;; freq) COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) ) - return 0 + return ;; ap) COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) @@ -42,34 +42,34 @@ _iwconfig() "$( iwlist ${words[1]} scan | \ awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) ) fi - return 0 + return ;; rate) COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) ) COMPREPLY+=( $( compgen -W \ "$( iwlist ${words[1]} rate | \ awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) ) - return 0 + return ;; rts|frag) COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) ) - return 0 + return ;; key|enc) COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) ) - return 0 + return ;; power) COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) ) - return 0 + return ;; txpower) COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) ) - return 0 + return ;; retry) COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) ) - return 0 + return ;; esac @@ -87,4 +87,4 @@ _iwconfig() } && complete -F _iwconfig iwconfig -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwlist b/completions/iwlist index 78c15b71..b27dbe8b 100644 --- a/completions/iwlist +++ b/completions/iwlist @@ -19,4 +19,4 @@ _iwlist() } && complete -F _iwlist iwlist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwpriv b/completions/iwpriv index 05952c5e..c7f8209e 100644 --- a/completions/iwpriv +++ b/completions/iwpriv @@ -8,11 +8,11 @@ _iwpriv() case $prev in roam) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; port) COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) - return 0 + return ;; esac @@ -28,4 +28,4 @@ _iwpriv() } && complete -F _iwpriv iwpriv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwspy b/completions/iwspy index b59b0693..1cf3a283 100644 --- a/completions/iwspy +++ b/completions/iwspy @@ -17,4 +17,4 @@ _iwspy() } && complete -F _iwspy iwspy -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jar b/completions/jar index 8af86a17..b7de930f 100644 --- a/completions/jar +++ b/completions/jar @@ -7,7 +7,7 @@ _jar() if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -24,4 +24,4 @@ _jar() } && complete -F _jar jar -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jarsigner b/completions/jarsigner index c1c72af7..2441bd1a 100644 --- a/completions/jarsigner +++ b/completions/jarsigner @@ -9,23 +9,24 @@ _jarsigner() -keystore) COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) _filedir '@(jks|ks|p12|pfx)' - return 0 + return ;; - -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-altsigner|\ - -altsignerpath|-providerName|-providerClass|-providerArg) - return 0 + -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 0 + return ;; -signedjar) _filedir jar - return 0 - ;; - -tsa) - _filedir - return 0 + return ;; esac @@ -53,4 +54,4 @@ _jarsigner() } && complete -F _jarsigner jarsigner -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/java b/completions/java index c302d1e5..7d1cf1fe 100644 --- a/completions/java +++ b/completions/java @@ -71,9 +71,9 @@ _java_classes() elif [[ -d $i ]]; then COMPREPLY+=( - $( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" ) + $( compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|" ) $( compgen -f -X '!*.class' -- "$i/$cur" | \ - sed -e '/\$/d' -e "s|^$i/||" ) + command sed -e '/\$/d' -e "s|^$i/||" ) ) [[ $COMPREPLY == *.class ]] || compopt -o nospace @@ -103,7 +103,7 @@ _java_packages() for i in ${sourcepath//:/ }; do if [[ -d $i ]]; then COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \ - sed -e 's|^'$i'/||' ) ) + command sed -e 's|^'$i'/||' ) ) fi done # keep only packages @@ -134,7 +134,7 @@ _java() *) # once we've seen a class, just do filename completion _filedir - return 0 + return ;; esac done @@ -143,70 +143,70 @@ _java() # standard option completions -verbose:*) COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) ) - return 0 + return ;; -javaagent:*) cur=${cur#*:} _filedir '@(jar|zip)' - return 0 + return ;; -agentpath:*) cur=${cur#*:} _filedir so - return 0 + return ;; # various non-standard option completions -splash:*) cur=${cur#*:} _filedir '@(gif|jp?(e)g|png)' - return 0 + return ;; -Xbootclasspath*:*) _java_path - return 0 + return ;; -Xcheck:*) COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) ) - return 0 + return ;; -Xgc:*) COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \ -- "${cur#*:}" ) ) - return 0 + return ;; -Xgcprio:*) COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \ -- "${cur#*:}" ) ) - return 0 + return ;; -Xloggc:*|-Xverboselog:*) cur=${cur#*:} _filedir - return 0 + return ;; -Xshare:*) COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) ) - return 0 + return ;; -Xverbose:*) COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt gcpause gcreport' -- "${cur#*:}" ) ) - return 0 + return ;; -Xverify:*) COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) ) - return 0 + return ;; # the rest that we have no completions for -D*|-*:*) - return 0 + return ;; esac case $prev in -cp|-classpath) _java_path - return 0 + return ;; esac @@ -238,19 +238,29 @@ _javadoc() case $prev in -overview|-helpfile) _filedir '?(x)htm?(l)' - return 0 + return + ;; + -doclet|-exclude|-subpackages|-source|-locale|-encoding|-windowtitle|\ + -doctitle|-header|-footer|-top|-bottom|-group|-noqualifier|-tag|\ + -charset|-sourcetab|-docencoding) + return ;; -stylesheetfile) _filedir css - return 0 + return ;; -d|-link|-linkoffline) _filedir -d - return 0 + return ;; - -classpath|-bootclasspath|-docletpath|-sourcepath|-extdirs) + -classpath|-cp|-bootclasspath|-docletpath|-sourcepath|-extdirs|\ + -excludedocfilessubdir) _java_path - return 0 + return + ;; + -helpfile) + _filedir + return ;; esac @@ -279,11 +289,11 @@ _javac() case $prev in -d) _filedir -d - return 0 + return ;; - -classpath|-bootclasspath|-sourcepath|-extdirs) + -cp|-classpath|-bootclasspath|-sourcepath|-extdirs) _java_path - return 0 + return ;; esac @@ -294,7 +304,7 @@ _javac() # 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 | sed -e 's/-g:none/-g:{none}/' -ne \ + 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 @@ -315,4 +325,4 @@ _javac() } && complete -F _javac javac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/javaws b/completions/javaws index b9afefd7..7d6e22c8 100644 --- a/completions/javaws +++ b/completions/javaws @@ -7,28 +7,28 @@ _javaws() case $prev in -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) - return 0 + return ;; -basedir|-codebase) _filedir -d - return 0 + return ;; -uninstall|-import) _filedir jnlp - return 0 + return ;; esac if [[ $cur == *= ]]; then - return 0 + return elif [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi _filedir jnlp } && complete -F _javaws javaws -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jpegoptim b/completions/jpegoptim new file mode 100644 index 00000000..754f16a2 --- /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 index 774ad6ce..42f8d1a5 100644 --- a/completions/jps +++ b/completions/jps @@ -22,4 +22,4 @@ _jps() } && complete -F _jps jps -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jshint b/completions/jshint new file mode 100644 index 00000000..ea9bbeb5 --- /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 index 9c03642f..2cbcbb1b 100644 --- a/completions/k3b +++ b/completions/k3b @@ -7,32 +7,32 @@ _k3b() case $prev in --help*|--author|-v|--version|--license|--lang) - return 0 + return ;; --datacd|--audiocd|--videocd|--mixedcd|--emovixcd|--videodvd) _filedir - return 0 + return ;; --copydvd|--formatdvd|--videodvdrip) _dvd_devices - return 0 + return ;; --copycd|--erasecd|--cddarip|--videocdrip) _cd_devices _dvd_devices - return 0 + return ;; --cdimage|--image) - _filedir @(cue|iso|toc) - return 0 + _filedir '@(cue|iso|toc)' + return ;; --dvdimage) _filedir iso - return 0 + return ;; --ao) COMPREPLY=( $( compgen -W 'alsa arts' -- "$cur" ) ) - return 0 + return ;; esac @@ -45,4 +45,4 @@ _k3b() } && complete -F _k3b k3b -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kcov b/completions/kcov index 86d2d10c..7e9aa1e0 100644 --- a/completions/kcov +++ b/completions/kcov @@ -3,7 +3,7 @@ _kcov() { local cur prev words cword split - _init_completion -s || return + _init_completion -s -n : || return case "$prev" in --pid|-p) @@ -11,25 +11,31 @@ _kcov() return ;; --sort-type|-s) - COMPREPLY=( $( compgen -W 'filename percentage lines uncovered' \ - -- "$cur" ) ) + 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) - split=false if [[ "$cur" == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" - split=true - fi - COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) - if $split; then - COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) + COMPREPLY=( $( compgen -P "$prev," -W "{0..100}" -- "$cur" ) ) else + COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) compopt -o nospace fi return @@ -49,6 +55,7 @@ _kcov() fi _filedir -} && complete -F _kcov kcov +} && +complete -F _kcov kcov -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kill b/completions/kill index ed5ae585..ac179cd9 100644 --- a/completions/kill +++ b/completions/kill @@ -26,4 +26,4 @@ _kill() } && complete -F _kill kill -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/killall b/completions/killall index ed502f97..6d1532c3 100644 --- a/completions/killall +++ b/completions/killall @@ -33,4 +33,4 @@ _killall() } && complete -F _killall killall -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kldload b/completions/kldload index f362db69..0442e95e 100644 --- a/completions/kldload +++ b/completions/kldload @@ -15,8 +15,7 @@ _kldload() COMPREPLY=( ${COMPREPLY[@]#$moddir} ) COMPREPLY=( ${COMPREPLY[@]%.ko} ) - return 0 } && complete -F _kldload kldload -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kldunload b/completions/kldunload index adb268d8..82770189 100644 --- a/completions/kldunload +++ b/completions/kldunload @@ -7,9 +7,9 @@ _kldunload() local cur prev words cword _init_completion || return - COMPREPLY=( $( kldstat | \ - sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) + COMPREPLY=( $( kldstat | command sed -ne \ + "s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) } && complete -F _kldunload kldunload -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/koji b/completions/koji index bd6cb2fd..30b8d49a 100644 --- a/completions/koji +++ b/completions/koji @@ -244,4 +244,4 @@ _koji() } && complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ktutil b/completions/ktutil index 88eb5275..384db329 100644 --- a/completions/ktutil +++ b/completions/ktutil @@ -29,27 +29,27 @@ _ktutil() case $prev in -p|--principal) _heimdal_principals - return 0 + return ;; -e|--enctype) _heimdal_encodings - return 0 + return ;; -a|--admin-server) _known_hosts_real "$cur" - return 0 + return ;; -r|--realm) _heimdal_realms - return 0 + return ;; -s|-k|--srvtab|--keytab) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return commands='add change copy get list remove rename purge srvconvert srv2keytab srvcreate key2srvtab' @@ -117,4 +117,4 @@ _ktutil() } && complete -F _ktutil ktutil -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/larch b/completions/larch index 79716a5f..5b7ebd14 100644 --- a/completions/larch +++ b/completions/larch @@ -33,8 +33,7 @@ _larch() "$cur" ) ) fi - return 0 } && complete -F _larch -o default larch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lastlog b/completions/lastlog index a8724029..4ac6b520 100644 --- a/completions/lastlog +++ b/completions/lastlog @@ -7,19 +7,19 @@ _lastlog() case $prev in -b|--before|-h|--help|-t|--time) - return 0 + return ;; -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _lastlog lastlog -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ldapsearch b/completions/ldapsearch index 6a9b7b1b..282760f7 100644 --- a/completions/ldapsearch +++ b/completions/ldapsearch @@ -18,32 +18,32 @@ _ldapsearch() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -T) _filedir -d - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -s) COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) ) - return 0 + return ;; -a) COMPREPLY=( $( compgen -W 'never always search find' \ -- "$cur" ) ) - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -61,19 +61,19 @@ _ldapaddmodify() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -S|-f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -91,19 +91,19 @@ _ldapdelete() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -121,19 +121,19 @@ _ldapcompare() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -151,19 +151,19 @@ _ldapmodrdn() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -181,19 +181,19 @@ _ldapwhoami() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -211,15 +211,15 @@ _ldappasswd() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -t|-T|-y) _filedir - return 0 + return ;; esac @@ -229,4 +229,4 @@ _ldappasswd() } && complete -F _ldappasswd ldappasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ldapvi b/completions/ldapvi index 9c9b6491..e3c1f103 100644 --- a/completions/ldapvi +++ b/completions/ldapvi @@ -8,37 +8,37 @@ _ldapvi() case $prev in -h|--host) _known_hosts_real "$cur" - return 0 + return ;; -Y|--sasl-mech) COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) ) - return 0 + return ;; --bind) COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) ) - return 0 + return ;; --bind-dialog) COMPREPLY=( $( compgen -W 'never auto always' -- "$cur" ) ) - return 0 + return ;; --scope) COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) ) - return 0 + return ;; --deref) COMPREPLY=( $( compgen -W 'never searching finding always' \ -- "$cur" ) ) - return 0 + return ;; --encoding) COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) ) - return 0 + return ;; --tls) COMPREPLY=( $( compgen -W 'never allow try strict' -- "$cur" ) ) - return 0 + return ;; esac @@ -48,4 +48,4 @@ _ldapvi() } && complete -F _ldapvi ldapvi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lftp b/completions/lftp index 86706002..edb363b2 100644 --- a/completions/lftp +++ b/completions/lftp @@ -8,16 +8,16 @@ _lftp() case $prev in -f) _filedir - return 0 + return ;; -c|-h|--help|-v|--version|-e|-u|-p) - return 0 + return ;; esac if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -W \ @@ -26,4 +26,4 @@ _lftp() } && complete -F _lftp lftp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lftpget b/completions/lftpget index 88ab31f6..8f1d4a2f 100644 --- a/completions/lftpget +++ b/completions/lftpget @@ -11,4 +11,4 @@ _lftpget() } && complete -F _lftpget lftpget -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lilo b/completions/lilo index 3073183c..1ccca35c 100644 --- a/completions/lilo +++ b/completions/lilo @@ -3,7 +3,7 @@ _lilo_labels() { COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ - /etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) ) + /etc/lilo.conf | command sed -e 's/\"//g' )" -- "$cur" ) ) } _lilo() @@ -14,28 +14,28 @@ _lilo() case $prev in -C|-i|-m|-s|-S) _filedir - return 0 + return ;; -r) _filedir -d - return 0 + return ;; -I|-D|-R) # label completion _lilo_labels - return 0 + return ;; -A|-b|-M|-u|-U) # device completion cur=${cur:=/dev/} _filedir - return 0 + return ;; -T) # topic completion COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= table= video' -- "$cur" ) ) - return 0 + return ;; esac @@ -47,4 +47,4 @@ _lilo() } && complete -F _lilo lilo -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/links b/completions/links index abb19900..8c72970e 100644 --- a/completions/links +++ b/completions/links @@ -23,12 +23,11 @@ _links() -- "$cur" ) ) fi _filedir '@(htm|html)' - return 0 + return ;; esac - return 0 } && complete -F _links links -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lintian b/completions/lintian index 1c9eaa6e..e62a6265 100644 --- a/completions/lintian +++ b/completions/lintian @@ -4,13 +4,13 @@ _lintian_tags() { local match search tags - tags=$( grep -e ^Tag /usr/share/lintian/checks/*.desc | cut -d\ -f2 ) + tags=$( awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$(grep -nE "^Tag: $item$" /usr/share/lintian/checks/*.desc \ - | cut -d: -f1 ) - tags=$( sed -e "s/\<$item\>//g" <<<$tags ) + 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 @@ -18,24 +18,22 @@ _lintian_tags() else COMPREPLY+=( $(compgen -W "$tags" -- "$cur") ) fi - return 0 } _lintian_checks() { local match search todisable checks - checks=$(grep -e ^Check-Script -e ^Abbrev \ - /usr/share/lintian/checks/*.desc | cut -d\ -f2 ) + checks=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' \ + /usr/share/lintian/checks/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$(grep -nE "^(Check-Script|Abbrev): $item$" \ - /usr/share/lintian/checks/*.desc | cut -d: -f1 ) - todisable=$(grep -e ^Check-Script -e ^Abbrev $match | \ - cut -d\ -f2 ) + 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=$( sed -e "s/\<$name\>//g" <<<$checks ) + checks=$( command sed -e "s/\<$name\>//g" <<<$checks ) done done COMPREPLY+=( $(compgen -W "$checks") ) @@ -44,21 +42,20 @@ _lintian_checks() else COMPREPLY+=( $(compgen -W "$checks" -- "$cur") ) fi - return 0 } _lintian_infos() { local match search infos - infos=$(grep -e ^Collector /usr/share/lintian/collection/*.desc \ - | cut -d\ -f2 ) + infos=$( awk '/^Collector/ { print $2 }' \ + /usr/share/lintian/collection/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$( grep -nE "^Collector: $item$" \ - /usr/share/lintian/collection/*.desc | cut -d: -f1 ) - infos=$( sed -e "s/\<$item\>//g" <<<$infos ) + 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 @@ -66,12 +63,6 @@ _lintian_infos() else COMPREPLY+=( $(compgen -W "$infos" -- "$cur") ) fi - return 0 -} - -_lintian_arches() -{ - return 0 } _lintian() @@ -94,7 +85,7 @@ _lintian() --root" selection_opts="--all --binary --source --udeb --packages-file" - if [[ "$prev" = -* ]]; then + if [[ "$prev" == -* ]]; then case $prev in -C|--check-part|-X|--dont-check-part) _lintian_checks @@ -176,4 +167,4 @@ _lintian_info() } && complete -F _lintian_info lintian-info -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lisp b/completions/lisp index 45cd4e6f..279ffcdb 100644 --- a/completions/lisp +++ b/completions/lisp @@ -16,8 +16,7 @@ _lisp() _filedir fi - return 0 } && complete -F _lisp -o default lisp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_admins b/completions/list_admins index 6c05a7d3..06542f91 100644 --- a/completions/list_admins +++ b/completions/list_admins @@ -14,4 +14,4 @@ _list_admins() } && complete -F _list_admins list_admins -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_lists b/completions/list_lists index 04471e1e..629e4c07 100644 --- a/completions/list_lists +++ b/completions/list_lists @@ -18,4 +18,4 @@ _list_lists() } && complete -F _list_lists list_lists -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_members b/completions/list_members index d432b36c..e60f61da 100644 --- a/completions/list_members +++ b/completions/list_members @@ -8,20 +8,20 @@ _list_members() case $prev in -o|--output) _filedir - return 0 + return ;; -d|--digest) COMPREPLY=( $( compgen -W 'mime plain' -- "$cur" ) ) - return 0 + return ;; -n|--nomail) COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--output --regular --digest --nomail @@ -33,4 +33,4 @@ _list_members() } && complete -F _list_members list_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_owners b/completions/list_owners index a780265b..88b25bb3 100644 --- a/completions/list_owners +++ b/completions/list_owners @@ -15,4 +15,4 @@ _list_owners() } && complete -F _list_owners list_owners -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lpq b/completions/lpq index d667713e..b02705af 100644 --- a/completions/lpq +++ b/completions/lpq @@ -8,21 +8,21 @@ _lpq() case $prev in -P) COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) - return 0 + return ;; -U) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == - ]]; then COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _lpq lpq -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lpr b/completions/lpr index 35ddd625..b1515bd5 100644 --- a/completions/lpr +++ b/completions/lpr @@ -8,26 +8,26 @@ _lpr() case $prev in -P) COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) - return 0 + return ;; -U) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + 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 0 + return ;; esac if [[ "$cur" == - ]]; then COMPREPLY=( $( compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _lpr lpr -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lrzip b/completions/lrzip index d4106fb2..f8e2cf1c 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -8,39 +8,39 @@ _lrzip() local xspec="*.lrz" case $prev in - -w|-S|-V|-h|-'?') - return 0 + -w|-S|-V|-h|-'?'|-m) + return ;; -d) xspec="!"$xspec ;; -o) _filedir - return 0 + return ;; -O) _filedir -d - return 0 + return ;; -L) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; -N) COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) ) - return 0 + return ;; -p) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac - _expand || return 0 + _expand || return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' @@ -50,4 +50,4 @@ _lrzip() } && complete -F _lrzip lrzip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lsof b/completions/lsof index 6ff7786c..329946d5 100644 --- a/completions/lsof +++ b/completions/lsof @@ -7,38 +7,38 @@ _lsof() case $prev in -'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T) - return 0 + return ;; -A|-k|-m|+m|-o) _filedir - return 0 + return ;; +d|+D) _filedir -d - return 0 + return ;; -D) COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) ) - return 0 + return ;; -f) COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) ) - return 0 + return ;; -g) # TODO: handle ^foo exclusions, comma separated lists _pgids - return 0 + return ;; -p) # TODO: handle ^foo exclusions, comma separated lists _pids - return 0 + return ;; -u) # TODO: handle ^foo exclusions, comma separated lists COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac @@ -46,11 +46,11 @@ _lsof() 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 0 + return fi _filedir } && complete -F _lsof lsof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lua b/completions/lua index 83dc7368..9413319e 100644 --- a/completions/lua +++ b/completions/lua @@ -20,4 +20,4 @@ _lua() } && complete -F _lua lua -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luac b/completions/luac index a0330735..9c91f25a 100644 --- a/completions/luac +++ b/completions/luac @@ -24,4 +24,4 @@ _luac() } && complete -F _luac luac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luseradd b/completions/luseradd index e5b00c3c..41769b00 100644 --- a/completions/luseradd +++ b/completions/luseradd @@ -37,4 +37,4 @@ _luseradd() } && complete -F _luseradd luseradd lusermod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luserdel b/completions/luserdel index 05faaac2..83e1818b 100644 --- a/completions/luserdel +++ b/completions/luserdel @@ -20,4 +20,4 @@ _luserdel() } && complete -F _luserdel luserdel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lvm b/completions/lvm index ba0720ed..fb83a3fb 100644 --- a/completions/lvm +++ b/completions/lvm @@ -1,26 +1,38 @@ # bash completion for lvm -*- shell-script -*- +_lvm_filedir() +{ + cur=${cur:-/dev/} + _filedir +} + _lvm_volumegroups() { COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ - sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) + 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 | \ - sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) } _lvm_logicalvolumes() { COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ - sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) + 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] + [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' done fi } @@ -85,18 +97,18 @@ _pvs() -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 0 + return ;; --units) _lvm_units - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvs pvs @@ -109,14 +121,14 @@ _pvdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvdisplay pvdisplay @@ -129,14 +141,14 @@ _pvchange() case $prev in -A|-x|--autobackup|--allocatable) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvchange pvchange @@ -149,26 +161,26 @@ _pvcreate() case $prev in --restorefile) _filedir - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; --metadatacopies) COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) - return 0 + return ;; --metadatasize|--setphysicalvolumesize) _lvm_sizes - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_filedir fi } && complete -F _pvcreate pvcreate @@ -181,11 +193,11 @@ _pvmove() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_logicalvolumes - return 0 + return esac if [[ "$cur" == -* ]]; then @@ -206,7 +218,7 @@ _pvremove() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvremove pvremove @@ -233,11 +245,11 @@ _vgs() 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 0 + return ;; --units) _lvm_units - return 0 + return ;; esac @@ -257,7 +269,7 @@ _vgdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac @@ -277,7 +289,7 @@ _vgchange() case $prev in -a|-A|-x|--available|--autobackup|--resizeable) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -300,15 +312,15 @@ _vgcreate() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; -s|--physicalextentsize) _lvm_sizes - return 0 + return ;; esac @@ -318,11 +330,11 @@ _vgcreate() --physicalextentsize --test --verbose --version' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize) + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi fi } && @@ -349,7 +361,7 @@ _vgrename() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -369,7 +381,7 @@ _vgreduce() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -378,7 +390,7 @@ _vgreduce() else local args - _lvm_count_args @(-A|--autobackup) + _lvm_count_args '@(-A|--autobackup)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else @@ -396,11 +408,11 @@ _vgextend() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -408,11 +420,11 @@ _vgextend() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi fi } && @@ -452,15 +464,15 @@ _vgconvert() case $prev in -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; --metadatacopies) COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) - return 0 + return ;; --metadatasize) _lvm_sizes - return 0 + return ;; esac @@ -480,7 +492,7 @@ _vgcfgbackup() case $prev in -f|--file) _filedir - return 0 + return ;; esac @@ -500,15 +512,15 @@ _vgcfgrestore() case $prev in -f|--file) _filedir - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_volumegroups - return 0 + return ;; esac @@ -528,7 +540,7 @@ _vgmerge() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -548,11 +560,11 @@ _vgsplit() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; esac @@ -561,7 +573,7 @@ _vgsplit() --metadatatype --test --verbose --version' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-M|--metadatatype) + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' if [[ $args -eq 0 || $args -eq 1 ]]; then _lvm_volumegroups else @@ -605,11 +617,11 @@ _lvs() 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 0 + return ;; --units) _lvm_units - return 0 + return ;; esac @@ -629,7 +641,7 @@ _lvdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac @@ -649,11 +661,11 @@ _lvchange() case $prev in -a|-A|-C|-M|--available|--autobackup|--contiguous|--persistent) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -p|--permission) COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) - return 0 + return ;; esac @@ -673,19 +685,19 @@ _lvcreate() case $prev in -A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; -p|--permission) COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_logicalvolumes - return 0 + return ;; esac @@ -693,7 +705,7 @@ _lvcreate() 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) + _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 @@ -711,7 +723,7 @@ _lvremove() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -731,7 +743,7 @@ _lvrename() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -751,11 +763,11 @@ _lvreduce() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -775,11 +787,11 @@ _lvresize() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -787,7 +799,7 @@ _lvresize() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_logicalvolumes else @@ -805,11 +817,11 @@ _lvextend() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -817,7 +829,7 @@ _lvextend() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_logicalvolumes else @@ -841,118 +853,17 @@ _lvm() vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan vgsplit version' -- "$cur" ) ) else - case ${words[1]} in - pvchange) - _pvchange - ;; - pvcreate) - _pvcreate - ;; - pvdisplay) - _pvdisplay - ;; - pvmove) - _pvmove - ;; - pvremove) - _pvremove - ;; - pvresize) - _pvresize - ;; - pvs) - _pvs - ;; - pvscan) - _pvscan - ;; - vgcfgbackup) - _vgcfgbackup - ;; - vgcfgrestore) - _vgcfgrestore - ;; - vgchange) - _vgchange - ;; - vgck) - _vgck - ;; - vgconvert) - _vgconvert - ;; - vgcreate) - _vgcreate - ;; - vgdisplay) - _vgdisplay - ;; - vgexport) - _vgexport - ;; - vgextend) - _vgextend - ;; - vgimport) - _vgimport - ;; - vgmerge) - _vgmerge - ;; - vgmknodes) - _vgmknodes - ;; - vgreduce) - _vgreduce - ;; - vgremove) - _vgremove - ;; - vgrename) - _vgrename - ;; - vgs) - _vgs - ;; - vgscan) - _vgscan - ;; - vgsplit) - _vgsplit - ;; - lvchange) - _lvchange - ;; - lvcreate) - _lvcreate - ;; - lvdisplay) - _lvdisplay - ;; - lvextend) - _lvextend - ;; - lvreduce) - _lvreduce - ;; - lvremove) - _lvremove - ;; - lvrename) - _lvrename - ;; - lvresize) - _lvresize - ;; - lvs) - _lvs - ;; - lvscan) - _lvscan + 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: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lz4 b/completions/lz4 new file mode 100644 index 00000000..56602ca2 --- /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 index ae35b9d4..c1aab4a8 100644 --- a/completions/lzip +++ b/completions/lzip @@ -46,4 +46,4 @@ _lzip() } && complete -F _lzip clzip lzip pdlzip plzip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lzma b/completions/lzma index 30566ed0..74dac25c 100644 --- a/completions/lzma +++ b/completions/lzma @@ -11,22 +11,20 @@ _lzma() --help --decompress --compress --keep --force --suffix --test --stdout --quiet --verbose --license --list --version --small --fast --best --text' -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' xspec="*.@(lzma|tlz)" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --compress ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*z* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -34,4 +32,4 @@ _lzma() } && complete -F _lzma lzma -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lzop b/completions/lzop index e23d5410..f6753529 100644 --- a/completions/lzop +++ b/completions/lzop @@ -8,14 +8,14 @@ _lzop() case $prev in -o|--output) _filedir - return 0 + return ;; --path) _filedir -d - return 0 + return ;; -S|--suffix) - return 0 + return ;; esac @@ -27,7 +27,7 @@ _lzop() --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose --no-stdin --filter --checksum --no-color --mono --color' \ -- "$cur" ) ) - return 0 + return fi local xspec="*.?(t)lzo" @@ -48,7 +48,7 @@ _lzop() ;; esac - _expand || return 0 + _expand || return local IFS=$'\n' compopt -o filenames @@ -57,4 +57,4 @@ _lzop() } && complete -F _lzop lzop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/macof b/completions/macof index 264f1c9d..dacae2fd 100644 --- a/completions/macof +++ b/completions/macof @@ -8,7 +8,7 @@ _macof() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -20,4 +20,4 @@ _macof() } && complete -F _macof macof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mailmanctl b/completions/mailmanctl index 5e6ed2ee..717df7b9 100644 --- a/completions/mailmanctl +++ b/completions/mailmanctl @@ -15,4 +15,4 @@ _mailmanctl() } && complete -F _mailmanctl mailmanctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/make b/completions/make index b4ad9e73..1075b37a 100644 --- a/completions/make +++ b/completions/make @@ -1,13 +1,12 @@ # bash completion for GNU make -*- shell-script -*- -function _make_target_extract_script() +_make_target_extract_script() { local mode="$1" shift local prefix="$1" - local prefix_pat=$( printf "%s\n" "$prefix" | \ - sed 's/[][\,.*^$(){}?+|/]/\\&/g' ) + local prefix_pat=$( command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix" ) local basename=${prefix##*/} local dirname_len=$(( ${#prefix} - ${#basename} )) @@ -20,51 +19,63 @@ function _make_target_extract_script() fi cat <<EOF - /^# Make data base/,/^# Files/d # skip until files section - /^# Not a target/,/^$/ d # skip not target blocks - /^${prefix_pat}/,/^$/! d # skip anything user dont want + 1,/^# * Make data base/ d; # skip any makefile output + /^# * Finished Make data base/,/^# * Make data base/{ + d; # skip any makefile output + } + /^# * Variables/,/^# * Files/ d; # skip until files section + /^# * Not a target/,/^$/ d; # skip not target blocks + /^${prefix_pat}/,/^$/! d; # skip anything user dont want # The stuff above here describes lines that are not # explicit targets or not targets other than special ones # The stuff below here decides whether an explicit target # should be output. - /^# File is an intermediate prerequisite/ { - s/^.*$//;x # unhold target - d # delete line + /^# * File is an intermediate prerequisite/ { + s/^.*$//;x; # unhold target + d; # delete line } /^$/ { # end of target block - x # unhold target - /^$/d # dont print blanks - s,^(.{${dirname_len}})(.{${#basename}}[^:/]*/?)[^:]*:.*$,${output},p - d # hide any bugs + x; # unhold target + /^$/d; # dont print blanks + s|^\(.\{${dirname_len}\}\)\(.\{${#basename}\}[^:/]*/\{0,1\}\)[^:]*:.*$|${output}|p; + d; # hide any bugs } - /^[^#\t:%]+:/ { # found target block - - /^\.PHONY:/ d # special target - /^\.SUFFIXES:/ d # special target - /^\.DEFAULT:/ d # special target - /^\.PRECIOUS:/ d # special target - /^\.INTERMEDIATE:/ d # special target - /^\.SECONDARY:/ d # special target - /^\.SECONDEXPANSION:/ d # special target - /^\.DELETE_ON_ERROR:/ d # special target - /^\.IGNORE:/ d # special target - /^\.LOW_RESOLUTION_TIME:/ d # special target - /^\.SILENT:/ d # special target - /^\.EXPORT_ALL_VARIABLES:/ d # special target - /^\.NOTPARALLEL:/ d # special target - /^\.ONESHELL:/ d # special target - /^\.POSIX:/ d # special target - /^\.NOEXPORT:/ d # special target - /^\.MAKE:/ d # special target - - /^[^a-zA-Z0-9]/ d # convention for hidden tgt - - h # hold target - d # delete line + # This pattern includes a literal tab character as \t is not a portable + # representation and fails with BSD sed + /^[^# :%]\{1,\}:/ { # found target block + /^\.PHONY:/ d; # special target + /^\.SUFFIXES:/ d; # special target + /^\.DEFAULT:/ d; # special target + /^\.PRECIOUS:/ d; # special target + /^\.INTERMEDIATE:/ d; # special target + /^\.SECONDARY:/ d; # special target + /^\.SECONDEXPANSION:/ d; # special target + /^\.DELETE_ON_ERROR:/ d; # special target + /^\.IGNORE:/ d; # special target + /^\.LOW_RESOLUTION_TIME:/ d; # special target + /^\.SILENT:/ d; # special target + /^\.EXPORT_ALL_VARIABLES:/ d; # special target + /^\.NOTPARALLEL:/ d; # special target + /^\.ONESHELL:/ d; # special target + /^\.POSIX:/ d; # special target + /^\.NOEXPORT:/ d; # special target + /^\.MAKE:/ d; # special target +EOF + + # don't complete with hidden targets unless we are doing a partial completion + if [[ -z "${prefix_pat}" || "${prefix_pat}" = */ ]]; then + cat <<EOF + /^${prefix_pat}[^a-zA-Z0-9]/d; # convention for hidden tgt +EOF + fi + + cat <<EOF + h; # hold target + d; # delete line } EOF @@ -81,26 +92,26 @@ _make() -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\ --new-file|--assume-new) _filedir - return 0 + return ;; -I|--include-dir|-C|--directory|-m) _filedir -d - return 0 + return ;; -E) COMPREPLY=( $( compgen -v -- "$cur" ) ) - return 0 + return ;; --eval|-D|-V|-x) - return 0 + return ;; --jobs|-j) COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then local opts="$( _parse_help "$1" )" @@ -141,10 +152,11 @@ _make() mode=-d # display-only mode fi - local reset=$( set +o | grep -F posix ); set +o posix # for <(...) + local reset=$( shopt -po posix ); set +o posix # <(...) COMPREPLY=( $( LC_ALL=C \ - make -npq "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \ - sed -nrf <(_make_target_extract_script $mode "$cur") ) ) + $1 -npq __BASH_MAKE_COMPLETION__=1 \ + "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \ + command sed -nf <(_make_target_extract_script $mode "$cur") ) ) $reset if [[ $mode != -d ]]; then @@ -157,4 +169,4 @@ _make() } && complete -F _make make gmake gnumake pmake colormake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/makepkg b/completions/makepkg index 3aa836e5..84b4af79 100644 --- a/completions/makepkg +++ b/completions/makepkg @@ -8,17 +8,18 @@ _makepkg() case "$prev" in -l|--linkadd|-c|--chown) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend -c --chown' \ -- "$cur" ) ) - return 0 + return fi _filedir -} && complete -F _makepkg makepkg +} && +complete -F _makepkg makepkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/man b/completions/man index 6e42f85f..a00ac7a0 100644 --- a/completions/man +++ b/completions/man @@ -1,8 +1,5 @@ # man(1) completion -*- shell-script -*- -[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \ - || return 1 - _man() { local cur prev words cword split @@ -48,25 +45,18 @@ _man() return fi - _expand || return 0 + _expand || return # file based completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir "$manext" - return 0 - fi - - local manpath - if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then - manpath=$( manpath 2>/dev/null || command man --path ) - else - manpath=$MANPATH + return fi - if [[ -z $manpath ]]; then - COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 - fi + local manpath="$MANPATH" + [[ -z $manpath ]] && \ + manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) + [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" # determine manual section to search local sect @@ -98,8 +88,7 @@ _man() fi __ltrim_colon_completions "$cur" - return 0 } && complete -F _man man apropos whatis -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mc b/completions/mc index f3065793..dc322a15 100644 --- a/completions/mc +++ b/completions/mc @@ -8,19 +8,19 @@ _mc() case $prev in -e|--edit|-v|--view|-l|--ftplog|-P|--printwd) _filedir - return 0 + return ;; -C|--colors|-D|--debuglevel) # argument required but no completions available - return 0 + return ;; -h|--help|--help-*|-V|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ @@ -32,4 +32,4 @@ _mc() } && complete -F _mc mc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mcrypt b/completions/mcrypt index 8c7d189c..6d6a898f 100644 --- a/completions/mcrypt +++ b/completions/mcrypt @@ -9,39 +9,38 @@ _mcrypt() case $prev in -g|--openpgp-z) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return 0 + return ;; -o|--keymode) - COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \ + COMPREPLY=( $( compgen -W '$( $1 --list-keymodes \ 2>/dev/null )' -- "$cur" ) ) - return 0 + return ;; -m|--mode) - COMPREPLY=( $( compgen -W "$( mcrypt --list \ - 2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \ - sort -u )" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$( $1 --list 2>/dev/null | \ + cut -d: -f2- )" -- "$cur" ) ) + return ;; -a|--algorithm) - COMPREPLY=( $( compgen -W "$( mcrypt --list 2>/dev/null | \ + COMPREPLY=( $( compgen -W "$( $1 --list 2>/dev/null | \ awk '{print $1}' )" -- "$cur" ) ) - return 0 + return ;; -h|--hash) - COMPREPLY=( $( compgen -W '$( mcrypt --list-hash 2>/dev/null | \ - sed -e 1d )' -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W '$( $1 --list-hash 2>/dev/null | \ + command sed -e 1d )' -- "$cur" ) ) + return ;; -k|-s|--key|--keysize) - return 0 + return ;; -f|-c|--keyfile|--config) _filedir - return 0 + return ;; --algorithms-directory|--modes-directory) _filedir -d - return 0 + return ;; esac @@ -65,4 +64,4 @@ _mcrypt() } && complete -F _mcrypt mcrypt mdecrypt -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mdadm b/completions/mdadm index 111a2c35..d19e89d2 100644 --- a/completions/mdadm +++ b/completions/mdadm @@ -76,27 +76,27 @@ _mdadm() case $prev in -c|--config|-b|--bitmap|--backup-file) _filedir - return 0 + return ;; -l|--level) _mdadm_raid_level - return 0 + return ;; -p|--layout|--parity) _mdadm_raid_layout - return 0 + return ;; -a|--auto) _mdadm_auto_flag - return 0 + return ;; -U|--update) _mdadm_update_flag - return 0 + return ;; esac - $split && return 0 + $split && return local options='--help --help-options --version --verbose --quiet --brief --force --config= --scan --metadata= --homehost=' @@ -147,4 +147,4 @@ _mdadm() } && complete -F _mdadm mdadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mdtool b/completions/mdtool index 879dabf6..b4f36e56 100644 --- a/completions/mdtool +++ b/completions/mdtool @@ -29,7 +29,7 @@ _mdtool() # ;; # esac #fi - return 0 + return ;; "generate-makefiles") compopt -o filenames @@ -38,7 +38,7 @@ _mdtool() COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \ -- "$cur" ) ) fi - return 0 + return ;; "setup") # TODO: at least return filenames after these options. @@ -47,7 +47,7 @@ _mdtool() rep-remove rr rep-update ru rep-list rl reg-update reg-build rgu info rep-build rb pack p help h dump-file' \ -- "$cur" ) ) - return 0 + return ;; esac fi @@ -55,8 +55,7 @@ _mdtool() COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export generate-makefiles gettext-update setup -q' -- "$cur" ) ) - return 0 } && complete -F _mdtool mdtool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/medusa b/completions/medusa index 84a03813..697cafea 100644 --- a/completions/medusa +++ b/completions/medusa @@ -8,16 +8,16 @@ _medusa() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H|-U|-P|-C|-O) _filedir - return 0 + return ;; -M) - COMPREPLY=( $( compgen -W "$(medusa -d | awk '/^ +\+/ {print $2}' \ - | sed -e 's/\.mod$//')" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 -d | awk '/^ +\+/ {print $2}' \ + | command sed -e 's/\.mod$//')" ) ) + return ;; esac @@ -27,4 +27,4 @@ _medusa() } && complete -F _medusa medusa -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mii-diag b/completions/mii-diag index 2743d9d0..87f5d8d5 100644 --- a/completions/mii-diag +++ b/completions/mii-diag @@ -9,11 +9,11 @@ _mii_diag() -F|-A|--advertise|--fixed-speed) COMPREPLY=( $( compgen -W '100baseT4 100baseTx 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD 10baseT-HD' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -23,4 +23,4 @@ _mii_diag() } && complete -F _mii_diag -o default mii-diag -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mii-tool b/completions/mii-tool index facebe4a..3c5f9b45 100644 --- a/completions/mii-tool +++ b/completions/mii-tool @@ -9,16 +9,16 @@ _mii_tool() -F|--force) COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD' -- "$cur" ) ) - return 0 + return ;; -A|--advertise) COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -29,4 +29,4 @@ _mii_tool() } && complete -F _mii_tool -o default mii-tool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/minicom b/completions/minicom index d168ce44..897475ed 100644 --- a/completions/minicom +++ b/completions/minicom @@ -8,17 +8,17 @@ _minicom() case $prev in -a|-c) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; -S|-C) _filedir - return 0 + return ;; -P) COMPREPLY=( $( printf '%s\n' /dev/tty* ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \ -- "$cur" ) ) - return 0 + return ;; esac @@ -26,19 +26,14 @@ _minicom() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t -c -S -d -p -C -T -7 -8' -- "$cur" ) ) - return 0 - else - local confdir - [[ -n $( command ls /etc/minirc.* 2>/dev/null ) ]] && confdir=/etc - [[ -n $( command ls /etc/minicom/minirc.* 2>/dev/null ) ]] \ - && confdir=/etc/minicom - if [[ -n $confdir ]]; then - COMPREPLY=( $( compgen -W '$( printf "%s\n" $confdir/minirc.* | \ - sed -e "s|$confdir/minirc.||")' -- "$cur" ) ) - return 0 - fi + return fi + + COMPREPLY=( + $( printf '%s\n' /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* \ + | command sed -e '/\*$/d' -e 's/^.*minirc\.//' \ + | command grep "^${cur}" ) ) } && complete -F _minicom -o default minicom -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mkinitrd b/completions/mkinitrd index c54f22a2..f0efb294 100644 --- a/completions/mkinitrd +++ b/completions/mkinitrd @@ -8,19 +8,19 @@ _mkinitrd() case $prev in --preload|--with|--builtin) _modules - return 0 + return ;; --fstab|--dsdt) _filedir - return 0 + return ;; --net-dev) _available_interfaces - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--version --help -v -f --preload \ @@ -47,4 +47,4 @@ _mkinitrd() } && complete -F _mkinitrd mkinitrd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mktemp b/completions/mktemp index 3871e708..a8903c16 100644 --- a/completions/mktemp +++ b/completions/mktemp @@ -7,15 +7,15 @@ _mktemp() case "$prev" in --help|--version|--suffix) - return 0 + return ;; --tmpdir|-p) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then local opts=$( _parse_help "$1" ) @@ -26,4 +26,4 @@ _mktemp() } && complete -F _mktemp mktemp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mmsitepass b/completions/mmsitepass index 71fc8b09..db1cbf74 100644 --- a/completions/mmsitepass +++ b/completions/mmsitepass @@ -12,4 +12,4 @@ _mmsitepass() } && complete -F _mmsitepass mmsitepass -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/modinfo b/completions/modinfo index f0016843..28f19308 100644 --- a/completions/modinfo +++ b/completions/modinfo @@ -41,4 +41,4 @@ _modinfo() } && complete -F _modinfo modinfo -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/modprobe b/completions/modprobe index b59e4dca..43a2b01b 100644 --- a/completions/modprobe +++ b/completions/modprobe @@ -2,10 +2,13 @@ _modprobe() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return case "$prev" in + -h|--help|-V|--version) + return + ;; -C|--config) _filedir return @@ -20,13 +23,20 @@ _modprobe() ;; esac + $split && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a --all -b --use-blacklist -C --config -c - --showconfig --dump-modversions -d --dirname --first-time - --force-vermagic --force-modversion -f --force -i --ignore-install - --ignore-remove -l --list -n --dry-run -q --quiet -R - --resolve-alias -r --remove -S --set-version --show-depends -s - --syslog -t --type -V --version -v --verbose' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + if [[ ! $COMPREPLY ]]; then + COMPREPLY=( $( compgen -W '-a --all -b --use-blacklist -C --config + -c --showconfig --dump-modversions -d --dirname --first-time + --force-vermagic --force-modversion -f --force -i + --ignore-install --ignore-remove -l --list -n --dry-run -q + --quiet -R --resolve-alias -r --remove -S --set-version + --show-depends -s --syslog -t --type -V --version -v + --verbose' -- "$cur" ) ) + fi + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -74,7 +84,8 @@ _modprobe() elif [[ -n "$module" ]]; then # do module parameter completion COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ - -p "$module" 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) + -p "$module" 2>/dev/null | \ + awk -F: '!/^[ \t]/ { print $1 }' )" -- "$cur" ) ) else _modules $version if [[ $COMPREPLY ]]; then @@ -84,7 +95,7 @@ _modprobe() for i in ${!mods[@]}; do for module in ${COMPREPLY[@]}; do if [[ ${mods[i]} == $module ]]; then - unset mods[i] + unset 'mods[i]' break fi done @@ -97,4 +108,4 @@ _modprobe() } && complete -F _modprobe modprobe -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/monodevelop b/completions/monodevelop index 9102b8bb..13685dfb 100644 --- a/completions/monodevelop +++ b/completions/monodevelop @@ -13,8 +13,7 @@ _monodevelop() else _filedir fi - return 0 } && complete -F _monodevelop monodevelop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mount b/completions/mount index 6818ac39..a8748d1b 100644 --- a/completions/mount +++ b/completions/mount @@ -21,7 +21,7 @@ _mount() case $prev in -t|--types) _fstypes - return 0 + return ;; esac @@ -32,7 +32,7 @@ _mount() [[ -x $sm ]] || continue COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \ awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) - return 0 + return done fi @@ -42,8 +42,8 @@ _mount() if [[ -n $host ]]; then COMPREPLY=( $( compgen -P "//$host" -W \ "$( smbclient -d 0 -NL $host 2>/dev/null | - sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' | - sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \ + command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | + command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \ -- "${cur#//$host}" ) ) fi elif [[ -r /etc/vfstab ]]; then @@ -51,7 +51,7 @@ _mount() COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) ) elif [[ ! -e /etc/fstab ]]; then # probably Cygwin - COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( $1 | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) ) else # probably BSD COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- "$cur" ) ) @@ -59,4 +59,4 @@ _mount() } && complete -F _mount -o default -o dirnames mount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mount.linux b/completions/mount.linux index ddb9180e..ed198ad8 100644 --- a/completions/mount.linux +++ b/completions/mount.linux @@ -222,7 +222,7 @@ _mount() [[ -x $sm ]] || continue COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \ awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) - return 0 + return done fi @@ -232,8 +232,8 @@ _mount() if [[ -n $host ]]; then COMPREPLY=( $( compgen -P "//$host" -W \ "$( smbclient -d 0 -NL $host 2>/dev/null | - sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' | - sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \ + command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | + command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \ -- "${cur#//$host}" ) ) fi fi @@ -242,4 +242,4 @@ _mount() } && complete -F _mount mount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mplayer b/completions/mplayer index 88e9dc7d..ab08b9a9 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -4,8 +4,8 @@ _mplayer_options_list() { cur=${cur%\\} COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \ - sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \ - sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) + command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \ + command sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) } _mplayer() @@ -19,15 +19,15 @@ _mplayer() -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \ -audio-demuxer|-sub-demuxer) _mplayer_options_list $cmd $prev - return 0 + return ;; -show-profile) _mplayer_options_list $cmd -profile - return 0 + return ;; - -audiofile) - _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)' - return 0 + -audiofile|-audio-file) + _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ac3|ape)' + return ;; -font|-subfont) if [[ $prev == -font ]]; then @@ -37,11 +37,11 @@ _mplayer() fi local IFS=$'\n' COMPREPLY+=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) - return 0 + return ;; - -sub) + -sub|-sub-file) _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' - return 0 + return ;; -vobsub) _filedir '@(idx|ifo|sub)' @@ -52,26 +52,26 @@ _mplayer() else printf '%s\n' $i fi - done ) ) - return 0 + done ) ) + return ;; -subcp|-msgcharset) local cp - cp=( $( iconv --list 2>/dev/null | sed -e "s@//@@;" 2>/dev/null ) ) + cp=( $( iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null ) ) if [[ "$cur" == "${cur,,}" ]]; then COMPREPLY=( $( compgen -W '${cp[@],,}' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '${cp[@]^^}' -- "$cur" ) ) fi - return 0 + return ;; -ifo) _filedir ifo - return 0 + return ;; -cuefile) _filedir '@(bin|cue)' - return 0 + return ;; -skin) # if you don't have installed mplayer in /usr you @@ -86,37 +86,38 @@ _mplayer() local IFS=$'\n' for i in ~/.mplayer/skins ${dirs[@]}; do if [[ -d $i && -r $i ]]; then - for j in $( compgen -d $i/$cur ); do + for j in $( compgen -d -- $i/$cur ); do COMPREPLY[$k]=${j#$i/} k=$((++k)) done fi done - return 0 + return ;; -cdrom-device) _cd_devices _dvd_devices - return 0 + return ;; -dvd-device) - _filedir - return 0 + _dvd_devices + _filedir iso + return ;; -bluray-device) _filedir -d - return 0 + return ;; -mixer|-dvdauth|-fb|-zrdev) cur=${cur:=/dev/} _filedir - return 0 + return ;; -edl|-edlout|-lircconf|-menu-cfg|-playlist|-csslib|-dumpfile| \ -subfile|-vobsub|-aofile|-fbmodeconfig|-include|-o|-dvdkey| \ -passlogfile) _filedir - return 0 + return ;; -autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \ -bandwidth|-bluray-angle|-bluray-chapter|-cache|-chapter|-dvd-speed| \ @@ -134,23 +135,23 @@ _mplayer() -subalign|-subwidth|-subfont-blur|-subfont-outline| \ -subfont-autoscale|-subfont-encoding|-subfont-osd-scale| \ -subfont-text-scale) - return 0 + return ;; -channels) COMPREPLY=( $( compgen -W '2 4 6 8' -- "$cur" ) ) - return 0 + return ;; -aspect|-monitoraspect) COMPREPLY=( $( compgen -W '1:1 3:2 4:3 5:4 14:9 14:10 16:9 16:10 2.35:1' -- "$cur" ) ) __ltrim_colon_completions "$cur" - return 0 + return ;; -lavdopts) COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur" ) ) - return 0 + return ;; -lavcopts) COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= @@ -163,21 +164,21 @@ _mplayer() scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic umv' -- "$cur" ) ) - return 0 + return ;; -ssf) COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' \ -- "$cur" ) ) - return 0 + return ;; -jpeg) COMPREPLY=( $( compgen -W 'noprogressive progressive nobaseline baseline optimize= smooth= quality= outdir=' -- "$cur" ) ) - return 0 + return ;; -xvidopts) COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) ) - return 0 + return ;; -xvidencopts) COMPREPLY=( $( compgen -W 'pass= bitrate= fixed_quant= me_quality= @@ -185,38 +186,38 @@ _mplayer() quant_range= min_key_interval= max_key_interval= mpeg_quant mod_quant lumi_mask hintedme hintfile debug keyframe_boost= kfthreshold= kfreduction=' -- "$cur" ) ) - return 0 + return ;; -divx4opts) COMPREPLY=( $( compgen -W 'br= key= deinterlace q= min_quant= max_quant= rc_period= rc_reaction_period= crispness= rc_reaction_ratio= pass= vbrpass= help' -- "$cur" ) ) - return 0 + return ;; -info) COMPREPLY=( $( compgen -W 'name= artist= genre= subject= copyright= srcform= comment= help' -- "$cur" ) ) - return 0 + return ;; -lameopts) COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= mode= padding= fast preset= help' -- "$cur" ) ) - return 0 + return ;; -rawaudio) COMPREPLY=( $( compgen -W 'on channels= rate= samplesize= format=' \ -- "$cur" ) ) - return 0 + return ;; -rawvideo) COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= h= y420 yv12 yuy2 y8 format= size=' -- "$cur" ) ) - return 0 + return ;; -aop) COMPREPLY=( $( compgen -W 'list= delay= format= fout= volume= mul= softclip' -- "$cur" ) ) - return 0 + return ;; -dxr2) COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded iec958-decoded @@ -225,7 +226,7 @@ _mplayer() ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r= ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor= oly-cor= overlay overlay-ratio= update-cache' -- "$cur" ) ) - return 0 + return ;; -tv) COMPREPLY=( $( compgen -W 'on noaudio driver= device= input= freq= @@ -233,30 +234,30 @@ _mplayer() audiorate= forceaudio alsa amode= forcechan= adevice= audioid= volume= bass= treble= balance= fps= channels= immediatemode=' \ -- "$cur" ) ) - return 0 + return ;; -mf) COMPREPLY=( $( compgen -W 'on w= h= fps= type=' -- "$cur" ) ) - return 0 + return ;; -cdda) COMPREPLY=( $( compgen -W 'speed= paranoia= generic-dev= sector-size= overlap= toc-bias toc-offset= skip noskip' \ -- "$cur" ) ) - return 0 + return ;; -input) COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate keylist cmdlist js-dev file' -- "$cur" ) ) - return 0 + return ;; -af-adv) COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) ) - return 0 + return ;; -noconfig) COMPREPLY=( $( compgen -W 'all gui system user' -- "$cur" ) ) - return 0 + return ;; -*) # Assume arg is required for everything else except options @@ -267,24 +268,23 @@ _mplayer() [[ ${j,,} != @(flag|print) ]] && return 1 break fi - done || return 0 + done || return ;; esac case $cur in -*) COMPREPLY=( $( compgen -W '$( $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null | \ - sed -ne '1,/^[[:space:]]*Name/d' \ + command sed -ne '1,/^[[:space:]]*Name/d' \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ -e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) ) ;; *) - _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB|iso|ISO|opus|OPUS)?(.part)' + _filedir '@(m?(j)p?(e)g|M?(J)P?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|mts|MTS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|web[am]|WEB[AM]|amr|AMR|awb|AWB|iso|ISO|opus|OPUS)?(.part)' ;; esac - return 0 } && complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mr b/completions/mr new file mode 100644 index 00000000..9229e309 --- /dev/null +++ b/completions/mr @@ -0,0 +1,86 @@ +# mr completion -*- shell-script -*- + +_mr() { + local cur prev words cword + _init_completion || return + + local help commands options + + help="$(PERLDOC_PAGER=cat PERLDOC=-otext "${1}" help 2>/dev/null)" + + commands="$(awk '/\[options\]/ { print $3 }' <<<"${help}")" + # Split [online|offline] and remove `action` placeholder. + commands="${commands//@(action|[\[\|\]])/$'\n'}" + # Add standard aliases. + commands="${commands} ci co ls" + + # Determine if user has entered an `mr` command. Used to block top-level + # (option and command) completions. + local cmd i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ $commands == *"${words[i]}"* ]]; then + cmd="${words[i]}" + break + fi + done + + # Complete options for specific commands. + if [[ -n $cmd ]]; then + case $cmd in + bootstrap) + _filedir + # Also complete stdin (-) as a potential bootstrap source. + if [[ -z "${cur}" || $cur == - ]] && [[ $prev != - ]]; then + COMPREPLY+=( - ) + fi + return + ;; + clean) + if [[ "${cur}" == -* ]]; then + COMPREPLY=( $( compgen -W '-f' -- "${cur}" ) ) + fi + return + ;; + commit|ci|record) + if [[ "${cur}" == -* ]]; then + COMPREPLY=( $( compgen -W '-m' -- "${cur}" ) ) + fi + return + ;; + run) + COMPREPLY=( $( compgen -c -- "${cur}" ) ) + return + ;; + *) + # Do not complete any other command. + return + ;; + esac + fi + + # Complete top-level options and commands. + case $prev in + -c|--config) + _filedir + return + ;; + -d|--directory) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + options="$(_parse_help - <<<"${help}")" + # Remove short options (all have compatible long options). + options="${options//-[a-z]$'\n'/}" + # Remove deprecated options. + options="${options//--path/}" + COMPREPLY=( $( compgen -W "${options}" -- "${cur}" ) ) + else + COMPREPLY=( $( compgen -W "${commands}" -- "${cur}" ) ) + fi +} && +complete -F _mr mr + +# ex: filetype=sh diff --git a/completions/msynctool b/completions/msynctool index 28a0163a..3eae1dfa 100644 --- a/completions/msynctool +++ b/completions/msynctool @@ -7,28 +7,28 @@ _msynctool() case $words in --configure) - COMPREPLY=( $( compgen -W "$(msynctool --showgroup \ - $prev | awk '/^Member/ {print $2}' | sed \ + COMPREPLY=( $( compgen -W "$($1 --showgroup \ + $prev | awk '/^Member/ {print $2}' | command sed \ -e 's/:$//' )" -- "$cur" ) ) - return 0 + return ;; --addmember) - COMPREPLY=( $( compgen -W '$(msynctool --listplugins \ - | sed -e '1d' )' -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W '$($1 --listplugins \ + | command sed -e '1d' )' -- "$cur" ) ) + return ;; esac case $prev in --configure|--addgroup|--delgroup|--showgroup|--sync|--addmember) - COMPREPLY=( $( compgen -W '$(msynctool --listgroups \ - | sed -e '1d' )' -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W '$($1 --listgroups \ + | command sed -e '1d' )' -- "$cur" ) ) + return ;; --showformats|--filter-objtype|--slow-sync) - COMPREPLY=( $( compgen -W '$(msynctool --listobjects \ - | sed -e '1d' )' -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W '$($1 --listobjects \ + | command sed -e '1d' )' -- "$cur" ) ) + return ;; esac @@ -39,4 +39,4 @@ _msynctool() } && complete -F _msynctool msynctool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mtx b/completions/mtx index 0cb63251..c52c6173 100644 --- a/completions/mtx +++ b/completions/mtx @@ -38,8 +38,7 @@ _mtx() else COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) fi - return 0 } && complete -F _mtx mtx -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/munin-node-configure b/completions/munin-node-configure index 7f1d5a59..82815a6e 100644 --- a/completions/munin-node-configure +++ b/completions/munin-node-configure @@ -8,19 +8,19 @@ _munin_node_configure() case $prev in --config) _filedir - return 0 + return ;; --servicedir|--libdir) _filedir -d - return 0 + return ;; --snmp) _known_hosts_real "$cur" - return 0 + return ;; --snmpversion) COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) ) - return 0 + return ;; esac @@ -30,4 +30,4 @@ _munin_node_configure() } && complete -F _munin_node_configure munin-node-configure -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/munin-run b/completions/munin-run index 756a0e0a..72228522 100644 --- a/completions/munin-run +++ b/completions/munin-run @@ -8,11 +8,11 @@ _munin_run() case $prev in --config|--sconffile) _filedir - return 0 + return ;; --servicedir|--sconfdir) _filedir -d - return 0 + return ;; esac @@ -25,4 +25,4 @@ _munin_run() } && complete -F _munin_run munin-run -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/munin-update b/completions/munin-update index c035ec7b..8889a94d 100644 --- a/completions/munin-update +++ b/completions/munin-update @@ -8,11 +8,11 @@ _munin_update() case $prev in --config) _filedir - return 0 + return ;; --host) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -24,4 +24,4 @@ _munin_update() } && complete -F _munin_update munin-update -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/munindoc b/completions/munindoc index c5a03c1c..f603d87b 100644 --- a/completions/munindoc +++ b/completions/munindoc @@ -10,4 +10,4 @@ _munindoc() } && complete -F _munindoc munindoc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mussh b/completions/mussh index a7bf2997..2e9842b6 100644 --- a/completions/mussh +++ b/completions/mussh @@ -42,11 +42,11 @@ _mussh() COMPREPLY+=( $( compgen -c -- "$cur" ) ) return ;; - esac + esac - [[ $cur != -* ]] || \ - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $cur != -* ]] || \ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) } && complete -F _mussh mussh -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mutt b/completions/mutt index 3dc82a92..568479ec 100644 --- a/completions/mutt +++ b/completions/mutt @@ -10,8 +10,6 @@ _muttaddr() _muttquery "$1" COMPREPLY+=( $( compgen -u -- "$1" ) ) - - return 0 } @@ -57,7 +55,7 @@ _muttconffiles() sofar=" $1 " shift while [[ "$1" ]]; do - newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval printf %s $1) ) ) + newconffiles=( $(command sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval printf %s $1) ) ) for file in "${newconffiles[@]}"; do __expand_tilde_by_ref file [[ ! -f "$file" || $sofar == *\ $file\ * ]] && continue @@ -77,14 +75,12 @@ _muttaliases() local -a conffiles aliases muttrc=$(_muttrc) - [[ -z $muttrc ]] && return 0 + [[ -z $muttrc ]] && return conffiles=( $(eval _muttconffiles $muttrc $muttrc) ) - aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ + aliases=( $( command sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ $(eval echo "${conffiles[@]}") ) ) COMPREPLY+=( $( compgen -W "${aliases[*]}" -- "$cur" ) ) - - return 0 } @@ -94,18 +90,16 @@ _muttquery() local cur=$1 querycmd muttcmd=${words[0]} local -a queryresults - querycmd="$( $muttcmd -Q query_command 2>/dev/null | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )" + querycmd="$( $muttcmd -Q query_command 2>/dev/null | command sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )" if [[ -z "$cur" || -z "$querycmd" ]]; then queryresults=() else __expand_tilde_by_ref querycmd queryresults=( $( $querycmd | \ - sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) ) + command sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) ) fi COMPREPLY+=( $( compgen -W "${queryresults[*]}" -- "$cur" ) ) - - return 0 } @@ -116,7 +110,7 @@ _muttfiledir() muttrc=$(_muttrc) if [[ $cur == [=+]* ]]; then - folder="$( $muttcmd -F "$muttrc" -Q folder 2>/dev/null | sed -e 's|^folder=\"\(.*\)\"$|\1|' )" + folder="$( $muttcmd -F "$muttrc" -Q folder 2>/dev/null | command sed -e 's|^folder=\"\(.*\)\"$|\1|' )" : folder:=~/Mail # Match any file in $folder beginning with $cur @@ -124,15 +118,13 @@ _muttfiledir() compopt -o filenames COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) ) COMPREPLY=( ${COMPREPLY[@]#$folder/} ) - return 0 + return elif [[ $cur == !* ]]; then spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \ - sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )" + command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )" [[ ! -z $spoolfile ]] && eval cur="${cur/^!/$spoolfile}" fi _filedir - - return 0 } @@ -145,24 +137,24 @@ _mutt() -*) COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n -p -Q -R -s -v -x -y -z -Z -h' -- "$cur" ) ) - return 0 + return ;; *) case $prev in -a|-f|-F|-H|-i) _muttfiledir "$cur" - return 0 + return ;; -A) _muttaliases "$cur" - return 0 + return ;; -e|-m|-Q|-s|-h|-p|-R|-v|-y|-z|-Z) - return 0 + return ;; *) _muttaddr "$cur" - return 0 + return ;; esac ;; @@ -170,4 +162,4 @@ _mutt() } && complete -F _mutt -o default mutt muttng -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mysql b/completions/mysql index c41c1667..ddc94e68 100644 --- a/completions/mysql +++ b/completions/mysql @@ -8,38 +8,42 @@ _mysql() case $prev in -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -D|--database) - COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) ) + return ;; -h|--host) _known_hosts_real "$cur" - return 0 + return ;; --default-character-set) - [[ -d /usr/share/mysql/charsets ]] && \ - COMPREPLY=( $( compgen -W "$(command ls /usr/share/mysql/charsets|sed -e '/^\(README\|Index\.xml\)$/d' -e 's/.xml$//') utf8" -- "$cur" ) ) - return 0 + local reset=$( shopt -p failglob ); shopt -u failglob + local -a charsets=( /usr/share/m{ariadb,ysql}/charsets/*.xml ) + $reset + charsets=( "${charsets[@]##*/}" ) + charsets=( "${charsets[@]%%?(Index|\*).xml}" utf8 ) + COMPREPLY=( $( compgen -W '${charsets[@]}' -- "$cur" ) ) + return ;; --character-sets-dir|--ssl-capath) _filedir -d - return 0 + return ;; -S|--socket) _filedir sock - return 0 + return ;; --protocol) COMPREPLY=( $( compgen -W 'tcp socket pipe memory' -- "$cur" ) ) - return 0 + return ;; --defaults-file|--defaults-extra-file|--tee) _filedir - return 0 + return ;; --default-character-set|-P|--port|--set-variable|\ --ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|\ @@ -47,11 +51,11 @@ _mysql() --net_buffer_length|--select_limit|--max_join_size|\ --server-arg|--debug|--delimiter|--execute|-e|--pager) # Argument required but no completions available - return 0 + return ;; '-?'|-I|--help|-V|--version) # All other options are noop with these - return 0 + return ;; esac @@ -62,21 +66,21 @@ _mysql() COMPREPLY=( $( compgen -W "$help" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return ;; # only complete long options -) compopt -o nospace COMPREPLY=( -- ) - return 0 + return ;; esac COMPREPLY=( $( compgen -W \ - "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \ + "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \ -- "$cur" ) ) } && complete -F _mysql mysql -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mysqladmin b/completions/mysqladmin index bdc07eb2..13799052 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -8,37 +8,37 @@ _mysqladmin() case $prev in -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -h|--host) _known_hosts_real "$cur" - return 0 + return ;; --character-sets-dir|--ssl-capath) _filedir -d - return 0 + return ;; -S|--socket) _filedir sock - return 0 + return ;; --defaults-file|--defaults-extra-file) _filedir - return 0 + return ;; -c|--count|--default-character-set|-P|--port|-O|--set-variable|\ -i|--sleep|--ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|-w|--wait|\ --connect_timeout|--shutdown_timeout) # Argument required but no completions available - return 0 + return ;; '-?'|--help|-V|--version) # All other options are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -51,4 +51,4 @@ _mysqladmin() } && complete -F _mysqladmin mysqladmin -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/nc b/completions/nc index 055924c9..61bf5b52 100644 --- a/completions/nc +++ b/completions/nc @@ -36,13 +36,11 @@ _nc() # Complete 1st non-option arg only local i for (( i=1; i < cword; i++ )); do - [[ ${words[i]} != -* && \ - ${words[i-1]} != @(-I|-i|-O|-P|-p|-s|-T|-V|-w|-X|-x) ]] && \ - return + [[ ${words[i]} != -* && ${words[i-1]} != -[IiOPpsTVwXx] ]] && return done _known_hosts_real "$cur" } && complete -F _nc nc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ncftp b/completions/ncftp index 0d32cfe2..4c073ce6 100644 --- a/completions/ncftp +++ b/completions/ncftp @@ -17,12 +17,11 @@ _ncftp() fi if [[ $cword -eq 1 && -f ~/.ncftp/bookmarks ]]; then - COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ + COMPREPLY=( $( compgen -W '$( command sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ ~/.ncftp/bookmarks )' -- "$cur" ) ) fi - return 0 } && complete -F _ncftp -o default ncftp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/nethogs b/completions/nethogs index 937edf1f..8eeb4ff5 100644 --- a/completions/nethogs +++ b/completions/nethogs @@ -20,6 +20,7 @@ _nethogs() fi _available_interfaces -a -} && complete -F _nethogs nethogs +} && +complete -F _nethogs nethogs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/newlist b/completions/newlist index 9e2f6933..04bf17d1 100644 --- a/completions/newlist +++ b/completions/newlist @@ -2,16 +2,24 @@ _newlist() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--language|-u|--urlhost|-e|--emailhost|--help) + return + ;; + esac + + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _xfunc list_lists _mailman_lists fi - } && complete -F _newlist newlist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/newusers b/completions/newusers index aa1394d2..068b7a92 100644 --- a/completions/newusers +++ b/completions/newusers @@ -9,23 +9,23 @@ _newusers() -c|--crypt) COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ -- "$cur" ) ) - return 0 + return ;; -s|--sha-rounds) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi _filedir } && complete -F _newusers newusers -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ngrep b/completions/ngrep index 7c867649..bbfbbd2f 100644 --- a/completions/ngrep +++ b/completions/ngrep @@ -34,4 +34,4 @@ _ngrep() } && complete -F _ngrep ngrep -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/nmap b/completions/nmap index 6fbdb073..7de8ed42 100644 --- a/completions/nmap +++ b/completions/nmap @@ -8,19 +8,19 @@ _nmap() case $prev in -iL|-oN|-oX|-oS|-oG|---excludefile|--resume|--stylesheet) _filedir - return 0 + return ;; -oA|--datadir) _filedir -d - return 0 + return ;; -e) _available_interfaces -a - return 0 + return ;; -b|--dns-servers) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -47,4 +47,4 @@ _nmap() } && complete -F _nmap nmap -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/nslookup b/completions/nslookup index 88af1d5b..f137b0a1 100644 --- a/completions/nslookup +++ b/completions/nslookup @@ -39,6 +39,14 @@ _nslookup() -domain= -search -nosearch -port= -querytype= -recurse -norecurse -retry= -timeout= -vc -novc -fail -nofail' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local args + _count_args = + if [[ $args -le 2 ]]; then + _known_hosts_real "$cur" + [[ $args -eq 1 && $cur == @(|-) ]] && COMPREPLY+=( - ) fi } && complete -F _nslookup nslookup @@ -75,4 +83,4 @@ _host() } && complete -F _host host -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ntpdate b/completions/ntpdate index dab38477..ade95a69 100644 --- a/completions/ntpdate +++ b/completions/ntpdate @@ -8,19 +8,19 @@ _ntpdate() case $prev in -k) _filedir - return 0 + return ;; -U) - COMPREPLY=( $( compgen -u "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return ;; -p) COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) - return 0 + return ;; -a|-e|-o|-t) - return 0 + return ;; esac @@ -32,4 +32,4 @@ _ntpdate() } && complete -F _ntpdate ntpdate -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/openssl b/completions/openssl index 997fe1ec..57476848 100644 --- a/completions/openssl +++ b/completions/openssl @@ -20,12 +20,18 @@ _openssl_sections() done fi - [[ ! -f $config ]] && return 0 + [[ ! -f $config ]] && return COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \ -- "$cur" ) ) } +_openssl_digests() +{ + "$1" dgst -h 2>&1 | \ + awk '/^-.*[ \t]to use the .* message digest algorithm/ { print $1 }' +} + _openssl() { local cur prev words cword @@ -43,7 +49,8 @@ _openssl() camellia-256-ecb cast cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 - rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 rc4-40' + rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 rc4-40 + sha224 sha256 sha384 sha512' if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) @@ -56,15 +63,15 @@ _openssl() -spkac|-sign|-signkey|-signer|-signature|-ss_cert|-untrusted| \ -verify) _filedir - return 0 + return ;; -outdir|-CApath) _filedir -d - return 0 + return ;; -name|-crlexts|-extensions) _openssl_sections - return 0 + return ;; -inform|-outform|-keyform|-certform|-CAform|-CAkeyform|-dkeyform|\ -dcertform) @@ -78,20 +85,20 @@ _openssl() ;; esac COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) ) - return 0 + return ;; -connect) _known_hosts_real "$cur" - return 0 + return ;; -starttls) COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' -- "$cur" ) ) - return 0 + return ;; -cipher) - COMPREPLY=( $( IFS=: compgen -W "$( openssl ciphers )" \ + COMPREPLY=( $( IFS=: compgen -W "$( $1 ciphers )" \ -- "$cur" ) ) - return 0 + return ;; esac @@ -122,9 +129,8 @@ _openssl() options='-inform -outform -in -out -print_certs' ;; dgst) - options='-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 - -c -d -hex -binary -out -sign -verify -prverify - -signature' + options="-c -d -hex -binary -out -sign -verify -prverify + -signature $( _openssl_digests $1 )" ;; dsa) options='-inform -outform -in -passin -out -passout -des @@ -156,11 +162,11 @@ _openssl() options='-out -rand -base64' ;; req) - options='-inform -outform -in -passin -out -passout -text + options="-inform -outform -in -passin -out -passout -text -noout -verify -modulus -new -rand -newkey -newkey - -nodes -key -keyform -keyout -md5 -sha1 -md2 -mdc2 + -nodes -key -keyform -keyout $( _openssl_digests $1 ) -config -x509 -days -asn1-kludge -newhdr -extensions - -reqexts section' + -reqexts section" ;; rsa) options='-inform -outform -in -passin -out -passout @@ -210,16 +216,16 @@ _openssl() -issuer_checks -verbose -certificates' ;; x509) - options='-inform -outform -keyform -CAform -CAkeyform -in + options="-inform -outform -keyform -CAform -CAkeyform -in -out -serial -hash -subject_hash -issuer_hash -subject -issuer -nameopt -email -startdate -enddate -purpose -dates -modulus -fingerprint -alias -noout -trustout -clrtrust -clrreject -addtrust -addreject -setalias -days -set_serial -signkey -x509toreq -req -CA -CAkey - -CAcreateserial -CAserial -text -C -md2 -md5 -sha1 - -mdc2 -clrext -extfile -extensions -engine' + -CAcreateserial -CAserial -text -C -clrext + -extfile -extensions -engine $( _openssl_digests $1 )" ;; - md5|md4|md2|sha1|sha|mdc2|ripemd160) + md*|sha*|ripemd160) options='-c -d' ;; esac @@ -238,4 +244,4 @@ _openssl() } && complete -F _openssl -o default openssl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/opera b/completions/opera index 6cbfbacf..26343c62 100644 --- a/completions/opera +++ b/completions/opera @@ -41,6 +41,7 @@ _opera() fi _filedir '@(?([xX]|[sS])[hH][tT][mM]?([lL]))' -} && complete -F _opera opera +} && +complete -F _opera opera -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/optipng b/completions/optipng new file mode 100644 index 00000000..7c614abe --- /dev/null +++ b/completions/optipng @@ -0,0 +1,52 @@ +# optipng(1) completion -*- shell-script -*- + +_optipng() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -'?'|-h|--help|-f) + return + ;; + -o) + COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + return + ;; + -out|-log) + _filedir + return + ;; + -dir) + _filedir -d + return + ;; + -i) + COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) + return + ;; + -zc|-zm) + COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + return + ;; + -zw) + COMPREPLY=( $( compgen -W '256 512 1k 2k 4k 8k 16k 32k' \ + -- "$cur" ) ) + return + ;; + -strip) + COMPREPLY=( $( compgen -W 'all' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + _filedir '@(png|bmp|gif|pnm|tif?(f))' +} && +complete -F _optipng optipng + +# ex: filetype=sh diff --git a/completions/p4 b/completions/p4 index 4e47267f..beea4687 100644 --- a/completions/p4 +++ b/completions/p4 @@ -45,8 +45,7 @@ _p4() esac fi - return 0 } && complete -F _p4 -o default p4 g4 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pack200 b/completions/pack200 index fa6b1c78..37c57749 100644 --- a/completions/pack200 +++ b/completions/pack200 @@ -9,36 +9,36 @@ _pack200() -S|--segment-limit|-P|--pass-file|-C|--class-attribute|\ -F|--field-attribute|-M|--method-attribute|-D|--code-attribute|\ '-?'|-h|--help|-V|--version|-J) - return 0 + return ;; -E|--effort) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return 0 + return ;; -H|--deflate-hint) COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) - return 0 + return ;; -m|--modification-time) COMPREPLY=( $( compgen -W 'latest keep' -- "$cur" ) ) - return 0 + return ;; -U|--unknown-attribute) COMPREPLY=( $( compgen -W 'error strip pass' -- "$cur" ) ) - return 0 + return ;; -f|--config-file) _filedir properties - return 0 + return ;; -l|--log-file) COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) _filedir log - return 0 + return ;; -r|--repack) _filedir jar - return 0 + return ;; esac @@ -71,4 +71,4 @@ _pack200() } && complete -F _pack200 pack200 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/passwd b/completions/passwd index e470b8bb..ce6d4c0e 100644 --- a/completions/passwd +++ b/completions/passwd @@ -7,17 +7,17 @@ _passwd() case $prev in -n|--minimum|-x|--maximum|-w|--warning|-i|--inactive|-\?|--help|--usage) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _allowed_users } && complete -F _passwd passwd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/patch b/completions/patch index e8da15a9..1a9edca1 100644 --- a/completions/patch +++ b/completions/patch @@ -67,4 +67,4 @@ _patch() } && complete -F _patch patch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pdftotext b/completions/pdftotext new file mode 100644 index 00000000..aed6b2c2 --- /dev/null +++ b/completions/pdftotext @@ -0,0 +1,36 @@ +# bash completion for pdftotext(1) -*- shell-script -*- + +_pdftotext() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|-help|--help|-'?'|-f|-l|-r|-x|-y|-W|-H|-fixed|-opw|-upw) + return + ;; + -enc) + COMPREPLY=( $( compgen -W '$( "$1" -listenc 2>/dev/null | + command sed -e 1d )' -- "$cur" ) ) + return + ;; + -eol) + COMPREPLY=( $( compgen -W "unix dos mac" -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* && ${prev,,} != *.pdf ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + case ${prev,,} in + -|*.txt) ;; + *.pdf) COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) ; _filedir txt ;; + *) _filedir pdf ;; + esac +} && +complete -F _pdftotext pdftotext + +# ex: filetype=sh diff --git a/completions/perl b/completions/perl index 4bcc9b02..250039ee 100644 --- a/completions/perl +++ b/completions/perl @@ -1,18 +1,11 @@ # bash completion for perl -*- shell-script -*- -_perlmodules() +_perl_helper() { COMPREPLY=( $( compgen -P "$prefix" -W \ - "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl modules $cur )" \ - -- "$cur" ) ) - __ltrim_colon_completions "$prefix$cur" -} - -_perlfunctions() -{ - COMPREPLY=( $( compgen -P "$prefix" -W \ - "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl functions $cur )" \ + "$( ${2:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl $1 $cur )" \ -- "$cur" ) ) + [[ $1 == functions ]] || __ltrim_colon_completions "$prefix$cur" } _perl() @@ -27,6 +20,10 @@ _perl() temp=$cur prev=${temp:0:2} cur=${temp:2} + if [[ $prev == -d && $cur == t* ]]; then + prev=-dt + cur=${cur:1} + fi optPrefix=-P$prev optSuffix=-S/ prefix=$prev @@ -34,20 +31,20 @@ _perl() case $prev in -D|-e|-E|-i|-F|-l) - return 0 + return ;; -I|-x) local IFS=$'\n' compopt -o filenames COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) - return 0 + return ;; -m|-M) temp="${cur#-}" prefix+="${cur%$temp}" cur="$temp" - _perlmodules $1 - return 0 + _perl_helper modules $1 + return ;; -V) if [[ $cur == :* ]]; then @@ -59,16 +56,15 @@ _perl() keys %Config::Config" 2>/dev/null )' -- "$temp" ) ) __ltrim_colon_completions "$prefix$temp" fi - return 0 + return ;; -d|-dt) if [[ $cur == :* ]]; then temp="${cur#:}" prefix="$prefix${cur%$temp}" cur="Devel::$temp" - _perlmodules $1 + _perl_helper modules $1 fi - return 0 ;; esac @@ -101,15 +97,15 @@ _perldoc() case $prev in -h|-V|-n|-o|-M|-w|-L) - return 0 + return ;; -d) _filedir - return 0 + return ;; -f) - _perlfunctions $perl - return 0 + _perl_helper functions $perl + return ;; esac @@ -118,18 +114,18 @@ _perldoc() else # return available modules (unless it is clearly a file) if [[ "$cur" != @(*/|[.~])* ]]; then - _perlmodules $perl + _perl_helper perldocs $perl if [[ $cur == p* ]]; then COMPREPLY+=( $( compgen -W \ - '$( PERLDOC_PAGER=/bin/cat "$1" -u perl | \ - sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ - awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' \ + '$( PERLDOC_PAGER=cat "$1" -u perl | \ + command sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ + awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' \ -- "$cur" ) ) fi fi - _filedir 'p@(l|m|od)' + _filedir 'p@([lm]|od)' fi } && complete -F _perldoc -o bashdefault perldoc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pgrep b/completions/pgrep index 0a1c862f..82985acf 100644 --- a/completions/pgrep +++ b/completions/pgrep @@ -6,14 +6,18 @@ _pgrep() _init_completion || return case $prev in - -c|-d|-g|-J|-M|-N|-s|-t|-T|-z) + -c|-d|--delimiter|-g|--pgroup|-J|-M|-N|-s|--session|-t|--terminal|-T|-z) return ;; - -F) + --signal) + _signals + return + ;; + -F|--pidfile) _filedir return ;; - -G) + -G|--group) _gids return ;; @@ -21,26 +25,28 @@ _pgrep() COMPREPLY=( $( compgen -W 'any none' -- "$cur" ) ) return ;; - -P) + -P|--parent) _pids return ;; - -u|-U) + -u|--euid|-U|--uid) _uids return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( "$1" --usage 2>&1 | - sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" | - _parse_usage - )' -- "$cur" ) ) + local help='$( _parse_help "$1" )' + [[ $help ]] || help='$( "$1" --usage 2>&1 | + command sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" | + _parse_usage - )' + COMPREPLY=( $( compgen -W "$help" -- "$cur" ) ) [[ $cword -eq 1 && $1 == *pkill ]] && _signals - return fi - _pnames + _pnames -s } && complete -F _pgrep pgrep pkill -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pidof b/completions/pidof index 12ac9a79..223e25d4 100644 --- a/completions/pidof +++ b/completions/pidof @@ -6,14 +6,22 @@ _pidof() _init_completion || return case $prev in - -o) + -h|--help|-V|--version) + return + ;; + -o|--omit-pid) _pids return ;; esac + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + _pnames } && complete -F _pidof pidof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pine b/completions/pine index 39227625..d99a3808 100644 --- a/completions/pine +++ b/completions/pine @@ -1,13 +1,32 @@ -# PINE address-book completion -*- shell-script -*- +# pine/alpine completion -*- shell-script -*- -_pineaddr() +_pine() { local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \ - 2>/dev/null)' -- "$cur" ) ) + case $prev in + -help|-d|-f|-c|-I|-n|-url|-copy_pinerc|-copy_abook) + return + ;; + -attach|-attachlist|-attach_and_delete|-p|-P|-pinerc|-passfile|-x) + _filedir + return + ;; + -sort) + COMPREPLY=( $( compgen -W 'arrival subject threaded orderedsubject + date from size score to cc' -- "$cur") ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \ + 2>/dev/null)' -- "$cur" ) ) + fi } && -complete -F _pineaddr -o default pine alpine +complete -F _pine pine alpine -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ping b/completions/ping index 7b1f77a0..221fdd51 100644 --- a/completions/ping +++ b/completions/ping @@ -58,4 +58,4 @@ _ping() } && complete -F _ping ping ping6 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkg-config b/completions/pkg-config index f861c30e..a537d497 100644 --- a/completions/pkg-config +++ b/completions/pkg-config @@ -9,7 +9,7 @@ _pkg_config() --define-variable|--atleast-version|--atleast-pkgconfig-version| \ --exact-version|--max-version) # argument required but no completions available - return 0 + return ;; --variable) local i @@ -21,24 +21,24 @@ _pkg_config() break fi done - return 0 + return ;; -\?|--help|--version|--usage) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W "$( pkg-config --list-all \ + COMPREPLY=( $( compgen -W "$( $1 --list-all \ 2>/dev/null | awk '{print $1}' )" -- "$cur" ) ) fi } && complete -F _pkg_config pkg-config -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkg-get b/completions/pkg-get index bf66fcc8..d5382eb2 100644 --- a/completions/pkg-get +++ b/completions/pkg-get @@ -2,8 +2,7 @@ # # Copyright 2006 Yann Rouillard <yann@opencsw.org> -_have pkg-get && -_pkg-get_get_catalog_file() +_pkg_get_get_catalog_file() { local url="$1" local catalog_file i conffile @@ -26,50 +25,49 @@ _pkg-get_get_catalog_file() echo "$catalog_file" } && -_pkg-get() +_pkg_get() { local cur prev file catalog_file url command COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - if [[ "${prev}" = "-s" ]]; then + if [[ "${prev}" == "-s" ]]; then return 1 fi - i=${#COMP_WORDS[*]} + i=${#COMP_WORDS[*]} while [[ $i -gt 0 ]]; do i=$((i-1)) - if [[ "${COMP_WORDS[$i]}" = "-s" ]]; then + if [[ "${COMP_WORDS[$i]}" == -s ]]; then url="${COMP_WORDS[$((i+1))]}" fi - if [[ "${COMP_WORDS[$i]}" == @(available|-a|describe|-D|download|-d|install|-i|list|updatecatalog|-U|upgrade|-u) ]]; then + if [[ "${COMP_WORDS[$i]}" == @(-[aDdiUu]|available|describe|download|install|list|updatecatalog|upgrade) ]]; then command="${COMP_WORDS[$i]}" fi done if [[ -n "$command" ]]; then - if [[ "$command" == @(describe|-D|download|-d|install|-i) ]]; then - catalog_file=$(_pkg-get_get_catalog_file "$url") + if [[ "$command" == @(-[Ddi]|describe|download|install) ]]; then + catalog_file=$(_pkg_get_get_catalog_file "$url") if [[ -f $catalog_file ]]; then local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' $catalog_file) COMPREPLY=( $(compgen -W "${packages_list}" -- ${cur}) ) fi fi - return 0 + return fi if [[ ${cur} == -* ]] ; then local opts="-c -d -D -f -i -l -s -S -u -U -v" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - else - local commands="available describe download install list \ - updatecatalog upgrade" - COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) - return 0 + return fi + + local commands="available describe download install list \ + updatecatalog upgrade" + COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) } && -complete -F _pkg-get pkg-get +complete -F _pkg_get pkg-get -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkg_delete b/completions/pkg_delete index 15770acb..9125829d 100644 --- a/completions/pkg_delete +++ b/completions/pkg_delete @@ -9,13 +9,12 @@ _pkg_delete() local pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0 + [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return - COMPREPLY=( $( compgen -d "$pkgdir$cur" ) ) + COMPREPLY=( $( compgen -d -- "$pkgdir$cur" ) ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) - return 0 } && complete -F _pkg_delete -o dirnames pkg_delete pkg_info pkg_deinstall -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkgadd b/completions/pkgadd index 28098815..009f3a25 100644 --- a/completions/pkgadd +++ b/completions/pkgadd @@ -10,18 +10,18 @@ _pkgadd () # if a device directory was given # we must complete with the package # available in this directory - local device=/var/spool/pkg; + local device=/var/spool/pkg local i=$cword while [[ $((i--)) -gt 0 ]]; do case "${words[$i]}" in -d) - device="${words[$((i+1))]}"; + device="${words[$((i+1))]}" break ;; - esac; - done; + esac + done - case $prev in + case $prev in -d) _filedir pkg _filedir -d @@ -48,7 +48,8 @@ _pkgadd () done pkginst_list="${pkginst_list[@]}" else - pkginst_list=$(strings $(dequote $device) | grep "^PKG=" | sort -u | cut -d= -f2) + pkginst_list=$(strings $(dequote $device) | \ + command grep "^PKG=" | sort -u | cut -d= -f2) fi COMPREPLY=( $(compgen -W "$pkginst_list" -- ${cur}) ) fi @@ -56,4 +57,4 @@ _pkgadd () } && complete -F _pkgadd pkgadd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkgrm b/completions/pkgrm index 24d2a398..891507f8 100644 --- a/completions/pkgrm +++ b/completions/pkgrm @@ -2,26 +2,25 @@ # # Copyright 2006 Yann Rouillard <yann@opencsw.org> -_have pkgrm && _pkgrm () { - local cur prev words cword + local cur prev words cword _init_completion || return # if a spool directory was given # we must complete with the package # available in this directory - local spool=/var/sadm/pkg; + local spool=/var/sadm/pkg local i=$cword while [[ $((i--)) -gt 0 ]]; do - i=$((i-1)); + i=$((i-1)) case "${words[$i]}" in -s) - spool="${words[$((i+1))]}"; + spool="${words[$((i+1))]}" break ;; - esac; - done; + esac + done case $prev in -a | -V) @@ -34,17 +33,14 @@ _pkgrm () ;; *) if [[ ${cur} == -* ]]; then - local opts="-a -A -n -M -R -s -v -V -Y"; - COMPREPLY=($(compgen -W "${opts}" -- ${cur})); - return 0; + local opts="-a -A -n -M -R -s -v -V -Y" + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) else - COMPREPLY=($(compgen -W "$(/bin/ls -1 $spool)" -- ${cur})); - return 0; + COMPREPLY=($(compgen -W "$(/bin/ls -1 $spool)" -- ${cur})) fi ;; esac } && complete -F _pkgrm pkgrm -# ex: ts=4 sw=4 et filetype=sh - +# ex: filetype=sh diff --git a/completions/pkgtool b/completions/pkgtool index 5adcbaf0..95d42aaa 100644 --- a/completions/pkgtool +++ b/completions/pkgtool @@ -8,19 +8,19 @@ _pkgtool() case "$prev" in --source_dir|--target_dir) _filedir -d - return 0 + return ;; --sets) # argument required but no completions available - return 0 + return ;; --source_device) COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) - return 0 + return ;; --tagfile) _filedir - return 0 + return ;; esac @@ -28,9 +28,8 @@ _pkgtool() COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile --source-mounted --source_dir --target_dir --source_device' \ -- "$cur" ) ) - return 0 fi } && complete -F _pkgtool pkgtool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pkgutil b/completions/pkgutil index 06bbeaf0..4b2fcdcd 100644 --- a/completions/pkgutil +++ b/completions/pkgutil @@ -14,7 +14,7 @@ _pkgutil_url2catalog() _pkgutil() { - local cur prev words cword + local cur prev words cword _init_completion -n : || return local command catalog_files configuration_files @@ -23,34 +23,34 @@ _pkgutil() i=$cword while [[ $((i--)) -gt 1 ]]; do - if [[ "${words[$i]}" = @(-t|--temp) ]]; then + if [[ "${words[$i]}" == -@(t|-temp) ]]; then local url="${words[$((i+1))]}" local catalog=$(_pkgutil_url2catalog "$url") catalog_files=("$catalog") - elif [[ "${words[$i]}" = @(--config) ]]; then + elif [[ "${words[$i]}" == --config ]]; then configuration_files=( "$(dequote ${words[$((i+1))]})" ) - elif [[ "${words[$i]}" == @(-i|--install|-u|--upgrade|-r|--remove|-d|--download|-a|--available|-c|--compare|-U|--catalog|-S|--stream) ]]; then - command="${words[$i]}" + elif [[ "${words[$i]}" == -@([iurdacUS]|-install|-upgrade|-remove|-download|-available|-compare|-catalog|-stream) ]]; then + command="${words[$i]}" fi done - if [[ "$prev" = @(-W|--workdir|-P|--pkgdir|-R|--rootpath) ]]; then + if [[ "$prev" == -@([WPR]|-workdir|-pkgdir|-rootpath) ]]; then _filedir -d - return 0 + return fi - if [[ "$prev" = @(-o|--output|--config) ]]; then + if [[ "$prev" == -@(o|-output|-config) ]]; then _filedir - return 0 + return fi - if [[ "$prev" = @(-p|--param) ]]; then + if [[ "$prev" == -@(p|-param) ]]; then compopt -o nospace COMPREPLY=( $(compgen -W "mirror: pkgaddopts: pkgrmopts: wgetopts: use_gpg: use_md5: pkgliststyle: maxpkglist: noncsw: stop_on_hook_soft_error: exclude_pattern: gpg_homedir: root_path: deptree_filter_common: show_current: catalog_not_cached: catalog_update:" -- $cur) ) - return 0 + return fi - if [[ "$prev" = @(-T|--target) ]]; then + if [[ "$prev" == @(-T|--target) ]]; then # Work-around bash_completion issue where bash interprets a colon # as a separator, borrowed from maven completion code which borrowed # it from darcs completion code :) @@ -60,7 +60,7 @@ _pkgutil() while [ $((--i)) -ge 0 ]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"} done - return 0 + return fi if [[ -n "$command" ]] && [[ ! "$cur" == -* ]]; then @@ -73,7 +73,7 @@ _pkgutil() catalog_files=( "${catalog_files[@]}" "$catalog" ) done - if [[ "$command" == @(--download|-d|--install|-i|--upgrade|-u|s|--stream) ]]; then + if [[ "$command" == -@([dius]|-download|-install|-upgrade|-stream) ]]; then local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' "${catalog_files[@]}") COMPREPLY=( $(compgen -W "${packages_list}" -- $cur) ) @@ -83,14 +83,13 @@ _pkgutil() packages_list=$(nawk " \$3 ~ /^$packages_list\$/ { print \$1 }" "${catalog_files[@]}") COMPREPLY=( $(compgen -W "${packages_list}" -- $cur) ) fi - return 0 + return fi local commands="-i --install -u --upgrade -r --remove -d --download -U --catalog -a --available --describe -c --compare -C --compare-diff -A --compare-avail -e --email -t --temp -x --exclude -W --workdir -P --pkgdir -R --rootpath --config -y --yes -f --force -n --nomod -N --nodeps -D --debug --trace -h --help -v --version -V --syscheck -l --list -L --listfile -F --findfile --deptree --extract -s --stream -o --output -T --target --single -p --param --parse --cleanup --catinfo" COMPREPLY=( $(compgen -W "${commands}" -- $cur) ) - return 0 -} +} && complete -F _pkgutil pkgutil -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/plague-client b/completions/plague-client index b5385467..6fd22f75 100644 --- a/completions/plague-client +++ b/completions/plague-client @@ -11,4 +11,4 @@ _plague_client() } && complete -F _plague_client plague-client -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pm-hibernate b/completions/pm-hibernate index 24b30b17..fcabbfaf 100644 --- a/completions/pm-hibernate +++ b/completions/pm-hibernate @@ -9,4 +9,4 @@ _pm_action() } && complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pm-is-supported b/completions/pm-is-supported index 2ca5a9ec..2eeb634d 100644 --- a/completions/pm-is-supported +++ b/completions/pm-is-supported @@ -10,4 +10,4 @@ _pm_is_supported() } && complete -F _pm_is_supported pm-is-supported -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pm-powersave b/completions/pm-powersave index 1f790dca..f61833cf 100644 --- a/completions/pm-powersave +++ b/completions/pm-powersave @@ -9,4 +9,4 @@ _pm_powersave() } && complete -F _pm_powersave pm-powersave -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pngfix b/completions/pngfix new file mode 100644 index 00000000..b1f630ed --- /dev/null +++ b/completions/pngfix @@ -0,0 +1,35 @@ +# pngfix completion -*- shell-script -*- + +_pngfix() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --suffix|--prefix) + return + ;; + --output) + _filedir + return + ;; + --strip) + COMPREPLY=( $( IFS='|' compgen -W '$( "$1" --help 2>&1 | + command sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p" )' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir png +} && +complete -F _pngfix pngfix + +# ex: filetype=sh diff --git a/completions/portinstall b/completions/portinstall index 3b30c5b3..314e936f 100644 --- a/completions/portinstall +++ b/completions/portinstall @@ -16,7 +16,7 @@ _portinstall() [[ "${OSTYPE%.*}" == freebsd5 && -f $indexfile ]] || indexfile=$portsdir/INDEX - [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0 + [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return COMPREPLY=( $( command grep -E "^$cur" 2>/dev/null < $indexfile | \ cut -d'|' -f1 ) ) @@ -25,8 +25,7 @@ _portinstall() COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) COMPREPLY+=( "${COMPREPLY2[@]}" ) - return 0 } && complete -F _portinstall -o dirnames portinstall -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/portsnap b/completions/portsnap new file mode 100644 index 00000000..f865183b --- /dev/null +++ b/completions/portsnap @@ -0,0 +1,25 @@ +# bash completion for Portsnap -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_portsnap() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -d|-p) + _filedir -d + return + ;; + -l|-f) + _filedir + return + ;; + esac + + COMPREPLY=( $(compgen -W "fetch cron extract update" -- $cur) ) +} && +complete -F _portsnap portsnap + +# ex: filetype=sh diff --git a/completions/portupgrade b/completions/portupgrade index 96e4fb6d..64d983df 100644 --- a/completions/portupgrade +++ b/completions/portupgrade @@ -5,16 +5,15 @@ _portupgrade() local cur prev words cword _init_completion || return - [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0 + [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return local pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - COMPREPLY=( $( compgen -d "$pkgdir$cur" ) ) + COMPREPLY=( $( compgen -d -- "$pkgdir$cur" ) ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) COMPREPLY=( ${COMPREPLY[@]%-*} ) - return 0 } && complete -F _portupgrade -o dirnames portupgrade -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/postcat b/completions/postcat index c601cb0c..69214354 100644 --- a/completions/postcat +++ b/completions/postcat @@ -8,35 +8,34 @@ _postcat() case $prev in -c) _filedir -d - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi local idx qfile=0 for idx in "${words[@]}"; do - [[ "$idx" = -q ]] && qfile=1 && break + [[ "$idx" == -q ]] && qfile=1 && break done if [[ $qfile -eq 1 ]]; then local len=${#cur} pval idx=0 for pval in $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done - return 0 - else - _filedir - return 0 + return fi + + _filedir } && complete -F _postcat postcat -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/postconf b/completions/postconf index 5b998d9e..c1f17d9d 100644 --- a/completions/postconf +++ b/completions/postconf @@ -10,11 +10,11 @@ _postconf() case $prev in -b|-t) _filedir - return 0 + return ;; -c) _filedir -d - return 0 + return ;; -e) cur=${cur#[\"\']} @@ -24,7 +24,7 @@ _postconf() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi local len=${#cur} idx=0 pval @@ -34,8 +34,7 @@ _postconf() idx=$(($idx+1)) fi done - return 0 } && complete -F _postconf postconf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/postfix b/completions/postfix index b74bcafe..9b116be1 100644 --- a/completions/postfix +++ b/completions/postfix @@ -8,17 +8,17 @@ _postfix() case $prev in -c) _filedir -d - return 0 + return ;; -D) COMPREPLY=( $( compgen -W 'start' -- "$cur" ) ) - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -W 'check start stop abort flush reload status @@ -26,4 +26,4 @@ _postfix() } && complete -F _postfix postfix -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/postmap b/completions/postmap index 001db9b5..1b415f69 100644 --- a/completions/postmap +++ b/completions/postmap @@ -8,16 +8,16 @@ _postmap() case $prev in -c) _filedir -d - return 0 + return ;; -[dq]) - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi if [[ "$cur" == *:* ]]; then @@ -36,8 +36,7 @@ _postmap() COMPREPLY=( $( compgen -f -- "$cur" ) ) fi fi - return 0 } && complete -F _postmap postmap postalias -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/postsuper b/completions/postsuper index 25bc916f..e69cbea0 100644 --- a/completions/postsuper +++ b/completions/postsuper @@ -10,53 +10,53 @@ _postsuper() case $prev in -c) _filedir -d - return 0 + return ;; -[dr]) len=${#cur} idx=0 for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done - return 0 + return ;; -h) len=${#cur} idx=0 for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done - return 0 + return ;; -H) len=${#cur} idx=0 for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) } && complete -F _postsuper postsuper -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/povray b/completions/povray index fa2f9812..e90279b3 100644 --- a/completions/povray +++ b/completions/povray @@ -9,7 +9,7 @@ _povray() local povcur=$cur pfx oext defoext defoext=png # default output extension, if cannot be determined FIXME - _expand || return 0 + _expand || return case $povcur in [-+]I*) @@ -17,7 +17,7 @@ _povray() pfx="${povcur%"$cur"}" _filedir pov COMPREPLY=( ${COMPREPLY[@]/#/$pfx} ) - return 0 + return ;; [-+]O*) # guess what output file type user may want @@ -35,24 +35,24 @@ _povray() pfx="${povcur%"$cur"}" _filedir $oext COMPREPLY=( ${COMPREPLY[@]/#/$pfx} ) - return 0 + return ;; *.ini\[|*.ini\[*[^]]) # sections in .ini files cur="${povcur#*\[}" pfx="${povcur%\["$cur"}" # prefix == filename - [[ -r $pfx ]] || return 0 - COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \ + [[ -r $pfx ]] || return + COMPREPLY=( $(command sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \ -e 't' -e 'd' -- "$pfx") ) # to prevent [bar] expand to nothing. can be done more easily? COMPREPLY=( "${COMPREPLY[@]/#/$pfx[}" ) - return 0 + return ;; *) _filedir '@(ini|pov)' - return 0 + return ;; esac } && complete -F _povray povray xpovray spovray -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/prelink b/completions/prelink index f84261d1..0db3140c 100644 --- a/completions/prelink +++ b/completions/prelink @@ -39,4 +39,4 @@ _prelink() } && complete -F _prelink prelink -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/protoc b/completions/protoc index 4621cf64..1d4bef16 100644 --- a/completions/protoc +++ b/completions/protoc @@ -49,7 +49,7 @@ _protoc() COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) local i for i in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[i]} == -oFILE ]] && unset COMPREPLY[i] + [[ ${COMPREPLY[i]} == -oFILE ]] && unset 'COMPREPLY[i]' done [[ $COMPREPLY == *= ]] && compopt -o nospace return @@ -60,4 +60,4 @@ _protoc() } && complete -F _protoc protoc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/psql b/completions/psql index 186177a3..668bb9ef 100644 --- a/completions/psql +++ b/completions/psql @@ -4,14 +4,14 @@ _pg_databases() { # -w was introduced in 8.4, https://launchpad.net/bugs/164772 # "Access privileges" in output may contain linefeeds, hence the NF > 1 - COMPREPLY=( $( compgen -W "$( psql -AtqwlF $'\t' 2>/dev/null | \ + COMPREPLY=( $( compgen -W "$( psql -XAtqwlF $'\t' 2>/dev/null | \ awk 'NF > 1 { print $1 }' )" -- "$cur" ) ) } _pg_users() { # -w was introduced in 8.4, https://launchpad.net/bugs/164772 - COMPREPLY=( $( compgen -W "$( psql -Atqwc 'select usename from pg_user' \ + COMPREPLY=( $( compgen -W "$( psql -XAtqwc 'select usename from pg_user' \ template1 2>/dev/null )" -- "$cur" ) ) [[ ${#COMPREPLY[@]} -eq 0 ]] && COMPREPLY=( $( compgen -u -- "$cur" ) ) } @@ -26,23 +26,23 @@ _createdb() case $prev in -h|--host) _known_hosts_real "$cur" - return 0 + return ;; -U|--username|-O|--owner) _pg_users - return 0 + return ;; -p|--port|-D|--tablespace|-E|--encoding|-T|--template) # argument required but no completions available - return 0 + return ;; --help|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -51,7 +51,37 @@ _createdb() _pg_databases fi } && -complete -F _createdb -o default createdb +complete -F _createdb createdb + +# createuser(1) completion +# +_createuser() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version|-p|--port|-c|--connection-limit) + return + ;; + -h|--host) + _known_hosts_real "$cur" + return + ;; + -U|--username) + _pg_users + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _createuser createuser # dropdb(1) completion # @@ -63,19 +93,19 @@ _dropdb() case $prev in -h|--host) _known_hosts_real "$cur" - return 0 + return ;; -U|--username) _pg_users - return 0 + return ;; --help|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -84,7 +114,39 @@ _dropdb() _pg_databases fi } && -complete -F _dropdb -o default dropdb +complete -F _dropdb dropdb + +# dropuser(1) completion +# +_dropuser() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version|-p|--port) + return + ;; + -h|--host) + _known_hosts_real "$cur" + return + ;; + -U|--username) + _pg_users + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _pg_users + fi +} && +complete -F _dropuser dropuser # psql(1) completion # @@ -96,32 +158,32 @@ _psql() case $prev in -h|--host) _known_hosts_real "$cur" - return 0 + return ;; -U|--username) _pg_users - return 0 + return ;; -d|--dbname) _pg_databases - return 0 + return ;; -o|--output|-f|--file|-L|--log-file) _filedir - return 0 + return ;; -c|--command|-F|--field-separator|-p|--port|-P|--pset|\ -R|--record-separator|-T|--table-attr|-v|--set|--variable) # argument required but no completions available - return 0 + return ;; -\?|--help|-V|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then # return list of available options @@ -134,4 +196,4 @@ _psql() } && complete -F _psql psql -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/puppet b/completions/puppet index f24917a7..b36b0341 100644 --- a/completions/puppet +++ b/completions/puppet @@ -21,8 +21,8 @@ _puppet_certs() PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetca &>/dev/null \ && puppetca=puppetca - if [[ "$1" = '--all' ]]; then - cert_list=$( $puppetca --list --all | sed -e 's/^[+-]\?\s*\(\S\+\)\s\+.*$/\1/' ) + if [[ "$1" == --all ]]; then + cert_list=$( $puppetca --list --all | command sed -e 's/^[+-]\{0,1\}\s*\(\S\+\)\s\+.*$/\1/' ) else cert_list=$( $puppetca --list ) fi @@ -31,7 +31,7 @@ _puppet_certs() _puppet_types() { - puppet_types=$( puppet describe --list | sed -e 's/^\(\S\+\).*$/\1/' ) + puppet_types=$( puppet describe --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/' ) COMPREPLY+=( $( compgen -W "$puppet_types" -- "$cur" ) ) } @@ -41,270 +41,287 @@ _puppet_references() PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetdoc &>/dev/null \ && puppetdoc=puppetdoc - puppet_doc_list=$( $puppetdoc --list | sed -e 's/^\(\S\+\).*$/\1/' ) + puppet_doc_list=$( $puppetdoc --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/' ) COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) ) } +_puppet_subcmd_opts() +{ + # puppet cmd help is somewhat slow, avoid if possible + [[ -z $cur || $cur == -* ]] && \ + COMPREPLY+=( $( compgen -W \ + '$( _parse_usage "$1" "help $2" )' -- "$cur" ) ) +} + _puppet() { local cur prev words cword _init_completion || return - local xspec helpopts command subcommand + local xspec helpopts subcommand action case $prev in - --help) - return 0 + -h|--help|-V|--version) + return ;; esac case ${words[0]} in puppetmasterd) - command=master + subcommand=master ;; puppetd) - command=agent + subcommand=agent ;; puppetca) - command=cert + subcommand=cert ;; ralsh) - command=resource + subcommand=resource ;; puppetrun) - command=kick + subcommand=kick ;; puppetqd) - command=queue + subcommand=queue ;; filebucket) - command=filebucket + subcommand=filebucket ;; puppetdoc) - command=doc + subcommand=doc ;; pi) - command=describe + subcommand=describe ;; puppet) case ${words[1]} in - agent|apply|cert|describe|doc|filebucket|kick|master|queue|resource) - command=${words[1]} - ;; - *.pp|*.rb|-*) - command=apply - ;; - *) - COMPREPLY=( $( compgen -W 'agent apply cert describe doc - filebucket kick master queue resource' -- "$cur" ) ) - return 0 - ;; + agent|apply|cert|describe|doc|filebucket|kick|master|parser|queue|resource) + subcommand=${words[1]} + ;; + *.pp|*.rb) + subcommand=apply + ;; + *) + COMPREPLY=( $( compgen -W 'agent apply cert describe doc + filebucket kick master parser queue resource' \ + -- "$cur" ) ) + return + ;; esac esac - case $command in + case $subcommand in agent) case $prev in + --certname) + _known_hosts_real "$cur" + return + ;; + --digest) + _puppet_digest + return + ;; --fqdn) - return 0 + _known_hosts_real "$cur" + return ;; - --logdest) + -l|--logdest) _puppet_logdest - return 0 - ;; - --serve) - # From /usr/lib/ruby/1.8/puppet/network/handler/ - COMPREPLY=( $( compgen -W 'ca filebucket fileserver master - report runner status' -- "$cur" ) ) - return 0 + return ;; - --digest) - _puppet_digest - return 0 + --masterport) + COMPREPLY=( $( compgen -W '8140' -- "$cur" ) ) + return ;; - --waitforcert) + -w|--waitforcert) COMPREPLY=( $( compgen -W '0 15 30 60 120' -- "$cur" ) ) - return 0 + return ;; *) - COMPREPLY=( $( compgen -W '--daemonize --no-daemonize - --debug --detailed-exitcodes --disable --enable --help - --fqdn --logdest --onetime --serve --test --noop - --digest --fingerprint --version --verbose - --waitforcert --no-client' -- "$cur" ) ) - return 0 + _puppet_subcmd_opts "$1" $subcommand + # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] + COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) ) + return esac ;; apply) case $prev in - --logdest) + --catalog) + COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + _filedir json + return + ;; + --execute) + return + ;; + -l|--logdest) _puppet_logdest - return 0 + return ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version --debug - --verbose --execute --detailed-exitcodes - --logdest' -- "$cur" ) ) + _puppet_subcmd_opts "$1" $subcommand else _filedir fi - return 0 + return esac ;; cert) case $prev in --digest) _puppet_digest - return 0 + return ;; *) - subcommand=$prev - COMPREPLY=( $( compgen -W '--digest --debug --verbose' \ + action=$prev + COMPREPLY=( $( compgen -W '--digest --debug --help --verbose --version' \ -- "$cur" ) ) - case $subcommand in - --generate) + case $action in + fingerprint|list|verify|--fingerprint|--list|--verify) + COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) + _puppet_certs --all + return + ;; + generate|--generate) _known_hosts_real "$cur" - return 0 + return ;; - --clean|--fingerprint|--revoke|--verify) - COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) + clean|print|revoke|--clean|--print|--revoke) _puppet_certs --all - return 0 + return ;; - --sign) + sign|--sign) COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) _puppet_certs - return 0 - ;; - --list|--print) - COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) - return 0 + return ;; *) - COMPREPLY=( $( compgen -W '--clean --generate - --help --list --print --fingerprint --revoke - --sign --version --verify' -- "$cur" ) ) - return 0 + COMPREPLY+=( $( compgen -W 'clean fingerprint generate + list print revoke sign verify reinventory' -- "$cur" ) ) + return esac esac ;; describe) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --short --providers --list - --meta' -- "$cur" ) ) - else + _puppet_subcmd_opts "$1" $subcommand + if [[ "$cur" != -* ]]; then _puppet_types fi - return 0 + return ;; doc) case $prev in - --outputdir) + -o|--outputdir) _filedir -d - return 0 + return ;; - --mode) + -m|--mode) COMPREPLY=( $( compgen -W 'text trac pdf rdoc' -- "$cur" ) ) - return 0 + return ;; - --reference) + -r|--reference) _puppet_references - return 0 + return ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --help --outputdir - --mode --reference --charset --list' -- "$cur" ) ) + _puppet_subcmd_opts "$1" $subcommand else _filedir fi - return 0 + return esac ;; filebucket) case $prev in - --server) + -s|--server) _known_hosts_real "$cur" - return 0 + return ;; - --bucket) + -b|--bucket) _filedir -d - return 0 + return ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version --debug - --verbose --local --remote --server --bucket' \ - -- "$cur" ) ) + _puppet_subcmd_opts "$1" $subcommand else COMPREPLY=( $( compgen -W 'backup get restore' \ -- "$cur" ) ) _filedir fi - return 0 + return esac ;; kick) case $prev in - --class) - return 0 + -c|--class) + return ;; --host) _known_hosts_real "$cur" - return 0 + return ;; - --tag) - return 0 + -t|--tag) + return ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --class --debug - --foreground --help --host --no-fqdn - --ignoreschedules --tag --test --ping' -- "$cur" ) ) + _puppet_subcmd_opts "$1" $subcommand else _known_hosts_real "$cur" fi - return 0 + return esac ;; master) case $prev in - --logdest) + -l|--logdest) _puppet_logdest - return 0 + return ;; *) - COMPREPLY=( $( compgen -W '--daemonize --no-daemonize - --debug --help --logdest --verbose --version' \ - -- "$cur" ) ) - return 0 + _puppet_subcmd_opts "$1" $subcommand + # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] + COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) ) + return + esac + ;; + parser) + action=$prev + case $action in + validate) + _filedir pp + return + ;; + *) + COMPREPLY=( $( compgen -W 'validate' -- "$cur" ) ) + return esac ;; queue) case $prev in - --logdest) + -l|--logdest) _puppet_logdest - return 0 + return ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version --debug - --verbose --execute --detailed-exitcodes - --logdest' -- "$cur" ) ) + _puppet_subcmd_opts "$1" $subcommand else _filedir fi - return 0 + return esac ;; resource|*) - COMPREPLY=( $( compgen -W '--help --version --debug --verbose' \ - -- "$cur" ) ) - return 0 + _puppet_subcmd_opts "$1" $subcommand + return ;; esac } && complete -F _puppet puppetmasterd puppetd puppetca ralsh puppetrun puppetqd filebucket puppetdoc puppet -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pwck b/completions/pwck index 0ed0debc..468aa7c6 100644 --- a/completions/pwck +++ b/completions/pwck @@ -7,11 +7,11 @@ _pwck() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _pwck pwck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pwd b/completions/pwd index ca00a3ff..f4a558a2 100644 --- a/completions/pwd +++ b/completions/pwd @@ -17,4 +17,4 @@ _pwd() } && complete -F _pwd pwd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pwdx b/completions/pwdx index e91d9bf4..ed8d3ec2 100644 --- a/completions/pwdx +++ b/completions/pwdx @@ -5,14 +5,20 @@ _pwdx() local cur prev words cword _init_completion || return - [[ $prev == -V ]] && return + case $prev in + -h|--help|-V|--version) + return + ;; + esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-V' -- "$cur" ) ) + local help='$( _parse_help "$1" )' + [[ $help ]] || help=-V + COMPREPLY=( $( compgen -W "$help" -- "$cur" ) ) else _pids fi } && complete -F _pwdx pwdx -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pwgen b/completions/pwgen index 3aa39a5c..d30526e9 100644 --- a/completions/pwgen +++ b/completions/pwgen @@ -25,4 +25,4 @@ _pwgen() } && complete -F _pwgen pwgen -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/py.test b/completions/py.test new file mode 100644 index 00000000..6362bf0a --- /dev/null +++ b/completions/py.test @@ -0,0 +1,71 @@ +# bash completion for py.test(1) -*- shell-script -*- + +_py_test() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-k|-m|--maxfail|-r|--report|--junit-prefix|--doctest-glob|-p) + return + ;; + --import-mode) + COMPREPLY=( $( compgen -W "prepend append" -- "$cur" ) ) + return + ;; + --capture) + COMPREPLY=( $( compgen -W "fd sys no" -- "$cur" ) ) + return + ;; + --tb) + COMPREPLY=( $( compgen -W "auto long short line native no" \ + -- "$cur" ) ) + return + ;; + --color) + COMPREPLY=( $( compgen -W "yes no auto" -- "$cur" ) ) + return + ;; + --pastebin) + COMPREPLY=( $( compgen -W "failed all" -- "$cur" ) ) + return + ;; + --junit-xml) + _filedir xml + return + ;; + --result-log) + _filedir log + return + ;; + --ignore) + _filedir + return + ;; + --confcutdir|--basetemp) + _filedir -d + return + ;; + --assert) + COMPREPLY=( $( compgen -W "plain reinterp rewrite" -- "$cur" ) ) + return + ;; + --genscript) + _filedir py + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _py_test py.test py.test-2 py.test-3 + +# ex: filetype=sh diff --git a/completions/pydoc b/completions/pydoc index 2783d174..0e750cbb 100644 --- a/completions/pydoc +++ b/completions/pydoc @@ -17,7 +17,7 @@ _pydoc() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W \ - '$( "$1" | sed -e "s/^pydoc3\{0,1\} //" | _parse_help - )' \ + '$( "$1" | command sed -e "s/^pydoc3\{0,1\} //" | _parse_help - )' \ -- "$cur" ) ) return fi @@ -30,10 +30,10 @@ _pydoc() # Note that we don't do "pydoc modules" as it is known to hang on # some systems; _python_modules tends to work better and faster. COMPREPLY+=( $( compgen -W \ - '$( $1 keywords topics | sed -e /^Here/d )' -- "$cur" ) ) + '$( $1 keywords topics | command sed -e /^Here/d )' -- "$cur" ) ) _filedir py } && complete -F _pydoc pydoc pydoc3 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pyflakes b/completions/pyflakes new file mode 100644 index 00000000..05025263 --- /dev/null +++ b/completions/pyflakes @@ -0,0 +1,23 @@ +# pyflakes(1) completion -*- shell-script -*- + +_pyflakes() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|--version) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + _filedir py +} && +complete -F _pyflakes pyflakes + +# ex: filetype=sh diff --git a/completions/pylint b/completions/pylint index 8c69dce9..0383c7e2 100644 --- a/completions/pylint +++ b/completions/pylint @@ -63,4 +63,4 @@ _pylint() } && complete -F _pylint pylint -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/python b/completions/python index 9c7cec13..758b44ef 100644 --- a/completions/python +++ b/completions/python @@ -2,56 +2,62 @@ _python_modules() { - COMPREPLY+=( $( compgen -W "$( ${1:-python} -c 'import pkgutil -for mod in pkgutil.iter_modules(): print(mod[1])' )" 2>/dev/null -- "$cur" ) ) + COMPREPLY+=( $( compgen -W \ + "$( ${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python 2>/dev/null )" \ + -- "$cur" ) ) } _python() { - local cur prev words cword + local cur prev words cword prefix _init_completion || return + case $cur in + -[QWX]?*) + prefix=${cur:0:2} + prev=$prefix + cur=${cur:2} + ;; + esac + case $prev in - -'?'|-h|--help|-V|--version|-c) - return 0 + -'?'|-h|--help|-V|--version|-c|-X) + return ;; -m) _python_modules "$1" - return 0 + return ;; -Q) - COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "old new warn warnall" -P "$prefix" \ + -- "$cur" ) ) + return ;; -W) COMPREPLY=( $( compgen -W "ignore default all module once error" \ - -- "$cur" ) ) - return 0 + -P "$prefix" -- "$cur" ) ) + return ;; - !(?(*/)python*([0-9.])|-?)) - [[ $cword -lt 2 || ${words[cword-2]} != -@(Q|W) ]] \ - && _filedir + --jit) + # TODO: quite a few others, parse from "--jit help" output? + COMPREPLY=( $( compgen -W "help off" -- "$cur" ) ) + return + ;; + !(?(*/)python*([0-9.])|?(*/)pypy*([0-9.])|-?)) + [[ $cword -lt 2 || ${words[cword-2]} != -[QWX] ]] && _filedir ;; esac - # if '-c' is already given, complete all kind of files. - local i - for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == -c ]]; then - _filedir - fi - done - - - if [[ "$cur" != -* ]]; then - _filedir 'py?([co])' + # if -c or -m is already given, complete all kind of files. + if [[ "${words[@]::$cword}" == *\ -[cm]\ * ]]; then + _filedir + elif [[ "$cur" != -* ]]; then + _filedir 'py?([cowz])' else COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) fi - - return 0 } && -complete -F _python python python2 python3 +complete -F _python python python2 python3 pypy pypy3 micropython -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/pyvenv b/completions/pyvenv new file mode 100644 index 00000000..8e366a01 --- /dev/null +++ b/completions/pyvenv @@ -0,0 +1,25 @@ +# bash completion for pyvenv -*- shell-script -*- + +_pyvenv() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + _longopt "$1" + return + fi + + _filedir -d +} && +complete -F _pyvenv pyvenv pyvenv-3.{4..5} + +# ex: filetype=sh diff --git a/completions/qdbus b/completions/qdbus index a098fbc9..dee0760a 100644 --- a/completions/qdbus +++ b/completions/qdbus @@ -5,10 +5,10 @@ _qdbus() local cur prev words cword _init_completion || return - [[ -n $cur ]] && unset words[${#words[@]}-1] + [[ -n $cur ]] && unset "words[$((${#words[@]}-1))]" COMPREPLY=( $( compgen -W '$( command ${words[@]} 2>/dev/null | \ - sed s/\(.*\)// )' -- "$cur" ) ) + command sed "s/(.*)//" )' -- "$cur" ) ) } && complete -F _qdbus qdbus dcop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/qemu b/completions/qemu index 3899715a..724e7a5f 100644 --- a/completions/qemu +++ b/completions/qemu @@ -9,91 +9,91 @@ _qemu() -fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \ -loadvm|-mtdblock|-sd|-pflash|-bios) _filedir - return 0 + return ;; -tftp|-smb|-L|-chroot) _filedir -d - return 0 + return ;; -boot) COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) ) - return 0 + return ;; -k) COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr' -- "$cur" ) ) - return 0 + return ;; -soundhw) - COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \ + COMPREPLY=( $( compgen -W "$( $1 -soundhw ? | awk \ '/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) ) - return 0 + return ;; -M) - COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \ + COMPREPLY=( $( compgen -W "$( $1 -M ? | awk \ '/^[[:lower:]]/ {print $1}' )" -- "$cur" ) ) - return 0 + return ;; -cpu) - COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \ + COMPREPLY=( $( compgen -W "$( $1 -cpu ? | awk \ '{print $2}' )" -- "$cur" ) ) - return 0 + return ;; -usbdevice) COMPREPLY=( $( compgen -W 'mouse tablet disk: host: serial: braille net' -- "$cur" ) ) - return 0 + return ;; -net) COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \ -- "$cur" ) ) - return 0 + return ;; -serial|-parallel|-monitor) COMPREPLY=( $( compgen -W 'vc pty none null /dev/ file: stdio pipe: COM udp: tcp: telnet: unix: mon: braille' -- "$cur" ) ) - return 0 + return ;; -redir) COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) ) - return 0 + return ;; -bt) COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) ) - return 0 + return ;; -vga) COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' \ -- "$cur" ) ) - return 0 + return ;; -drive) COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media cyls snapshot cache format serial addr' -- "$cur" ) ) - return 0 + return ;; - -ballon) + -balloon) COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) ) - return 0 + return ;; -smbios) COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) ) - return 0 + return ;; -watchdog) - COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | \ + COMPREPLY=( $( compgen -W "$( $1 -watchdog ? 2>&1 | \ awk '{print $1}' )" -- "$cur" ) ) - return 0 + return ;; -watchdog-action) COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause debug none' -- "$cur" ) ) - return 0 + return ;; -runas) _allowed_users - return 0 + return ;; esac @@ -105,6 +105,6 @@ _qemu() _filedir fi } && -complete -F _qemu qemu +complete -F _qemu qemu qemu-kvm qemu-system-i386 qemu-system-x86_64 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/qrunner b/completions/qrunner index d92c011b..4e02a175 100644 --- a/completions/qrunner +++ b/completions/qrunner @@ -5,7 +5,7 @@ _qrunner() local cur prev words cword split _init_completion -s || return - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--runner --once --list --verbose --subproc @@ -15,4 +15,4 @@ _qrunner() } && complete -F _qrunner qrunner -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/querybts b/completions/querybts index 9e28887a..e08c905c 100644 --- a/completions/querybts +++ b/completions/querybts @@ -9,15 +9,15 @@ _querybts() -B|--bts) COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \ -- "$cur" ) ) - return 0 + return ;; -u|--ui|--interface) COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '-h --help -v --version -A --archive -B --bts -l --ldap --no-ldap --proxy --http_proxy -s --source -w --web -u --ui @@ -30,4 +30,4 @@ _querybts() } && complete -F _querybts querybts -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/quota b/completions/quota index 626a3802..c1604f8e 100644 --- a/completions/quota +++ b/completions/quota @@ -8,7 +8,7 @@ _user_or_group() for (( i=1; i < cword; i++ )); do if [[ "${words[i]}" == -@(g|-group) ]]; then COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 + return fi done @@ -45,14 +45,14 @@ _quota() case $prev in -F|--format) _quota_formats - return 0 + return ;; -h|--help|-V|--version) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then _quota_parse_help "$1" @@ -70,18 +70,18 @@ _setquota() case $prev in -F|--format) _quota_formats - return 0 + return ;; -p|--prototype) _user_or_group - return 0 + return ;; -h|--help|-V|--version) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then _quota_parse_help "$1" @@ -110,22 +110,22 @@ _edquota() case $prev in -F|--format) _quota_formats - return 0 + return ;; -f|--filesystem) _filesystems - return 0 + return ;; -p|--prototype) _user_or_group - return 0 + return ;; -h|--help|-V|--version) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then _quota_parse_help "$1" @@ -143,14 +143,14 @@ _quotacheck() case $prev in -F|--format) _quota_formats - return 0 + return ;; -h|--help|-V|--version) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then _quota_parse_help "$1" @@ -168,18 +168,18 @@ _quotaon() case $prev in -F|--format) _quota_formats - return 0 + return ;; -x|--xfs-command) COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) ) - return 0 + return ;; -h|--help|-V|--version) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then _quota_parse_help "$1" @@ -189,4 +189,4 @@ _quotaon() } && complete -F _quotaon -o default quotaon quotaoff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rcs b/completions/rcs index 67c1c9d8..d63fe170 100644 --- a/completions/rcs +++ b/completions/rcs @@ -13,7 +13,7 @@ _rcs() # deal with relative directory [[ $file == $dir ]] && dir=. - COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) ) + COMPREPLY=( $( compgen -f -- "$dir/RCS/$file" ) ) for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do file=${COMPREPLY[$i]##*/} @@ -33,4 +33,4 @@ _rcs() } && complete -F _rcs ci co rlog rcs rcsdiff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rdesktop b/completions/rdesktop index 50273f2d..acc43098 100644 --- a/completions/rdesktop +++ b/completions/rdesktop @@ -13,15 +13,15 @@ _rdesktop() COMPREPLY+=( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) ) COMPREPLY+=( $( command ls ./keymaps 2>/dev/null ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 + return ;; -a) COMPREPLY=( $( compgen -W '8 15 16 24' -- "$cur" ) ) - return 0 + return ;; -x) COMPREPLY=( $( compgen -W 'broadband modem lan' -- "$cur" ) ) - return 0 + return ;; -r) case $cur in @@ -37,10 +37,10 @@ _rdesktop() [[ $COMPREPLY == *: ]] && compopt -o nospace ;; esac - return 0 + return ;; -u|-d|-s|-c|-p|-n|-g|-S|-T|-X) - return 0 + return ;; esac @@ -54,4 +54,4 @@ _rdesktop() } && complete -F _rdesktop rdesktop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/remove_members b/completions/remove_members index 5003fcab..66dbfda6 100644 --- a/completions/remove_members +++ b/completions/remove_members @@ -8,11 +8,11 @@ _remove_members() case $prev in -f|--file) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--file --all --fromall --nouserack @@ -24,4 +24,4 @@ _remove_members() } && complete -F _remove_members remove_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/removepkg b/completions/removepkg index 287952cb..eaeb70a7 100644 --- a/completions/removepkg +++ b/completions/removepkg @@ -20,4 +20,4 @@ _removepkg() } && complete -F _removepkg removepkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/reportbug b/completions/reportbug index 83be47f5..1049d194 100644 --- a/completions/reportbug +++ b/completions/reportbug @@ -8,35 +8,35 @@ _reportbug() case $prev in -f|--filename|-i|--include|--mta|-o|--output) _filedir - return 0 + return ;; -B|--bts) COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ "$cur" ) ) - return 0 + return ;; -e|--editor|--mua) words=( words[0] "$cur" ) cword=1 _command - return 0 + return ;; --mode) COMPREPLY=( $( compgen -W "novice standard expert" -- "$cur" ) ) - return 0 + return ;; -S|--severity) COMPREPLY=( $( compgen -W "grave serious important normal minor wishlist" -- "$cur" ) ) - return 0 + return ;; -u|--ui|--interface) COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) ) - return 0 + return ;; -t|--type) COMPREPLY=( $( compgen -W "gnats debbugs" -- "$cur" ) ) - return 0 + return ;; -T|--tag) COMPREPLY=( $( compgen -W "none woody potato sarge sarge-ignore @@ -44,12 +44,12 @@ _reportbug() d-i fixed fixed-in-experimental fixed-upstream help l10n moreinfo patch pending security unreproducible upstream wontfix ipv6 lfs" -- "$cur" ) ) - return 0 + return ;; --from-buildd) COMPREPLY=( $( compgen -S "_" -W '$( apt-cache dumpavail | \ command grep "^Source: $cur" | sort -u | cut -f2 -d" " )' )) - return 0 + return ;; *) ;; @@ -75,8 +75,7 @@ _reportbug() security.debian.org tech-ctte upgrade-reports www.debian.org' \ -- "$cur" ) $( apt-cache pkgnames -- "$cur" 2> /dev/null ) ) _filedir - return 0 } && complete -F _reportbug reportbug -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/resolvconf b/completions/resolvconf index c2f1b42b..1902e7d1 100644 --- a/completions/resolvconf +++ b/completions/resolvconf @@ -8,7 +8,7 @@ _resolvconf() case $prev in -a|-d) _available_interfaces - return 0 + return ;; esac @@ -18,4 +18,4 @@ _resolvconf() } && complete -F _resolvconf resolvconf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rfkill b/completions/rfkill index 305f19d1..a3741d22 100644 --- a/completions/rfkill +++ b/completions/rfkill @@ -15,7 +15,7 @@ _rfkill() ;; 2) if [[ $prev == block || $prev == unblock ]]; then - COMPREPLY=( $( compgen -W "$(rfkill list | awk -F: \ + COMPREPLY=( $( compgen -W "$($1 list | awk -F: \ '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ wwan gps" -- "$cur" ) ) fi @@ -25,4 +25,4 @@ _rfkill() } && complete -F _rfkill rfkill -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ri b/completions/ri index 62a9b709..16e44664 100644 --- a/completions/ri +++ b/completions/ri @@ -34,10 +34,36 @@ _ri_get_methods() # needs at least Ruby 1.8.0 in order to use -W0 _ri() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s -n : || return - local class method prefix ri_path ri_version separator IFS + case $prev in + -h|--help|-w|--width) + return + ;; + -f|--format) + COMPREPLY=( $( compgen -W 'ansi bs html rdoc' -- "$cur" ) ) + return + ;; + -d|--doc-dir) + _filedir -d + return + ;; + --dump) + _filedir ri + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local class method prefix ri_path ri_version ri_major separator IFS local -a classes ri_path=$(type -p ri) @@ -46,6 +72,7 @@ _ri() # from being captured when used with Ruby 1.8.1 and later ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated [[ $ri_version != ${ri_version%200*} ]] && ri_version=integrated + [[ $ri_version =~ ri[[:space:]]v?([0-9]+) ]] && ri_major=${BASH_REMATCH[1]} # need to also split on commas IFS=$', \n\t' @@ -57,13 +84,15 @@ _ri() classes=( $class ) prefix="-P $class$separator" _ri_get_methods - return 0 + return fi if [[ $ri_version == integrated ]]; then # integrated ri from Ruby 1.9 classes=( $( ri -c 2>/dev/null | ruby -ne 'if /^\s*$/..$stdin.eof then \ if /, [A-Z]+/ then print; end; end' 2>/dev/null ) ) + elif [[ $ri_major && $ri_major -ge 3 ]]; then + classes=( $( ri -l 2>/dev/null ) ) elif [[ $ri_version == "ri 1.8a" ]]; then classes=( $( ruby -W0 $ri_path | \ ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ @@ -75,9 +104,11 @@ _ri() fi COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) ) + __ltrim_colon_completions "$cur" + if [[ "$cur" == [A-Z]* ]]; then # we're completing on class or module alone - return 0 + return fi # we're completing on methods @@ -86,4 +117,4 @@ _ri() } && complete -F _ri ri -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rmlist b/completions/rmlist index dd31333c..ff827473 100644 --- a/completions/rmlist +++ b/completions/rmlist @@ -14,4 +14,4 @@ _rmlist() } && complete -F _rmlist rmlist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rmmod b/completions/rmmod index 20d3bfce..9868c79a 100644 --- a/completions/rmmod +++ b/completions/rmmod @@ -18,8 +18,7 @@ _rmmod() fi _installed_modules "$cur" - return 0 } && complete -F _rmmod rmmod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/route b/completions/route index 40d4f490..128ebc16 100644 --- a/completions/route +++ b/completions/route @@ -9,7 +9,7 @@ _route() if [[ $prev == dev ]]; then _available_interfaces - return 0 + return fi # Remove already given options from completions @@ -27,4 +27,4 @@ _route() } && complete -F _route route -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rpcdebug b/completions/rpcdebug index 3501af13..4eb332fd 100644 --- a/completions/rpcdebug +++ b/completions/rpcdebug @@ -13,7 +13,7 @@ _rpcdebug_flags() if [[ -n $module ]]; then COMPREPLY=( $( compgen -W "$( rpcdebug -vh 2>&1 | \ - sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) ) + command sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) ) fi } @@ -25,15 +25,15 @@ _rpcdebug() case $prev in -s) _rpcdebug_flags - return 0 + return ;; -c) _rpcdebug_flags - return 0 + return ;; -m) COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) ) - return 0 + return ;; esac @@ -44,4 +44,4 @@ _rpcdebug() } && complete -F _rpcdebug rpcdebug -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rpm b/completions/rpm index a66534a6..6b4e66fa 100644 --- a/completions/rpm +++ b/completions/rpm @@ -7,7 +7,7 @@ _rpm_installed_packages() if [[ -r /var/log/rpmpkgs && \ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then # using RHL 7.2 or later - this is quicker than querying the DB - COMPREPLY=( $( compgen -W "$( sed -ne \ + COMPREPLY=( $( compgen -W "$( command sed -ne \ 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \ /var/log/rpmpkgs )" -- "$cur" ) ) elif type rpmqpack &>/dev/null ; then @@ -29,14 +29,14 @@ _rpm_groups() _rpm_macros() { # get a list of macros - COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \ + COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | command sed -ne \ 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \ -- "$cur" ) ) } _rpm_buildarchs() { - COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \ + COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | command sed -ne \ 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \ -- "$cur" ) ) } @@ -63,63 +63,60 @@ _rpm() -- "$cur" ) ) ;; esac - return 0 + return fi case $prev in --dbpath|--excludepath|--prefix|--relocate|--root|-r) _filedir -d - return 0 + return ;; --eval|-E) _rpm_macros $1 - return 0 + return ;; --pipe) compopt -o filenames COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 + return ;; --rcfile) _filedir - return 0 + return ;; --specfile) # complete on .spec files _filedir spec - return 0 + return ;; - --whatprovides) + --whatenhances|--whatprovides|--whatrecommends|--whatrequires|\ + --whatsuggests|--whatsupplements) if [[ "$cur" == */* ]]; then _filedir else # complete on capabilities - local IFS=$'\n' + local IFS=$'\n' fmt + case $prev in + *enhances) fmt=ENHANCENAME ;; + *provides) fmt=PROVIDENAME ;; + *recommends) fmt=RECOMMENDNAME ;; + *requires) fmt=REQUIRENAME ;; + *suggests) fmt=SUGGESTNAME ;; + *supplements) fmt=SUPPLEMENTNAME ;; + esac COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \ - --queryformat='%{PROVIDENAME}\n' 2>/dev/null )" \ - -- "$cur" ) ) + --queryformat=\"%{$fmt}\\n\" 2>/dev/null | + command grep -vF '(none)' )" -- "$cur" ) ) fi - return 0 - ;; - --whatrequires) - if [[ "$cur" == */* ]]; then - _filedir - else - # complete on capabilities - local IFS=$'\n' - COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \ - --queryformat='%{REQUIRENAME}\n' 2>/dev/null )" \ - -- "$cur" ) ) - fi - return 0 + return ;; --define|-D|--fileid|--hdrid|--pkgid) # argument required but no completions available - return 0 + return ;; esac - $split && return 0 + $split && return # options common to all modes local opts="--define= --eval= --macros= --nodigest --nosignature --rcfile= @@ -153,7 +150,8 @@ _rpm() --enhances --filesbypkg --filecaps --fileclass --filecolor --fileprovide --filerequire --filesbypkg --info --list --obsoletes --pipe --provides --queryformat= --requires - --scripts --suggests --triggers --xml" + --scripts --suggests --triggers --xml --recommends + --supplements --filetriggers" if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion @@ -180,7 +178,9 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last --package --pkgid --root= --specfile --state - --triggeredby --whatprovides --whatrequires" \ + --triggeredby --whatenhances --whatprovides + --whatrecommends --whatrequires --whatsuggests + --whatsupplements" \ -- "$cur" ) ) elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages $1 @@ -200,7 +200,9 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps --nogroup --nolinkto --nomode --nomtime --nordev --nouser --nofiles --noscripts --nomd5 --querytags --specfile - --whatrequires --whatprovides" -- "$cur" ) ) + --whatenhances --whatprovides --whatrecommends + --whatrequires --whatsuggests --whatsupplements" \ + -- "$cur" ) ) # check whether we're doing file completion elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then _filedir @@ -228,8 +230,6 @@ _rpm() ;; esac [[ $COMPREPLY == *= ]] && compopt -o nospace - - return 0 } && complete -F _rpm rpm @@ -244,45 +244,45 @@ _rpmbuild() case $prev in --buildroot|--root|-r|--dbpath) _filedir -d - return 0 + return ;; --target) _rpm_buildarchs - return 0 + return ;; --eval|-E) _rpm_macros $rpm - return 0 + return ;; --macros|--rcfile) _filedir - return 0 + return ;; --buildpolicy) local cfgdir=$( $rpm --eval '%{_rpmconfigdir}' 2>/dev/null ) if [[ $cfgdir ]]; then COMPREPLY=( $( compgen -W "$( command ls $cfgdir 2>/dev/null \ - | sed -ne 's/^brp-//p' )" -- "$cur" ) ) + | command sed -ne 's/^brp-//p' )" -- "$cur" ) ) fi ;; --define|-D|--with|--without) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi # Figure out file extensions to complete local word ext for word in ${words[@]}; do case $word in - -b?) + -b?|--clean|--nobuild) ext=spec break ;; @@ -300,4 +300,4 @@ _rpmbuild() } && complete -F _rpmbuild rpmbuild rpmbuild-md5 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rpm2tgz b/completions/rpm2tgz index 34e54a5a..abdf321b 100644 --- a/completions/rpm2tgz +++ b/completions/rpm2tgz @@ -11,6 +11,7 @@ _rpm2tgz() fi _filedir "rpm" -} && complete -F _rpm2tgz rpm2tgz rpm2txz rpm2targz +} && +complete -F _rpm2tgz rpm2tgz rpm2txz rpm2targz -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rpmcheck b/completions/rpmcheck index dce7319e..565f1313 100644 --- a/completions/rpmcheck +++ b/completions/rpmcheck @@ -8,7 +8,7 @@ _rpmcheck() case $prev in -base) _filedir - return 0 + return ;; esac @@ -21,4 +21,4 @@ _rpmcheck() } && complete -F _rpmcheck rpmcheck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rrdtool b/completions/rrdtool index c7d2bd2a..705be0d0 100644 --- a/completions/rrdtool +++ b/completions/rrdtool @@ -14,4 +14,4 @@ _rrdtool () } && complete -F _rrdtool rrdtool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/rsync b/completions/rsync index 04e1cda1..d72f6324 100644 --- a/completions/rsync +++ b/completions/rsync @@ -5,34 +5,34 @@ _rsync() local cur prev words cword split _init_completion -s -n : || return - _expand || return 0 + _expand || return case $prev in --config|--password-file|--include-from|--exclude-from|--files-from|\ --log-file|--write-batch|--only-write-batch|--read-batch) compopt +o nospace _filedir - return 0 + return ;; -T|--temp-dir|--compare-dest|--backup-dir|--partial-dir|--copy-dest|\ --link-dest) compopt +o nospace _filedir -d - return 0 + return ;; -e|--rsh) compopt +o nospace COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) ) - return 0 + return ;; --compress-level) compopt +o nospace COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return case $cur in -*) @@ -80,9 +80,7 @@ _rsync() _xfunc ssh _scp_local_files ;; esac - - return 0 } && complete -F _rsync -o nospace rsync -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sbcl b/completions/sbcl index 28cb9d80..3db4a39a 100644 --- a/completions/sbcl +++ b/completions/sbcl @@ -15,9 +15,7 @@ _sbcl() else _filedir fi - - return 0 } && complete -F _sbcl sbcl sbcl-mt -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sbopkg b/completions/sbopkg index f6589103..e5742af6 100644 --- a/completions/sbopkg +++ b/completions/sbopkg @@ -40,6 +40,7 @@ _sbopkg() for (( i=${#words[@]}-1; i>0; i-- )); do if [[ "${words[i]}" == -f ]]; then config="${words[i+1]}" + __expand_tilde_by_ref config break fi done @@ -60,9 +61,10 @@ _sbopkg() done [[ -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]] || return - COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\ + COMPREPLY=( $( command sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\ $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ) $( cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur" ) ) -} && complete -F _sbopkg sbopkg +} && +complete -F _sbopkg sbopkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/screen b/completions/screen index 1ba1b24b..6b5c319f 100644 --- a/completions/screen +++ b/completions/screen @@ -2,7 +2,7 @@ _screen_sessions() { - local sessions=( $( command screen -ls | sed -ne \ + local sessions=( $( command screen -ls | command sed -ne \ 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' ) ) if [[ $cur == +([0-9])?(.*) ]]; then # Complete sessions including pid prefixes @@ -29,7 +29,7 @@ _screen() case ${words[cword-2]} in -[dD]) _screen_sessions - return 0 + return ;; esac fi @@ -54,32 +54,32 @@ _screen() -[rR]) # list detached _screen_sessions 'Detached' - return 0 + return ;; -[dD]) # list attached _screen_sessions 'Attached' - return 0 + return ;; -x) # list both _screen_sessions - return 0 + return ;; -s) _shells - return 0 + return ;; -c) _filedir - return 0 + return ;; -T) _terms - return 0 + return ;; -e|-h|-p|-S|-t) - return 0 + return ;; esac @@ -91,4 +91,4 @@ _screen() } && complete -F _screen screen -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sh b/completions/sh index b70e53e2..fd785a6d 100644 --- a/completions/sh +++ b/completions/sh @@ -7,27 +7,30 @@ _sh() case $prev in -c) - return 0 + return ;; -o|+o) COMPREPLY=( $( compgen -W 'allexport errexit ignoreeof monitor noclobber noglob noexec nolog notify nounset verbose vi xtrace' -- "$cur" ) ) - return 0 + return ;; esac local opts="-a -b -C -e -f -h -i -m -n -o -u -v -x" if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts -c -s" -- "$cur" ) ) - return 0 + return elif [[ "$cur" == +* ]]; then COMPREPLY=( $( compgen -W "${opts//-/+}" -- "$cur" ) ) - return 0 + return fi - _filedir sh + local args ext= + _count_args + [[ $args -eq 1 ]] && ext=sh + _filedir $ext } && complete -F _sh sh -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sitecopy b/completions/sitecopy index 12480e97..ef1310df 100644 --- a/completions/sitecopy +++ b/completions/sitecopy @@ -13,15 +13,15 @@ _sitecopy() COMPREPLY=( $( compgen -W "socket files rcfile ftp http httpbody rsh sftp xml xmlparse cleartext" -- "$cur" ) ) compopt -o nospace - return 0 + return ;; --logfile|-g|--rcfile|-r) _filedir - return 0 + return ;; --storepath|-p) _filedir -d - return 0 + return ;; esac @@ -29,14 +29,14 @@ _sitecopy() --*) COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return ;; # only complete long options -) compopt -o nospace COMPREPLY=( -- ) - return 0 + return ;; esac @@ -44,8 +44,7 @@ _sitecopy() COMPREPLY=( $( compgen -W "$($1 -v | \ command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) ) fi - return 0 } && complete -F _sitecopy -o default sitecopy -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/slackpkg b/completions/slackpkg index dab9c6d4..83396a4e 100644 --- a/completions/slackpkg +++ b/completions/slackpkg @@ -79,12 +79,12 @@ _slackpkg() COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x xap xfce y' -- "$cur" ) ) COMPREPLY+=( $( cut -f 6 -d\ "${WORKDIR}/pkglist" 2> /dev/null | \ - grep "^$cur" ) ) + command grep "^$cur" ) ) return ;; info) COMPREPLY=( $( cut -f 6 -d\ "${WORKDIR}/pkglist" 2> /dev/null | \ - grep "^$cur" ) ) + command grep "^$cur" ) ) return ;; update) @@ -101,6 +101,7 @@ _slackpkg() ;; esac -} && complete -F _slackpkg slackpkg +} && +complete -F _slackpkg slackpkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/slapt-get b/completions/slapt-get index 93d110bc..512981b6 100644 --- a/completions/slapt-get +++ b/completions/slapt-get @@ -45,6 +45,7 @@ _slapt_get() for (( i=${#words[@]}-1; i>0; i-- )); do if [[ ${words[i]} == -@(c|-config) ]]; then config="${words[i+1]}" + __expand_tilde_by_ref config break fi done @@ -55,13 +56,13 @@ _slapt_get() # slapt-get will fail to search for "^name-version" # it can search for names only local name=${cur%%-*} - COMPREPLY=( $( slapt-get -c $config --search "^$name" 2>/dev/null |\ - sed -ne "/^$cur/{s/ .*$//;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" -c "$config" --search "^$name" 2> \ + /dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}" ) ) return ;; avl) # --install|-i| - COMPREPLY=( $( slapt-get -c $config --available 2>/dev/null | \ - sed -ne "/^$cur/{s/ .*$//;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" -c "$config" --available 2> \ + /dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}" ) ) return ;; ins) # --remove|--filelist @@ -74,6 +75,7 @@ _slapt_get() return ;; esac -} && complete -F _slapt_get slapt-get +} && +complete -F _slapt_get slapt-get -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/slapt-src b/completions/slapt-src index 94ddb892..2f65415f 100644 --- a/completions/slapt-src +++ b/completions/slapt-src @@ -2,8 +2,8 @@ _slapt_src() { - local cur prev words cword - _init_completion -n : || return + local cur prev words cword split + _init_completion -s -n : || return case "$prev" in --config|-c) @@ -16,6 +16,8 @@ _slapt_src() ;; esac + $split && return + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace @@ -25,7 +27,7 @@ _slapt_src() local i t # search for last action (-i|-w|-b|-f) for (( i=${#words[@]}-1; i>0; i-- )); do - if [[ ${words[i]} == -@(i|w|f|b|-install|-show|-build|-fetch) ]]; then + if [[ ${words[i]} == -@([iwfb]|-install|-show|-build|-fetch) ]]; then t="all" break fi @@ -39,6 +41,11 @@ _slapt_src() for (( i=${#words[@]}-1; i>0; i-- )); do if [[ ${words[i]} == -@(c|-config) ]]; then config="${words[i+1]}" + __expand_tilde_by_ref config + break + fi + if [[ ${words[i]} == --config=?* ]]; then + config="${words[i]#*=}" break fi done @@ -47,12 +54,14 @@ _slapt_src() if [[ "$cur" == *:* ]]; then local name=${cur%:*} local version=${cur##*:} - COMPREPLY=( $( slapt-src --config "$config" --search "^$name" 2> \ - /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$name" 2> \ + /dev/null | LC_ALL=C command sed -ne \ + "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) else - COMPREPLY=( $( slapt-src --config "$config" --search "^$cur" 2> \ - /dev/null | sed -ne "/^$cur/{s/ .*$//;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$cur" 2> \ + /dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}" ) ) fi -} && complete -F _slapt_src slapt-src +} && +complete -F _slapt_src slapt-src -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/smartctl b/completions/smartctl index bc0d0c01..3e952aa2 100644 --- a/completions/smartctl +++ b/completions/smartctl @@ -72,7 +72,7 @@ _smartctl_presets() } _smartctl_test() { - [[ $cur == @(pending|scttempint|vendor), ]] && return 0 + [[ $cur == @(pending|scttempint|vendor), ]] && return COMPREPLY=( $( compgen -W 'offline short long conveyance select, select,redo select,next afterselect,on afterselect,off pending, scttempint, vendor,' -- "$cur" ) ) @@ -100,55 +100,55 @@ _smartctl() ;; -d|--device) _smartctl_device - return 0 + return ;; -T|--tolerance) _smartctl_tolerance - return 0 + return ;; -b|--badsum) _smartctl_badsum - return 0 + return ;; -r|--report) _smartctl_report - return 0 + return ;; -n|--nocheck) _smartctl_powermode - return 0 + return ;; -s|--smart|-o|--offlineauto|-S|--saveauto) _smartctl_feature - return 0 + return ;; -l|--log) _smartctl_log - return 0 + return ;; -v|--vendorattribute) _smartctl_vendorattribute - return 0 + return ;; -F|--firmwarebug) _smartctl_firmwarebug - return 0 + return ;; -P|--presets) _smartctl_presets - return 0 + return ;; -B|--drivedb) _smartctl_drivedb - return 0 + return ;; -t|--test) _smartctl_test - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version --info --all --xall @@ -165,4 +165,4 @@ _smartctl() } && complete -F _smartctl smartctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/smbclient b/completions/smbclient index fe14f940..3a5616cd 100644 --- a/completions/smbclient +++ b/completions/smbclient @@ -16,7 +16,7 @@ _samba_hosts() { if [[ -n ${COMP_SAMBA_SCAN:-} ]]; then COMPREPLY=( $( compgen -W "$( smbtree -N -S | \ - sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \ + command sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \ )" -- "$cur" ) ) fi } @@ -46,57 +46,57 @@ _smbclient() case $prev in -R|--name-resolve) _samba_resolve_order - return 0 + return ;; -t) COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \ -- "$cur" ) ) - return 0 + return ;; -s|--configfile|-A|--authentication-file) _filedir - return 0 + return ;; -l|--log-basename|-D|--directory) _filedir -d - return 0 + return ;; -O|--socket-options) _samba_sockopts - return 0 + return ;; -T) COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) ) - return 0 + return ;; -W|--workgroup) _samba_domains - return 0 + return ;; -d|--debuglevel) _samba_debuglevel - return 0 + return ;; -L|--list) _samba_hosts - return 0 + return ;; -S|--signing) _samba_signing - return 0 + return ;; -p|--port|-M|--message|-I|--ip-address|-b|--send-buffer|-U|--user|-n|\ --netbiosname|-i|--scope|-T|--tar|-c|--command|-m|--max-protocol) # argument required but no completions available - return 0 + return ;; -\?|--help|-V|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -113,22 +113,22 @@ _smbget() case $prev in -o|--outputfile|-f|--rcfile) _filedir - return 0 + return ;; -d|--debuglevel) _samba_debuglevel - return 0 + return ;; -w|--workgroup) _samba_domains - return 0 + return ;; -u|--username|-p|--password|-b|--blocksize) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -145,35 +145,35 @@ _smbcacls() case $prev in -s|--configfile|-A|--authentication-file) _filedir - return 0 + return ;; -l|--log-basename) _filedir -d - return 0 + return ;; -d|--debuglevel) _samba_debuglevel - return 0 + return ;; --signing) _samba_signing - return 0 + return ;; -O|--socket-options) _samba_sockopts - return 0 + return ;; -W|--workgroup) _samba_domains - return 0 + return ;; -\?|--help|--usage|-D|--delete|-M|--modify|-a|--add|-S|--set|-C|\ --chown|-G|--chgrp|-n|--netbiosname|-i|--scope|-U|--user) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -190,26 +190,26 @@ _smbcquotas() case $prev in -s|--configfile|-A|--authentication-file) _filedir - return 0 + return ;; -l|--log-basename) _filedir -d - return 0 + return ;; -d|--debuglevel) _samba_debuglevel - return 0 + return ;; --signing) _samba_signing - return 0 + return ;; -\?|--help|--usage|-U|-u|--user|-S|--set) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -226,22 +226,22 @@ _smbpasswd() case $prev in -r) _samba_hosts - return 0 + return ;; -R) _samba_resolve_order - return 0 + return ;; -c) _filedir - return 0 + return ;; -D) _samba_debuglevel - return 0 + return ;; -U|-h|-w) - return 0 + return ;; esac @@ -259,22 +259,22 @@ _smbtar() case $prev in -r|-t) _filedir tar - return 0 + return ;; -s) _samba_hosts - return 0 + return ;; -l) _samba_debuglevel - return 0 + return ;; -N) _filedir - return 0 + return ;; -p|-x|-b|-d|-u) - return 0 + return ;; esac @@ -292,26 +292,26 @@ _smbtree() case $prev in -s|--configfile|-A|--authentication-file) _filedir - return 0 + return ;; -l|--log-basename) _filedir -d - return 0 + return ;; -d|--debuglevel) _samba_debuglevel - return 0 + return ;; -S|--signing) _samba_signing - return 0 + return ;; -\?|--help|--usage|-U|--user) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -320,4 +320,4 @@ _smbtree() } && complete -F _smbtree smbtree -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/snownews b/completions/snownews index 0cb35cdc..b5b070da 100644 --- a/completions/snownews +++ b/completions/snownews @@ -12,4 +12,4 @@ _snownews() } && complete -F _snownews snownews -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sqlite3 b/completions/sqlite3 index e97c2e9e..37d78a01 100644 --- a/completions/sqlite3 +++ b/completions/sqlite3 @@ -9,21 +9,21 @@ _sqlite3() case $prev in -help|-version|-separator|-nullvalue|*.$dbexts) - return 0 + return ;; -init) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) - return 0 + return fi - _filedir $dbexts + _filedir "$dbexts" } && complete -F _sqlite3 sqlite3 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ss b/completions/ss index 655f1f1f..63e6a458 100644 --- a/completions/ss +++ b/completions/ss @@ -17,7 +17,7 @@ _ss() -A|--query) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=( $( compgen -P "$prefix" -W '$( "$1" --help | \ - sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p" )' \ + command sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p" )' \ -- "${cur##*,}" ) ) return ;; @@ -36,4 +36,4 @@ _ss() } && complete -F _ss ss -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ssh b/completions/ssh index ebd7424a..ecd50e57 100644 --- a/completions/ssh +++ b/completions/ssh @@ -1,16 +1,31 @@ # ssh(1) completion -*- shell-script -*- +_ssh_queries() +{ + COMPREPLY+=( $( compgen -W \ + "cipher cipher-auth mac kex key protocol-version" -- "$cur" ) ) +} + +_ssh_query() +{ + ${1:-ssh} -Q $2 2>/dev/null +} + _ssh_ciphers() { - COMPREPLY+=( $( compgen -W '3des-cbc aes128-cbc aes192-cbc aes256-cbc + local ciphers='$( _ssh_query "$1" cipher )' + [[ $ciphers ]] || ciphers="3des-cbc aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 arcfour256 arcfour - blowfish-cbc cast128-cbc' -- "$cur" ) ) + blowfish-cbc cast128-cbc" + COMPREPLY+=( $( compgen -W "$ciphers" -- "$cur" ) ) } _ssh_macs() { - COMPREPLY+=( $( compgen -W 'hmac-md5 hmac-sha1 umac-64@openssh.com - hmac-ripemd160 hmac-sha1-96 hmac-md5-96' -- "$cur" ) ) + local macs='$( _ssh_query "$1" mac )' + [[ $macs ]] || macs="hmac-md5 hmac-sha1 umac-64@openssh.com hmac-ripemd160 + hmac-sha1-96 hmac-md5-96" + COMPREPLY+=( $( compgen -W "$macs" -- "$cur" ) ) } _ssh_options() @@ -39,7 +54,8 @@ _ssh_options() } # Complete a ssh suboption (like ForwardAgent=y<tab>) -# Only one parameter: the string to complete including the equal sign. +# Two parameters: the string to complete including the equal sign, and +# the ssh executable to invoke (optional). # Not all suboptions are completed. # Doesn't handle comma-separated lists. _ssh_suboption() @@ -74,6 +90,12 @@ _ssh_suboption() COMPREPLY=( $( compgen -W 'af1{1..4} af2{2..3} af3{1..3} af4{1..3} cs{0..7} ef lowdelay throughput reliability' -- "$cur" ) ) ;; + HostbasedKeyTypes|HostKeyAlgorithms) + COMPREPLY=( $( compgen -W '$( _ssh_query "$2" key )' -- "$cur" ) ) + ;; + KexAlgorithms) + COMPREPLY=( $( compgen -W '$( _ssh_query "$2" kex )' -- "$cur" ) ) + ;; Protocol) COMPREPLY=( $( compgen -W '1 2 1,2 2,1' -- "$cur" ) ) ;; @@ -89,10 +111,10 @@ _ssh_suboption() keyboard-interactive password' -- "$cur" ) ) ;; MACs) - _ssh_macs + _ssh_macs "$2" ;; Ciphers) - _ssh_ciphers + _ssh_ciphers "$2" ;; esac return 0 @@ -106,57 +128,78 @@ _ssh_suboption_check() # Get prev and cur words without splitting on = local cureq=`_get_cword :=` preveq=`_get_pword :=` if [[ $cureq == *=* && $preveq == -o ]]; then - _ssh_suboption $cureq + _ssh_suboption $cureq "$1" return $? fi return 1 } +# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument +_ssh_configfile() +{ + set -- "${words[@]}" + while [[ $# -gt 0 ]]; do + if [[ $1 == -F* ]]; then + if [[ ${#1} -gt 2 ]]; then + configfile="$(dequote "${1:2}")" + else + shift + [[ $1 ]] && configfile="$(dequote "$1")" + fi + break + fi + shift + done +} + _ssh() { local cur prev words cword _init_completion -n : || return - local configfile local -a config - _ssh_suboption_check && return 0 + _ssh_suboption_check "$1" && return case $prev in -F|-i|-S) _filedir - return 0 + return ;; -c) - _ssh_ciphers - return 0 + _ssh_ciphers "$1" + return ;; -m) - _ssh_macs - return 0 + _ssh_macs "$1" + return ;; -l) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -O) COMPREPLY=( $( compgen -W 'check forward exit stop' -- "$cur" ) ) - return 0 + return ;; -o) _ssh_options - return 0 + return + ;; + -Q) + _ssh_queries "$1" + return ;; -w) _available_interfaces - return 0 + return ;; -b) _ip_addresses - return 0 + return ;; -D|-e|-I|-L|-p|-R|-W) - return 0 + return ;; esac @@ -169,30 +212,19 @@ _ssh() elif [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument - set -- "${words[@]}" - while [[ $# -gt 0 ]]; do - if [[ $1 == -F* ]]; then - if [[ ${#1} -gt 2 ]]; then - configfile="$(dequote "${1:2}")" - else - shift - [[ $1 ]] && configfile="$(dequote "$1")" - fi - break - fi - shift - done + local configfile + _ssh_configfile _known_hosts_real -a -F "$configfile" "$cur" - if [[ $cword -ne 1 ]]; then + + local args + _count_args + if [[ $args -gt 1 ]]; then compopt -o filenames COMPREPLY+=( $( compgen -c -- "$cur" ) ) fi fi - - return 0 } && -shopt -u hostcomplete && complete -F _ssh ssh slogin autossh +shopt -u hostcomplete && complete -F _ssh ssh slogin autossh sidedoor # sftp(1) completion # @@ -201,25 +233,27 @@ _sftp() local cur prev words cword _init_completion || return - local configfile - - _ssh_suboption_check && return 0 + _ssh_suboption_check && return case $prev in -b|-F|-i) _filedir - return 0 + return ;; -o) _ssh_options - return 0 + return ;; -c) _ssh_ciphers - return 0 + return + ;; + -S) + _command + return ;; - -B|-D|-P|-R|-S|-s) - return 0 + -B|-D|-l|-P|-R|-s) + return ;; esac @@ -232,24 +266,10 @@ _sftp() elif [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - # Search COMP_WORDS for '-F configfile' argument - set -- "${words[@]}" - while [[ $# -gt 0 ]]; do - if [[ $1 == -F* ]]; then - if [[ ${#1} -gt 2 ]]; then - configfile="$(dequote "${1:2}")" - else - shift - [[ $1 ]] && configfile="$(dequote "$1")" - fi - break - fi - shift - done + local configfile + _ssh_configfile _known_hosts_real -a -F "$configfile" "$cur" fi - - return 0 } && shopt -u hostcomplete && complete -F _sftp sftp @@ -269,7 +289,7 @@ _scp_remote_files() local path=${cur#*:} # unescape (3 backslashes to 1 for chars we escaped) - path=$( sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" ) + path=$( command sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" ) # default to home dir of specified user on remote host if [[ -z $path ]]; then @@ -281,13 +301,13 @@ _scp_remote_files() # escape problematic characters; remove non-dirs files=$( ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | \ - sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' ) + command sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' ) else # escape problematic characters; remove executables, aliases, pipes # and sockets; add space at end of file names files=$( ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | \ - sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \ + command sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' ) fi COMPREPLY+=( $files ) @@ -309,10 +329,10 @@ _scp_local_files() if $dirsonly ; then COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ - sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") ) + command sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") ) else COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ - sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \ + command sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' -e "s/^/$1/") ) fi } @@ -324,79 +344,69 @@ _scp() local cur prev words cword _init_completion -n : || return - local configfile prefix + local prefix _ssh_suboption_check && { COMPREPLY=( "${COMPREPLY[@]/%/ }" ) - return 0 + return } case $prev in -l|-P) - return 0 + return ;; - -F|-i|-S) + -F|-i) _filedir compopt +o nospace - return 0 + return ;; -c) _ssh_ciphers COMPREPLY=( "${COMPREPLY[@]/%/ }" ) - return 0 + return ;; -o) _ssh_options - return 0 + return + ;; + -S) + _command + compopt +o nospace + return ;; esac - _expand || return 0 + _expand || return case $cur in !(*:*)/*|[.~]*) ;; # looks like a path - *:*) _scp_remote_files ; return 0 ;; + *:*) _scp_remote_files ; return ;; esac if [[ "$cur" == -F* ]]; then cur=${cur#-F} prefix=-F else - # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument - set -- "${words[@]}" - while [[ $# -gt 0 ]]; do - if [[ $1 == -F* ]]; then - if [[ ${#1} -gt 2 ]]; then - configfile="$(dequote "${1:2}")" - else - shift - [[ $1 ]] && configfile="$(dequote "$1")" - fi - break - fi - shift - done - case $cur in -*) COMPREPLY=( $( compgen -W '$( _parse_usage "${words[0]}" )' \ -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]/%/ }" ) - return 0 + return ;; */*|[.~]*) # not a known host, pass through ;; *) + local configfile + _ssh_configfile _known_hosts_real -c -a -F "$configfile" "$cur" ;; esac fi _scp_local_files "$prefix" - - return 0 } && complete -F _scp -o nospace scp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ssh-add b/completions/ssh-add index 1d563688..1885c37a 100644 --- a/completions/ssh-add +++ b/completions/ssh-add @@ -12,7 +12,7 @@ _ssh_add() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -? )' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" "-\?" )' -- "$cur" ) ) return fi @@ -20,4 +20,4 @@ _ssh_add() } && complete -F _ssh_add ssh-add -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ssh-copy-id b/completions/ssh-copy-id index 9c5af9ca..bd8c8fe0 100644 --- a/completions/ssh-copy-id +++ b/completions/ssh-copy-id @@ -7,8 +7,8 @@ _ssh_copy_id() case $prev in -i) - _filedir - return 0 + _filedir pub + return ;; esac @@ -17,9 +17,7 @@ _ssh_copy_id() else _known_hosts_real -a "$cur" fi - - return 0 } && complete -F _ssh_copy_id ssh-copy-id -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ssh-keygen b/completions/ssh-keygen new file mode 100644 index 00000000..f72b9aa2 --- /dev/null +++ b/completions/ssh-keygen @@ -0,0 +1,50 @@ +# ssh-keygen(1) completion -*- shell-script -*- + +_ssh_keygen() +{ + local cur prev words cword + _init_completion -n = || return + + case $prev in + -a|-b|-C|-D|-I|-J|-j|-M|-N|-n|-r|-P|-S|-V|-W|-z) + return + ;; + -F|-R) + # TODO: trim this down to actual entries in known hosts files + _known_hosts_real "$cur" + return + ;; + -f|-G|-K|-s|-T) + _filedir + return + ;; + -m) + COMPREPLY=( $( compgen -W 'PEM PKCS8 RFC4716' -- "$cur" ) ) + return + ;; + -O) + if [[ $cur != *=* ]]; then + COMPREPLY=( $( compgen -W 'clear force-command= + no-agent-forwarding no-port-forwarding no-pty no-user-rc + no-x11-forwarding permit-agent-forwarding + permit-port-forwarding permit-pty permit-user-rc + permit-x11-forwarding source-address=' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi + return + ;; + -t) + COMPREPLY=( $( compgen -W 'dsa ecdsa ed25519 rsa rsa1' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + local opts=$( _parse_usage "$1" "-?" ) + [[ -z "$opts" ]] && opts=$( _parse_help "$1" "-?" ) # OpenSSH < 7 + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + fi +} && +complete -F _ssh_keygen ssh-keygen + +# ex: filetype=sh diff --git a/completions/sshfs b/completions/sshfs index 90a92645..4f6d1a1b 100644 --- a/completions/sshfs +++ b/completions/sshfs @@ -7,21 +7,19 @@ _sshfs() local userhost path - _expand || return 0 + _expand || return if [[ "$cur" == *:* ]]; then _xfunc ssh _scp_remote_files -d # unlike scp and rsync, sshfs works with 1 backslash instead of 3 COMPREPLY=( "${COMPREPLY[@]//\\\\\\/\\}" ) - return 0 + return fi [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur" _xfunc ssh _scp_local_files -d - - return 0 } && complete -F _sshfs -o nospace sshfs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sshmitm b/completions/sshmitm index 829bfcd5..f7332201 100644 --- a/completions/sshmitm +++ b/completions/sshmitm @@ -14,4 +14,4 @@ _sshmitm() } && complete -F _sshmitm sshmitm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sshow b/completions/sshow index 2e9bd467..8c3cdc4c 100644 --- a/completions/sshow +++ b/completions/sshow @@ -8,7 +8,7 @@ _sshow() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _sshow() } && complete -F _sshow sshow -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/strace b/completions/strace index 0b8f0e9c..eae169b4 100644 --- a/completions/strace +++ b/completions/strace @@ -59,7 +59,7 @@ _strace() COMPREPLY=( $( compgen -W '${!syscalls[@]} file process network signal ipc desc all none' \ -- "$cur" ) ) - return 0 + return ;; esac else @@ -67,24 +67,24 @@ _strace() COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw signal read write' -- "$cur" ) ) fi - return 0 + return ;; -o) _filedir - return 0 + return ;; -p) _pids - return 0 + return ;; -S) COMPREPLY=( $( compgen -W 'time calls name nothing' \ -- "$cur" ) ) - return 0 + return ;; -u) _allowed_users - return 0 + return ;; esac @@ -98,4 +98,4 @@ _strace() } && complete -F _strace -o default strace -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/strings b/completions/strings index 8f47d374..27c00497 100644 --- a/completions/strings +++ b/completions/strings @@ -14,8 +14,8 @@ _strings() return ;; -T|--target) - COMPREPLY=( $( compgen -W '$( "$1" --help 2>/dev/null | \ - sed -ne "s/: supported targets: \(.*\)/\1/p" )' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( LC_ALL=C "$1" --help 2>/dev/null | \ + command sed -ne "s/: supported targets: \(.*\)/\1/p" )' -- "$cur" ) ) return ;; -e|--encoding) @@ -41,4 +41,4 @@ _strings() } && complete -F _strings strings -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sudo b/completions/sudo index b13b7313..2fe1c001 100644 --- a/completions/sudo +++ b/completions/sudo @@ -20,7 +20,7 @@ _sudo() mode=edit break fi - [[ ${COMP_WORDS[i]} == -@(u|U|g|C|p) ]] && ((i++)) + [[ ${COMP_WORDS[i]} == -[uUgCp] ]] && ((i++)) done case "$prev" in @@ -46,6 +46,7 @@ _sudo() if [[ $mode == edit ]]; then _filedir fi -} && complete -F _sudo sudo sudoedit +} && +complete -F _sudo sudo sudoedit -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/svcadm b/completions/svcadm index 21cc723c..f23af1ff 100644 --- a/completions/svcadm +++ b/completions/svcadm @@ -2,8 +2,8 @@ # # Copyright 2006 Yann Rouillard <yann@opencsw.org> -# -# svcadm accept any complete FMRI or abreviated FMRI +# +# svcadm accept any complete FMRI or abbreviated FMRI # - a complete FMRI is svc:/foo/bar/bar/baz # - abbreviated FMRI are foo/bar/bar/baz, bar/bar/baz, bar/baz or baz # @@ -11,7 +11,7 @@ # but to not clutter the interface with all completions, we will only # cut every completion alternative at the next slash. # -# For exemple, if the user types <nothing><tab>, we will propose for svc://foo/bar/bar/baz +# For example, if the user types <nothing><tab>, we will propose for svc://foo/bar/bar/baz # the following completion: foo/, bar/ and baz # If the user types <b><tab>, we will propose: bar/ and baz # If the user types <bar/><tab>, we will propose: bar/bar/ and bar/baz @@ -55,7 +55,7 @@ _smf_complete_fmri () fmri_part_list="$fmri" fi - # Here we make sure the completions begins with the pattern and + # Here we make sure the completions begins with the pattern and # we cut them at the first slash for fmri_part in $fmri_part_list; do [[ "$fmri_part" == $cur* ]] || continue @@ -74,14 +74,14 @@ _smf_complete_fmri () # next completion alternatives local i=${#COMPREPLY[*]} if [[ $i -gt 0 ]] && [[ "${COMPREPLY[$((--i))]}" == */ ]]; then - # we have to iterate throught the list as we may have duplicate + # we have to iterate through the list as we may have duplicate while [[ $i -ne 0 ]]; do [[ "${COMPREPLY[$i]}" != "${COMPREPLY[$((i - 1))]}" ]] && break ((i--)) done if [[ $i -eq 0 ]]; then _smf_complete_fmri "${COMPREPLY[0]}" "$prefix" - return 0 + return fi fi @@ -97,7 +97,7 @@ _smf_complete_fmri () _svcadm () { - local cur prev words cword + local cur prev words cword _init_completion -n : || return local command_list="enable disable restart refresh clear mark milestone" @@ -140,4 +140,4 @@ _svcadm () } && complete -F _svcadm svcadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/svk b/completions/svk index 632eeb29..d78d3557 100644 --- a/completions/svk +++ b/completions/svk @@ -24,12 +24,12 @@ _svk() case $prev in -F|--file|--targets) _filedir - return 0 + return ;; --encoding) COMPREPLY=( $( compgen -W \ - '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) ) - return 0 + '$( iconv --list | command sed -e "s@//@@;" )' -- "$cur" ) ) + return ;; esac @@ -191,7 +191,7 @@ _svk() --delete' -- "$cur" ) ) ;; sync) - COMPREPLY=( $( compgen -W "$( svk mirror --list \ + COMPREPLY=( $( compgen -W "$( $1 mirror --list \ 2>/dev/null | awk '/^\//{print $1}' )" -- "$cur" ) ) ;; co|checkout|push|pull) @@ -200,8 +200,8 @@ _svk() else path=// fi - COMPREPLY=( $( compgen -W "$( svk list $path 2>/dev/null | \ - sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( $1 list $path 2>/dev/null | \ + command sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) ) ;; *) _filedir @@ -209,9 +209,7 @@ _svk() esac fi fi - - return 0 } && complete -F _svk svk -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sync_members b/completions/sync_members index 715d53f4..2fe50eaf 100644 --- a/completions/sync_members +++ b/completions/sync_members @@ -8,15 +8,15 @@ _sync_members() case $prev in -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -d|--file) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--no-change --welcome-msg --goodbye-msg @@ -28,4 +28,4 @@ _sync_members() } && complete -F _sync_members sync_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/synclient b/completions/synclient new file mode 100644 index 00000000..b7ebf026 --- /dev/null +++ b/completions/synclient @@ -0,0 +1,24 @@ +# bash completion for synclient(1) -*- shell-script -*- + +_synclient() +{ + local cur prev words cword split + _init_completion -n = || return + + case $prev in + -\?|-h|-V) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + elif [[ $cur != *=?* ]]; then + COMPREPLY=( $( compgen -S = -W '$( $1 -l 2>/dev/null | \ + awk "/^[ \t]/ { print \$1 }" )' -- "$cur" ) ) + compopt -o nospace + fi +} && +complete -F _synclient synclient + +# ex: filetype=sh diff --git a/completions/sysbench b/completions/sysbench index e3d666cb..3d2b7b1e 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -8,100 +8,100 @@ _sysbench() case $prev in --num-threads|--max-requests|--max-time|--thread-stack-size| \ --help|--version|help|version) - return 0 + return ;; --init-rng|--debug|--validate) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; --test) COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \ -- "$cur" ) ) - return 0 + return ;; --cpu-max-prime) - return 0 + return ;; --file-test-mode) COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ -- "$cur" ) ) - return 0 + return ;; --file-io-mode) COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \ -- "$cur" ) ) - return 0 + return ;; --file-extra-flags) COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) ) - return 0 + return ;; --file-fsync-all|--file-fsync-end) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; --file-fsync-mode) COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) ) - return 0 + return ;; --memory-scope) COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) ) - return 0 + return ;; --memory-hugetlb) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; --memory-oper) COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) ) - return 0 + return ;; --memory-access-mode) COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) ) - return 0 + return ;; --oltp-test-mode) COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) ) - return 0 + return ;; --oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; --oltp-nontrx-mode) COMPREPLY=( $( compgen -W 'select update_key update_nokey insert delete' -- "$cur" ) ) - return 0 + return ;; --oltp-dist-type) COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) ) - return 0 + return ;; --db-driver) COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null | - sed -e '/^.*database drivers:/,/^$/!d' \ - -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) ) - return 0 + command sed -e '/^.*database drivers:/,/^$/!d' \ + -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) ) + return ;; --db-ps-mode) COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) ) - return 0 + return ;; --mysql-socket) _filedir sock - return 0 + return ;; --mysql-table-engine) COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster federated' -- "$cur" ) ) - return 0 + return ;; --mysql-engine-trx) COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) ) - return 0 + return ;; --*) - $split && return 0 + $split && return ;; esac @@ -130,4 +130,4 @@ _sysbench() } && complete -F _sysbench sysbench -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/sysctl b/completions/sysctl index 0ab37129..8216f989 100644 --- a/completions/sysctl +++ b/completions/sysctl @@ -6,6 +6,9 @@ _sysctl() _init_completion || return case $prev in + --help|--version) + return + ;; -p) _filedir conf return @@ -13,7 +16,9 @@ _sysctl() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + local opts="$( _parse_help "$1" )" + [[ $opts ]] || opts="$( _parse_usage "$1" )" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) else local suffix= [[ $prev == -w ]] && suffix== @@ -21,9 +26,7 @@ _sysctl() "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi - - return 0 } && complete -F _sysctl sysctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/tar b/completions/tar index 374e0692..5a854edd 100644 --- a/completions/tar +++ b/completions/tar @@ -1,37 +1,455 @@ # bash completion for GNU tar -*- shell-script -*- +# +# General info +# ============ +# +# The "old" style arguments +# ------------------------- +# +# We don't "advice" the old tar option format by default for GNU tar, example: +# +# 'tar czfT /tmp/archive.tar patterns.txt' +# +# We rather advice the 'tar -czf /tmp/archive.tar -T patterns.txt' format of +# arguments. Though, if user starts the 'first' tar argument without leading +# dash, we treat the command line apropriately. +# +# +# long/short options origin +# ------------------------- +# +# For GNU tar, everything is parsed from `tar --help` output so not so much +# per-distribution work should be needed. The _parse_help does not seem to be +# good enough so parsed here directly. +# +# +# FIXME: --starting-file (-K) (should be matched for extraction only) +# FIXME: handle already used (at least short) options +# FIXME: Test-cases for make check. +# - check for no global variable pollution +# FIXME: why PS4='$BASH_SOURCE:$LINENO: ' shows sometimes negative lines? +# FIXME: timeout on tarball listing +# FIXME: cache 'tar --help' parsing results into global variables +# FIXME: at least 'tar -<tab>' should show some helping text (apart from just +# pure option advices) +# FIXME: short option completion should be more intuitive +# - verbose mode option should be advised multiple times +# - mode option should be advised only once +# - format option should be advised only once +# ... -_tar() +__gtar_parse_help_opt() { - local cur prev words cword split - _init_completion -s || return + local opttype arg opt separator optvar + opttype=long + arg="$2" + opt="$1" + separator=" " - local ext regex tar untar + case "$opt" in + --*) + ;; + -\?) + return ;; + -*) + opttype=short + opt=${opt##-} + separator= + ;; + *) + echo >&2 "not an option $opt" + return 1 + ;; + esac + + # Remove arguments. + opt=${opt//\[*/} + opt=${opt//=*/=} + + # Basic sanity. + opt=${opt//\"*/} + opt=${opt//\'*/} + opt=${opt//\;*/} + + optvar=$opttype'_arg_'$arg + + eval "$optvar=\"\$$optvar$separator\"\"$opt\"" +} - if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) ) + +__gtar_parse_help_line() +{ + local i + + for i in $1; do + case "$i" in + # regular options + --*|-*) + __gtar_parse_help_opt "$i" "$2" + ;; + + # end once there is single non-option word + *) + break + esac + done +} + + +__gnu_tar_parse_help() +{ + local str line arg + while IFS= read line; do + # Ok, this requires some comment probably. The GNU help output prints + # options on lines beginning with spaces. After that, there is one + # or more options separated by ', ' separator string. We are matching + # like this then: ^<spaces>(<separator>?<option>)+<whatever>$ + if [[ "$line" =~ \ + ^[[:blank:]]{1,10}(((,[[:blank:]])?(--?([\]\[a-zA-Z0-9?=-]+))(,[[:space:]])?)+).*$ ]]; then + + line=${BASH_REMATCH[1]} + str="${line//,/ }" + + # Detect that all options on this line accept arguments (and whether + # the arguments are required or not). Note that only long option + # description in GNU help output mentions arguments. So the $line + # variable may contain e.g. '-X, --XXX[=NAME], -XXX2[=NAME]'. + arg=none + if [[ "$line" =~ --[A-Za-z0-9-]+(\[?)= ]]; then + [[ -n "${BASH_REMATCH[1]}" ]] && arg=opt || arg=req + fi + + __gtar_parse_help_line "$str" "$arg" + fi + done <<<"$(tar --help)" + + long_opts="\ + $long_arg_none\ + $long_arg_opt\ + $long_arg_req" + + short_opts="$short_arg_none$short_arg_opt$short_arg_req" +} + + +# Hack: parse --warning keywords from tar's error output +__gtar_parse_warnings() +{ + local line + while IFS= read line; do + if [[ $line =~ ^[[:blank:]]*-[[:blank:]]*[\`\']([a-zA-Z0-9-]+)\'$ ]]; then + echo "${BASH_REMATCH[1]} no-${BASH_REMATCH[1]}" + fi + done <<<"$(LC_ALL=C tar --warning= 2>&1)" +} + + +# Helper to obtain last character of string. +__tar_last_char() +{ + echo "${1: $(( ${#1} - 1))}" +} + + +__tar_parse_old_opt() +{ + local first_word char + + # current word is the first word + [[ "$cword" -eq 1 && -n "$cur" && "${cur:0:1}" != '-' ]] \ + && old_opt_progress=1 + + # check that first argument does not begin with "-" + first_word=${words[1]} + [[ -n "$first_word" && "${first_word:0:1}" != "-" ]] \ + && old_opt_used=1 + + # parse the old option (if present) contents to allow later code expect + # corresponding arguments + if [[ $old_opt_used -eq 1 ]]; then + char=${first_word:0:1} + while [[ -n "$char" ]]; do + if __tar_is_argreq "$char"; then + old_opt_parsed+=("$char") + fi + first_word=${first_word##$char} + char=${first_word:0:1} + done + fi +} + + +# Make the analysis of whole command line. +__tar_preparse_cmdline() +{ + local first_arg my_args tmparg i modes="ctxurdA" + + shift # progname + + __tar_parse_old_opt + + first_arg=1 + for i in "$@"; do + case "$i" in + --delete|--test-label) + tar_mode=${i:2:100} + tar_mode_arg=$i + break + ;; + --*) + # skip + ;; + -*[$modes]*) + tar_mode=${i//[^$modes]/} + tar_mode=${tar_mode:0:1} + tar_mode_arg=$i + break + ;; + *[$modes]*) + # Only the first arg may be "MODE" without leading dash + if [[ $first_arg -eq 1 ]]; then + tar_mode=${i//[^$modes]/} + tar_mode=${tar_mode:0:1} + tar_mode_arg=$i + fi + ;; + esac + first_arg=0 + done +} + + +# Generate completions for -f/--file. +__tar_file_option() +{ + local ext="$1" + + case "$tar_mode" in + c) + # no need to advise user to re-write existing tarball + _filedir -d + ;; + *) + _filedir "$ext" + ;; + esac +} + + +# Returns truth if option requires argument. No equal sign must be pasted. +# Accepts option in format: 'c', '-c', '--create' +__tar_is_argreq() +{ + local opt + opt=$1 + case "$opt" in + -[A-Za-z0-9?]) + [[ "$short_arg_req" =~ ${opt##-} ]] && return 0 + ;; + [A-Za-z0-9?]) + [[ "$short_arg_req" =~ ${opt} ]] && return 0 + ;; + --*) + [[ "$long_arg_req" =~ [[:blank:]]$opt=[[:blank:]] ]] && return 0 + ;; + esac + + return 1 +} + + +# Called only for short parameter +__tar_complete_mode() +{ + local short_modes has_mode rawopt generated \ + allshort_raw_unused allshort_raw \ + filler i + + short_modes="ctx" + [[ -z "$basic_tar" ]] && short_modes="ctxurdA" + + # Remove prefix when needed + rawopt=${cur#-} + + # -c -z -x ... => czx + allshort_raw=${short_opts//[- ]/} + + # init the 'mode' option if no option is in ${cur} + if [[ "$tar_mode" == none ]]; then + + # when user passed something like 'tar cf' do not put the '-' before + filler= + if [[ -z "$cur" && -z "$basic_tar" ]]; then + filler=- + fi + + generated="" + for (( i=0 ; 1; i++ )); do + local c="${short_modes:$i:1}" + [[ -z "$c" ]] && break + generated+=" $filler$cur$c" + done + + COMPREPLY=( $(compgen -W "$generated" ) ) return 0 fi + # The last short option requires argument, like '-cf<TAB>'. Cut the + # completion here to enforce argument processing. + if [[ "$old_opt_progress" -eq 0 ]] \ + && __tar_is_argreq "$(__tar_last_char "$cur")"; then + COMPREPLY=( "$cur" ) && return 0 + fi + + allshort_raw_unused=${allshort_raw//[$rawopt]/} + if [[ "$tar_mode" != none ]]; then + allshort_raw_unused=${allshort_raw_unused//[$short_modes]} + fi + + generated= + for (( i=0 ; 1; i++ )); do + local c="${allshort_raw_unused:$i:1}" + [[ -z "$c" ]] && break + generated+=" $cur$c" + done + + COMPREPLY=( $( compgen -W "$generated" ) ) + + return 0 +} + + +__gtar_complete_lopts() +{ + local rv + COMPREPLY=( $( compgen -W "$long_opts" -- "$cur" ) ) + rv=$? + [[ $COMPREPLY == *= ]] && compopt -o nospace + return $rv +} + + +__gtar_complete_sopts() +{ + local generated short_mode_opts i c + short_mode_opts="ctxurdA" + generated=${short_opts//[$short_mode_opts]/} + + for (( i=0 ; 1; i++ )); do + c="${allshort_raw_unused:$i:1}" + [[ -z "$c" ]] && break + generated+=" $cur$c" + done + + COMPREPLY=( $( compgen -W "$generated" -- "$cur" ) ) +} + + +__tar_try_mode() +{ + case "$cur" in + --*) + # posix tar does not support long opts + [[ -n "$basic_tar" ]] && return 0 + __gtar_complete_lopts + return $? + ;; + + -*) + # posix tar does not support short optios + [[ -n "$basic_tar" ]] && return 0 + + __tar_complete_mode && return 0 + ;; + + *) + if [[ "$cword" -eq 1 || "$tar_mode" == none ]]; then + __tar_complete_mode && return 0 + fi + ;; + esac + return 1 +} + + +__tar_adjust_PREV_from_old_option() +{ + # deal with old style arguments here + # $ tar cfTC # expects this sequence of arguments: + # $ tar cfTC ARCHIVE_FILE PATTERNS_FILE CHANGE_DIR + if [[ "$old_opt_used" -eq 1 && "$cword" -gt 1 \ + && "$cword" -lt $(( ${#old_opt_parsed[@]} + 2 )) ]]; + then + # make e.g. 'C' option from 'cffCT' + prev="-${old_opt_parsed[ $cword - 2 ]}" + fi +} + + +__tar_extract_like_mode() +{ + local i + for i in x d t delete; do + [[ "$tar_mode" == "$i" ]] && return 0 + done + return 1 +} + + +__tar_try_list_archive() +{ + local tarball tarbin untar + + __tar_extract_like_mode || return 1 + + # This all is just to approach directory completion from "virtual" + # directory structure in tarball (for which the _filedir is unusable) + + set -- "${words[@]}" + tarbin=$1 + untar="tf" + shift + + read tarball <<<"$(printf -- '%s\n' "$@" \ + | command sed -n "/^.\{1,\}$regex\$/p")" + if [[ -n "$tarball" ]]; then + local IFS=$'\n' + COMPREPLY=($(compgen -o filenames -W "$( + while read line; do + printf "%q\n" "$(printf %q"\n" "$line")" + done <<<"$($tarbin $untar "$tarball" 2>/dev/null)" + )" -- "$(printf "%q\n" "$cur")")) + return 0 + fi +} + +__tar_cleanup_prev() +{ + if [[ "$prev" =~ ^-[a-zA-Z0-9?]*$ ]]; then + # transformate '-caf' ~> '-f' + prev="-$(__tar_last_char "$prev")" + fi +} + +__tar_detect_ext() +{ local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma)))|t@([abglx]z|b?(z)2))' + ext="$tars" + regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' - case ${words[1]} in + case "$tar_mode_arg" in --*) + # Should never happen? ;; ?(-)*[cr]*f) - if [[ $cword -eq 2 ]]; then - ext='@(tar|gem|spkg)' - case ${words[1]} in - *a*) ext="$tars" ;; - *z*) ext='t?(ar.)gz' ;; - *Z*) ext='ta@(r.Z|z)' ;; - *[jy]*) ext='t@(?(ar.)bz?(2)|b2)' ;; - *J*) ext='t?(ar.)xz' ;; - esac - _filedir $ext - else - _filedir - fi - return 0 + ext='@(tar|gem|spkg)' + case ${words[1]} in + *a*) ext="$tars" ;; + *z*) ext='t?(ar.)gz' ;; + *Z*) ext='ta@(r.Z|z)' ;; + *[jy]*) ext='t@(?(ar.)bz?(2)|b2)' ;; + *J*) ext='t?(ar.)xz' ;; + esac ;; +([^ZzJjy])f) ext="$tars" @@ -49,84 +467,265 @@ _tar() ext='@(@(tar|gem|spkg).@(lzma|xz)|t[lx]z)' regex='\(\(tar\|gem\|spkg\)\.\(lzma\|xz\)\|t[lx]z\)' ;; - *) - _filedir - return 0 - ;; esac +} - case $prev in - *${ext:-$tars}) - # complete on files in tar file - # - # get name of tar file from command line - tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"${words[@]}" ) - # devise how to untar and list it - untar=t${words[1]//[^Jzjyf]/} - - local IFS=$'\n' - COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \ - 2>/dev/null ) )" -- "$cur" ) ) - return 0 - ;; - -C|--directory) - _filedir -d - return 0 - ;; - --atime-preserve) - COMPREPLY=( $( compgen -W 'replace system' -- "$cur" ) ) - return 0 - ;; - --group) - COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 - ;; - --owner) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - -F|--info-script|--new-volume-script|--rmt-command|--rsh-command|\ - -I|--use-compress-program) - compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 - ;; - --volno-file|--add-file|-T|--files-from|-X|--exclude-from|--index-file) + +_gtar() +{ + local long_opts short_opts \ + long_arg_none long_arg_opt long_arg_req \ + short_arg_none short_arg_opt short_arg_req \ + tar_mode tar_mode_arg old_opt_progress=0 \ + old_opt_used=0 old_opt_parsed=() + + # Main mode, e.g. -x or -c (extract/creation) + local tar_mode=none + + # The mode argument, e.g. -cpf or -c + # FIXME: handle long options + local tar_mode_arg= + + if [[ "$_TAR_OPT_DEBUG" == 1 ]]; then + set -x + PS4="\$BASH_SOURCE:\$LINENO: " + fi + + local cur prev words cword split + + _init_completion -s || return + + # Fill the {long,short}_{opts,arg*} + __gnu_tar_parse_help + + __tar_preparse_cmdline "${words[@]}" + + local ext regex tar untar + + __tar_detect_ext + + while true; do # just-for-easy-break while, not looping + __tar_adjust_PREV_from_old_option + __tar_posix_prev_handle && break + __tar_cleanup_prev + + # Handle all options *REQUIRING* argument. Optional arguments are up to + # user (TODO: is there any sane way to deal with this?). This case + # statement successes only if there already is PREV. + case $prev in + -C|--directory) + _filedir -d + break + ;; + --atime-preserve) + COMPREPLY=( $( compgen -W 'replace system' -- "$cur" ) ) + break + ;; + --group) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + break + ;; + --owner) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + break + ;; + -F|--info-script|--new-volume-script|--rmt-command|--rsh-command|\ + -I|--use-compress-program) + compopt -o filenames + COMPREPLY=( $( compgen -c -- "$cur" ) ) + break + ;; + --volno-file|--add-file|-T|--files-from|-X|--exclude-from|\ + --index-file|--listed-incremental|-g) + _filedir + break + ;; + -H|--format) + COMPREPLY=( $( compgen -W 'gnu oldgnu pax posix ustar v7' \ + -- "$cur" ) ) + break + ;; + --quoting-style) + COMPREPLY=( $( compgen -W 'literal shell shell-always c c-maybe + escape locale clocale' -- "$cur" ) ) + break + ;; + --totals) + COMPREPLY=( $( compgen -W 'SIGHUP SIGQUIT SIGINT SIGUSR1 SIGUSR2' \ + -- "$cur" ) ) + break + ;; + --warning) + COMPREPLY=( $( compgen -W "$(__gtar_parse_warnings)" -- "$cur" ) ) + break + ;; + --file|-f|-!(-*)f) + __tar_file_option "$ext" + break + ;; + --*) + # parameter with required argument but no completion yet + [[ " $long_arg_req " =~ \ $prev=\ ]] && break + + # parameter with optional argument passed with =, something like + # --occurrence=*<TAB> which is not handled above + [[ " $long_arg_opt " =~ \ $prev\ ]] && break + + # if there is some unknown option with '=', for example + # (literally) user does --nonexistent=<TAB>, we do not want + # continue also + $split && break + + # Most probably, when code goes here, the PREV variable contains + # some string from "$long_arg_none" and we want continue. + ;; + -[a-zA-Z0-9?]) + # argument required but no completion yet + [[ "$short_arg_req" =~ ${prev##-} ]] && break + ;; + esac + + # safety belts + case "$cur" in + -[a-zA-Z0-9]=*) + # e.g. 'tar -c -f=sth' does not what user could expect + break + ;; + esac + + # Handle the main operational mode of tar. We should do it as soon as + # possible. + __tar_try_mode && break + + # handle others + case "$cur" in + --*) + __gtar_complete_lopts + break + ;; + -*) + # called only if it is *not* first parameter + __gtar_complete_sopts + break + ;; + esac + + # the first argument must be "mode" argument or --param, if any of those + # was truth - the 'break' statement would have been already called + [[ "$cword" -eq 1 ]] && break + + __tar_try_list_archive && break + + # file completion on relevant files + if [[ $tar_mode != none ]]; then _filedir + fi + + break + done # just-for-easy-break while + + if [[ "$_TAR_OPT_DEBUG" == 1 ]]; then + set +x + unset PS4 + fi +} + + +__tar_posix_prev_handle() +{ + case "$prev" in + -f) + __tar_file_option "$ext" return 0 ;; - -H|--format) - COMPREPLY=( $( compgen -W 'gnu oldgnu pax posix ustar v7' \ - -- "$cur" ) ) - return 0 - ;; - --quoting-style) - COMPREPLY=( $( compgen -W 'literal shell shell-always c c-maybe - escape locale clocale' -- "$cur" ) ) - return 0 - ;; - --totals) - COMPREPLY=( $( compgen -W 'SIGHUP SIGQUIT SIGINT SIGUSR1 SIGUSR2' \ - -- "$cur" ) ) - return 0 - ;; - --occurrence|--sparse-version|--to-command|--mode|--mtime|\ - --tape-length|-b|--blocking-factor|--record-size|-V|--text|--backup|\ - --exclude|--exclude-tag*|-K|--starting-file|-N|--newer|--after-date|\ - --suffix|--strip-components|--transform|--xform|--checkpoint|\ - --checkpoint-action|--no-quote-chars|--quote-chars|--warnings) + -b) return 0 - ;; esac - $split && return 0 + return 1 +} + + +_posix_tar() +{ + local long_opts short_opts basic_tar \ + long_arg_none long_arg_opt long_arg_req \ + short_arg_none short_arg_opt short_arg_req \ + tar_mode tar_mode_arg old_opt_progress=0 \ + old_opt_used=1 old_opt_parsed=() + + # Main mode, e.g. -x or -c (extract/creation) + local tar_mode=none + + # The mode argument, e.g. -cpf or -c + local tar_mode_arg= + + local cur prev words cword split + + _init_completion -s || return + + basic_tar=yes + tar_mode=none + + # relatively compatible modes are {c,t,x} + # relatively compatible options {b,f,m,v,w} + short_arg_req="fb" + short_arg_none="wmv" + short_opts="$short_arg_req$short_arg_none" + + __tar_preparse_cmdline "${words[@]}" + + local ext regex tar untar + + __tar_detect_ext + + __tar_adjust_PREV_from_old_option + + __tar_posix_prev_handle && return + + __tar_try_mode && return + + __tar_try_list_archive && return # file completion on relevant files - _filedir "$ext" + _filedir +} - return 0 + +_tar() +{ + local cmd=${COMP_WORDS[0]} func line + read line <<<"$($cmd --version 2>/dev/null)" + case "$line" in + *GNU*) + func=_gtar + ;; + *) + func=_posix_tar + ;; + esac + $func "$@" + + # Install real completion for subsequent completions + if [ -n "${COMP_TAR_INTERNAL_PATHS:-}" ]; then + complete -F $func -o dirnames tar + else + complete -F $func tar + fi + unset -f _tar } -[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar || - complete -F _tar tar -# ex: ts=4 sw=4 et filetype=sh + +if [ -n "${COMP_TAR_INTERNAL_PATHS:-}" ]; then + complete -F _tar -o dirnames tar + complete -F _gtar -o dirnames gtar + complete -F _posix_tar -o dirnames bsdtar + complete -F _posix_tar -o dirnames star +else + complete -F _tar tar + complete -F _gtar gtar + complete -F _posix_tar bsdtar + complete -F _posix_tar star +fi + +# ex: filetype=sh diff --git a/completions/tcpdump b/completions/tcpdump index 7b4b4ea8..44b0afa7 100644 --- a/completions/tcpdump +++ b/completions/tcpdump @@ -8,32 +8,32 @@ _tcpdump() case $prev in -r|-w|-F) _filedir - return 0 + return ;; -i) _available_interfaces -a - return 0 + return ;; -m) _filedir mib - return 0 + return ;; -T) COMPREPLY=( $( compgen -W 'aodv cnfp rpc rtp rtcp snmp tftp vat wb' -- "$cur" ) ) - return 0 + return ;; -z) compopt -o filenames COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 + return ;; -Z) _allowed_users - return 0 + return ;; -B|-c|-C|-D|-E|-G|-M|-s|-W|-y) - return 0 + return ;; esac @@ -44,4 +44,4 @@ _tcpdump() } && complete -F _tcpdump tcpdump -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/tcpkill b/completions/tcpkill index 4a753326..a25fedae 100644 --- a/completions/tcpkill +++ b/completions/tcpkill @@ -8,7 +8,7 @@ _tcpkill() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _tcpkill() } && complete -F _tcpkill tcpkill -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/tcpnice b/completions/tcpnice index 49b89258..9fdae9ba 100644 --- a/completions/tcpnice +++ b/completions/tcpnice @@ -8,7 +8,7 @@ _tcpnice() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _tcpnice() } && complete -F _tcpnice tcpnice -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/timeout b/completions/timeout new file mode 100644 index 00000000..ccc66ae7 --- /dev/null +++ b/completions/timeout @@ -0,0 +1,38 @@ +# timeout(1) completion -*- shell-script -*- + +_timeout() +{ + local cur prev words cword split i found=false + _init_completion -s || return + + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* && ${COMP_WORDS[i-1]} != = ]]; then + if $found; then + _command_offset $i + return + fi + found=true + fi + [[ ${COMP_WORDS[i]} == -@(k|-kill-after|s|-signal) ]] && ((i++)) + done + + case $prev in + --help|--version|-k|--kill-after) + return + ;; + -s|--signal) + _signals + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _timeout timeout + +# ex: filetype=sh diff --git a/completions/tipc b/completions/tipc new file mode 100644 index 00000000..3523a295 --- /dev/null +++ b/completions/tipc @@ -0,0 +1,285 @@ +# tipc(8) completion -*- shell-script -*- + +_tipc_media() { + local optind=$1 + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'media' -- $cur) ) + return 0 + elif [[ $cword -eq $optind+1 ]]; then + COMPREPLY=( $( compgen -W 'udp eth ib' -- $cur) ) + return 0 + fi + + return 1 +} + +_tipc_bearer() { + local optind=$1 + local media i + + if _tipc_media $optind; then + return + fi + + for ((i = 0; i < $cword; i++)); do + if [[ ${words[$i]} == 'media' ]]; then + media=${words[$(($i + 1))]} + fi + done + + if [[ $cword -eq $optind+2 ]]; then + case "$media" in + "udp") + COMPREPLY=( $( compgen -W 'name' -- $cur) ) + ;; + "eth" | "ib") + COMPREPLY=( $( compgen -W 'device' -- $cur) ) + ;; + esac + elif [[ $cword -eq $optind+3 ]]; then + case "$media" in + "udp") + local names=$(tipc bearer list 2>/dev/null | awk -F: '/^udp:/ {print $2}') + COMPREPLY=( $( compgen -W '$names' -- $cur) ) + ;; + "eth") + local interfaces=$(command ls /sys/class/net/) + COMPREPLY=( $( compgen -W '$interfaces' -- $cur ) ) + ;; + esac + fi +} + +_tipc_link_opts() { + COMPREPLY=( $( compgen -W 'priority tolerance window' -- $cur) ) +} + +_tipc_link() { + local optind=$1 + local filter=$2 + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'link' -- $cur) ) + elif [[ $cword -eq $optind+1 ]]; then + # awk drops link state and last trailing : + local links=$(tipc link list 2>/dev/null | \ + awk '{print substr($1, 0, length($1))}') + if [[ $filter == "peers" ]]; then + links=$(command sed '/broadcast-link/d' <<<"$links") + fi + COMPREPLY=( $( compgen -W '$links' -- $cur ) ) + fi +} + +_tipc() +{ + local cur prev words cword optind i p + _init_completion || return + + optind=1 + COMPREPLY=() + + # Flags can be placed anywhere in the commandline + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-h --help' -- $cur ) ) + return + ;; + esac + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'bearer link media nametable node socket' -- $cur ) ) + return + fi + + case "${words[$optind]}" in + bearer) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'enable disable set get list' -- $cur ) ) + return + fi + + case "${words[$optind]}" in + enable) + local media params + let optind++ + + if [[ $cword -lt $optind+4 ]]; then + _tipc_bearer $optind + return + fi + + for ((i = 0; i < $cword; i++)); do + if [[ ${words[$i]} == 'media' ]]; then + media=${words[$(($i + 1))]} + fi + done + case "$media" in + "udp") + declare -a params=("localip" "localport" "remoteip" + "remoteport" "domain" "priority") + ;; + "eth" | "ib") + declare -a params=("domain" "priority") + ;; + *) + return + ;; + esac + + # If the previous word was a known paramater we assume a value for + # that key Note that this would break if the user attempts to use a + # kown key as value + for i in ${params[@]}; do + if [[ $prev == $i ]]; then + return + fi + done + + # In order not to print already used options we remove them + for p in ${words[@]}; do + for i in ${params[@]}; do + if [[ $p == $i ]]; then + params=( "${params[@]/$i}" ) + fi + done + done + + COMPREPLY=( $( compgen -W '${params[@]}' -- $cur) ) + ;; + disable) + let optind++ + + _tipc_bearer $optind + ;; + get) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+1 ]]; then + _tipc_bearer $(($optind + 1)) + fi + ;; + set) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+2 ]]; then + _tipc_bearer $(($optind + 2)) + fi + ;; + esac + ;; + link) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'get set list statistics' -- $cur ) ) + return + fi + + case "${words[$optind]}" in + get) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+1 ]]; then + _tipc_link $(($optind + 1)) "peers" + fi + ;; + set) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+2 ]]; then + _tipc_link $(($optind + 2)) "peers" + fi + ;; + statistics) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'show reset' -- $cur) ) + return + fi + + case "${words[$optind]}" in + show|reset) + _tipc_link $(($optind + 1)) + ;; + esac + ;; + esac + ;; + media) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'get set list' -- $cur ) ) + return + fi + + case "${words[$optind]}" in + get) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+1 ]]; then + _tipc_media $(($optind + 1)) + fi + ;; + set) + let optind++ + + if [[ $cword -eq $optind ]]; then + _tipc_link_opts + elif [[ $cword -ge $optind+2 ]]; then + _tipc_media $(($optind + 2)) + fi + ;; + esac + ;; + nametable) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'show' -- $cur ) ) + fi + ;; + node) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'list get set' -- $cur ) ) + return + fi + + case "${words[$optind]}" in + get|set) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'address netid' -- $cur ) ) + fi + esac + ;; + socket) + let optind++ + + if [[ $cword -eq $optind ]]; then + COMPREPLY=( $( compgen -W 'list' -- $cur ) ) + fi + ;; + esac +} && +complete -F _tipc tipc + +# ex: filetype=sh diff --git a/completions/tracepath b/completions/tracepath index 1861b6a2..06455cb5 100644 --- a/completions/tracepath +++ b/completions/tracepath @@ -20,4 +20,4 @@ _tracepath() } && complete -F _tracepath tracepath tracepath6 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/tshark b/completions/tshark index 32f853f2..34d93a0d 100644 --- a/completions/tshark +++ b/completions/tshark @@ -52,7 +52,7 @@ _tshark() -O) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=( $( compgen -P "$prefix" -W \ - "$( "$1" -G protocols 2>&1 | cut -d$'\t' -f 3 )" \ + "$( "$1" -G protocols 2>&1 | cut -f 3 )" \ -- "${cur##*,}" ) ) return ;; @@ -86,13 +86,13 @@ _tshark() return ;; -G) - COMPREPLY=( $( compgen -W "$( "$1" -G ? | \ + COMPREPLY=( $( compgen -W "$( "$1" -G ? 2>/dev/null | \ awk '/^[ \t]*-G / \ - { sub("^[[]","",$2); sub("[]]$","",$2); print $2 }' )" \ + { sub("^[[]","",$2); sub("[]]$","",$2); print $2 }' )" \ -- "$cur" ) ) return ;; - + esac if [[ "$cur" == -* ]]; then @@ -102,4 +102,4 @@ _tshark() } && complete -F _tshark tshark -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/tune2fs b/completions/tune2fs index ee88b45d..3695fea1 100644 --- a/completions/tune2fs +++ b/completions/tune2fs @@ -7,41 +7,42 @@ _tune2fs() case $prev in -c|-C|-E|-i|-J|-L|-m|-r|-T) - return 0 + return ;; -e) COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) ) - return 0 + return ;; -g) _gids COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 + return ;; -M) _filedir -d + return ;; -o) local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 ^journal_data ^journal_data_ordered ^journal_data_writeback) COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) - return 0 + return ;; -O) local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode ^sparse_super ^uninit_bg) COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) - return 0 + return ;; -u) _uids COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 + return ;; -U) COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) ) - return 0 + return ;; esac @@ -55,4 +56,4 @@ _tune2fs() } && complete -F _tune2fs tune2fs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/umount b/completions/umount index 6c15182b..6d4b3c8f 100644 --- a/completions/umount +++ b/completions/umount @@ -18,4 +18,4 @@ _umount() } && complete -F _umount -o dirnames umount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/umount.linux b/completions/umount.linux index 9bc9fcc1..28bfc9c9 100644 --- a/completions/umount.linux +++ b/completions/umount.linux @@ -18,8 +18,8 @@ _reply_compgen_array() # We also have to add another round of escaping to $cur. local ecur="$cur" - ecur="${ecur//\\/\\\\}" - ecur="${ecur//\'/\'}" + ecur=${ecur//\\/\\\\} + ecur=${ecur//\'/\\\'} # Actually generate completions. local oldifs=$IFS @@ -29,7 +29,7 @@ _reply_compgen_array() # Unescape strings in the linux fstab(5) format (with octal escapes). __linux_fstab_unescape() { - eval $1="'${!1//\'/\047}'" + eval $1="'${!1//\'/\\047}'" eval $1="'${!1/%\\/\\\\}'" eval "$1=$'${!1}'" } @@ -46,7 +46,7 @@ _linux_fstab() local fs_spec fs_file fs_other local oldifs="$IFS" while read -r fs_spec fs_file fs_other; do - if [[ $fs_spec = [#]* ]]; then continue; fi + if [[ $fs_spec == [#]* ]]; then continue; fi if [[ $1 == -L ]]; then local fs_label=${fs_spec/#LABEL=} if [[ $fs_label != "$fs_spec" ]]; then @@ -59,8 +59,8 @@ _linux_fstab() __linux_fstab_unescape fs_spec __linux_fstab_unescape fs_file IFS=$'\0' - [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec") - [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file") + [[ $fs_spec == */* ]] && COMPREPLY+=("$fs_spec") + [[ $fs_file == */* ]] && COMPREPLY+=("$fs_file") IFS=$oldifs fi done @@ -74,8 +74,8 @@ _linux_fstab() if [[ $realcur ]]; then local dirrealcur= dircur= basecur if [[ $cur == */* ]]; then - dirrealcur="${realcur%/*}/" - dircur="${cur%/*}/" + dirrealcur="${realcur%/*}/" + dircur="${cur%/*}/" fi basecur=${cur#"$dircur"} local i n=${#COMPREPLY[@]} @@ -137,4 +137,4 @@ _umount() } && complete -F _umount -o dirnames umount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/unace b/completions/unace index 369417ce..0f8963e0 100644 --- a/completions/unace +++ b/completions/unace @@ -17,4 +17,4 @@ _unace() } && complete -F _unace unace -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/unpack200 b/completions/unpack200 index fe058c64..1c97ecbe 100644 --- a/completions/unpack200 +++ b/completions/unpack200 @@ -7,16 +7,16 @@ _unpack200() case $prev in '-?'|-h|--help|-V|--version|-J) - return 0 + return ;; -H|--deflate-hint) COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) - return 0 + return ;; -l|--log-file) COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) _filedir log - return 0 + return ;; esac @@ -45,4 +45,4 @@ _unpack200() } && complete -F _unpack200 unpack200 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/unrar b/completions/unrar index f2a8a182..3340d24c 100644 --- a/completions/unrar +++ b/completions/unrar @@ -20,4 +20,4 @@ _unrar() } && complete -F _unrar unrar -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/unshunt b/completions/unshunt index 6e208d0c..8815f843 100644 --- a/completions/unshunt +++ b/completions/unshunt @@ -6,7 +6,7 @@ _unshunt() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) else _filedir -d fi @@ -14,4 +14,4 @@ _unshunt() } && complete -F _unshunt unshunt -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/update-alternatives b/completions/update-alternatives index e421db86..43cc3229 100644 --- a/completions/update-alternatives +++ b/completions/update-alternatives @@ -24,10 +24,10 @@ _update_alternatives() case $prev in --altdir|--admindir) _filedir -d - return 0 + return ;; --help|--usage|--version) - return 0 + return ;; esac @@ -89,4 +89,4 @@ _update_alternatives() } && complete -F _update_alternatives update-alternatives alternatives -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/update-rc.d b/completions/update-rc.d index 9a16385a..85c9a5a4 100644 --- a/completions/update-rc.d +++ b/completions/update-rc.d @@ -19,7 +19,7 @@ _update_rc_d() if [[ $cword -eq 1 || "$prev" == -* ]]; then valid_options=( $( \ tr " " "\n" <<<"${words[@]} ${options[@]}" \ - | sed -ne "/$( sed "s/ /\\|/g" <<<"${options[@]}" )/p" \ + | command sed -ne "/$( command sed "s/ /\\|/g" <<<"${options[@]}" )/p" \ | sort | uniq -u \ ) ) COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \ @@ -57,9 +57,7 @@ _update_rc_d() else COMPREPLY=() fi - - return 0 } && complete -F _update_rc_d update-rc.d -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/upgradepkg b/completions/upgradepkg index f9fa23ab..2a4b9845 100644 --- a/completions/upgradepkg +++ b/completions/upgradepkg @@ -23,7 +23,8 @@ _upgradepkg() return fi - _filedir "t[bglx]z" -} && complete -F _upgradepkg upgradepkg + _filedir 't[bglx]z' +} && +complete -F _upgradepkg upgradepkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/urlsnarf b/completions/urlsnarf index e9ccd8f9..b6bf069c 100644 --- a/completions/urlsnarf +++ b/completions/urlsnarf @@ -8,7 +8,7 @@ _urlsnarf() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _urlsnarf() } && complete -F _urlsnarf urlsnarf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/uscan b/completions/uscan new file mode 100644 index 00000000..fc05d2e8 --- /dev/null +++ b/completions/uscan @@ -0,0 +1,39 @@ +# uscan completion -*- shell-script -*- + +_uscan() +{ + local cur prev split + _init_completion -s || return + + case $prev in + --package) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_src_packages )) + return + ;; + --watchfile) + _filedir + return + ;; + --destdir) + _filedir -d + return + ;; + --timeout|--upstream-version|--download-version|--check-dirname-level|--check-dirname-regex) + COMPREPLY=( ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W ' --report --no-download --report-status + --download --destdir --force-download --pasv --no-pasv --symlink --rename + --repack --no-symlink --dehs --no-dehs --download-current-version --verbose + --no-verbose --debug --user-agent --useragent --no-conf --help + --version --timeout --package --upstream-version --watchfile + --download-version --check-dirname-level --check-dirname-regex + ' -- "$cur" ) ) +} && +complete -F _uscan uscan + +# ex: filetype=sh diff --git a/completions/useradd b/completions/useradd index 12c29365..9ed2f9f6 100644 --- a/completions/useradd +++ b/completions/useradd @@ -11,36 +11,34 @@ _useradd() case $prev in -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-K|--key|\ -p|--password|-u|--uid|-Z|--selinux-user) - return 0 + return ;; -b|--base-dir|-d|--home-dir|-k|--skel|-R|--root) _filedir -d - return 0 + return ;; -g|--gid) _gids COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ -- "$cur" ) ) - return 0 + return ;; -G|--groups) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) ) - return 0 + return ;; -s|--shell) _shells - return 0 + return ;; esac - $split && return 0 + $split && return - if [[ "$cur" == -* ]]; then + [[ "$cur" == -* ]] && \ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi } && complete -F _useradd useradd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/userdel b/completions/userdel index 090203ac..05bc2f75 100644 --- a/completions/userdel +++ b/completions/userdel @@ -17,11 +17,11 @@ _userdel() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -u -- "$cur" ) ) } && complete -F _userdel userdel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/usermod b/completions/usermod index 0d1f497b..03cc89fe 100644 --- a/completions/usermod +++ b/completions/usermod @@ -11,39 +11,39 @@ _usermod() case $prev in -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\ -l|--login|-p|--password|-u|--uid|-Z|--selinux-user) - return 0 + return ;; -g|--gid) _gids COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ -- "$cur" ) ) - return 0 + return ;; -G|--groups) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) ) - return 0 + return ;; -R|--root) _filedir -d - return 0 + return ;; -s|--shell) _shells - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -u -- "$cur" ) ) } && complete -F _usermod usermod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/valgrind b/completions/valgrind index 08950998..97e4cc59 100644 --- a/completions/valgrind +++ b/completions/valgrind @@ -34,7 +34,7 @@ _valgrind() COMPREPLY=( $( compgen -W '$( for f in /usr{,/local}/lib{,64}/valgrind/*; do [[ $f != *.so && -x $f ]] && - sed -ne "s/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f + command sed -ne "s/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f done )' -- "$cur" ) ) return ;; @@ -70,7 +70,7 @@ _valgrind() # generic cases parsed from --help output --+([-A-Za-z0-9_])) local value=$( $1 --help-debug $tool 2>/dev/null | \ - sed -ne "s|^[$' \t']*$prev=\([^$' \t']\{1,\}\).*|\1|p" ) + command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p" ) case $value in \<file*\>) _filedir @@ -107,4 +107,4 @@ _valgrind() } && complete -F _valgrind valgrind -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/vipw b/completions/vipw index 2220f2e8..cb54a840 100644 --- a/completions/vipw +++ b/completions/vipw @@ -7,11 +7,11 @@ _vipw() case $prev in -h|--help) - return 0 + return ;; -R|--root) _filedir -d - return 0 + return ;; esac @@ -19,4 +19,4 @@ _vipw() } && complete -F _vipw vipw vigr -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/vmstat b/completions/vmstat index 1d3ebb32..769620a7 100644 --- a/completions/vmstat +++ b/completions/vmstat @@ -6,10 +6,10 @@ _vmstat() _init_completion || return case $prev in - -V|-c|-M|-N|-n|-w|-p) + -h|--help|-V|--version|-c|-M|-N|-n|-w|-p|--partition) return ;; - -S) + -S|--unit) [[ $OSTYPE == *linux* ]] && \ COMPREPLY=( $( compgen -W 'k K m M' -- "$cur" ) ) return @@ -24,4 +24,4 @@ _vmstat() } && complete -F _vmstat vmstat -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/vncviewer b/completions/vncviewer index a1c16d69..4a3f2abd 100644 --- a/completions/vncviewer +++ b/completions/vncviewer @@ -24,16 +24,16 @@ _tightvncviewer() case $prev in -passwd) _filedir - return 0 + return ;; -encodings) COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib corre rre raw' -- "$cur" ) ) - return 0 + return ;; -via) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -63,17 +63,17 @@ _xvnc4viewer() # -passwd, -PasswordFile -[pP][aA][sS][sS][wW][dD]|-[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE]) _filedir - return 0 + return ;; # -PreferredEncoding -[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG]) COMPREPLY=( $( compgen -W 'zrle hextile raw' -- "$cur" ) ) - return 0 + return ;; # -via -[vV][iI][aA]) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -87,16 +87,15 @@ _xvnc4viewer() WMDecorationWidth ZlibLevel ) [[ "$cur" == --* ]] && dash=-- || dash=- - local option oldNoCaseMatch=$(shopt -p nocasematch) - shopt -s nocasematch + local option reset=$( shopt -p nocasematch ); shopt -s nocasematch COMPREPLY=( $( for option in "${options[@]}"; do [[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option done ) ) - eval "$oldNoCaseMatch" 2>/dev/null + $reset else _known_hosts_real "$cur" fi } && complete -F _xvnc4viewer xvnc4viewer -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/vpnc b/completions/vpnc index 143798de..4e1fa81e 100644 --- a/completions/vpnc +++ b/completions/vpnc @@ -9,44 +9,44 @@ _vpnc() --help|--long-help|--version|--id|--username|--domain|--ifname|\ --application-version|--local-addr|--local-port|--udp-port|--dpd-idle|\ --target-network) - return 0 + return ;; --gateway) _known_hosts_real "$cur" - return 0 + return ;; --vendor) COMPREPLY=( $( compgen -W 'cisco netscreen' -- "$cur" ) ) - return 0 + return ;; --natt-mode) COMPREPLY=( $( compgen -W 'natt none force-natt cisco-udp' \ -- "$cur" ) ) - return 0 + return ;; --script|--pid-file|--ca-file) _filedir - return 0 + return ;; --dh) COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- "$cur" ) ) - return 0 + return ;; --pfs) COMPREPLY=( $( compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur" ) ) - return 0 + return ;; --debug) COMPREPLY=( $( compgen -W '0 1 2 3 99' -- "$cur" ) ) - return 0 + return ;; --auth-mode) COMPREPLY=( $( compgen -W 'psk cert hybrid' -- "$cur" ) ) - return 0 + return ;; --ca-dir) _filedir -d - return 0 + return ;; esac @@ -59,4 +59,4 @@ _vpnc() } && complete -F _vpnc vpnc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/watch b/completions/watch index c2832dd8..bcc356f8 100644 --- a/completions/watch +++ b/completions/watch @@ -51,4 +51,4 @@ _watch() } && complete -F _watch watch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/webmitm b/completions/webmitm index 68440631..a8484ca1 100644 --- a/completions/webmitm +++ b/completions/webmitm @@ -14,4 +14,4 @@ _webmitm() } && complete -F _webmitm webmitm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wget b/completions/wget index 1fc5c955..b1878fdb 100644 --- a/completions/wget +++ b/completions/wget @@ -6,6 +6,9 @@ _wget() _init_completion -s || return case $prev in + -V|--version|-h|--help) + return + ;; --progress) COMPREPLY=( $( compgen -W 'bar dot' -- "$cur" ) ) return @@ -100,7 +103,7 @@ _wget() ;; -Q|--quota|--limit-rate|--warc-max-size) # expect size - if [[ $cur == *@(k|m) ]]; then + if [[ $cur == *[km] ]]; then COMPREPLY=( $( compgen -W "$cur" ) ) elif [[ $cur ]]; then COMPREPLY=( $( compgen -P "$cur" -W "{0..9} k m" ) ) @@ -112,7 +115,7 @@ _wget() return ;; --user|--http-user|--proxy-user|--ftp-user) - COMPREPLY=( $( compgen -W "$( sed -n \ + COMPREPLY=( $( compgen -W "$( command sed -n \ '/^login/s/^[[:blank:]]*login[[:blank:]]//p' ~/.netrc \ 2>/dev/null )" -- "$cur" ) ) return @@ -134,19 +137,24 @@ _wget() --local-encoding|--remote-encoding) type -P xauth &>/dev/null && \ COMPREPLY=( $( compgen -W '$( iconv -l 2>/dev/null | \ - sed -e "s@/*\$@@" -e "s/[,()]//g" 2>/dev/null )' -- "$cur" ) ) + command sed -e "s@/*\$@@" -e "s/[,()]//g" 2>/dev/null )' -- "$cur" ) ) return ;; -e|--execute) return # TODO base=STR ;; - -nv|--report-speed) + --report-speed) COMPREPLY=( $( compgen -W 'bits' -- "$cur" ) ) return ;; + --regex-type) + COMPREPLY=( $( compgen -W 'posix' -- "$cur" ) ) + return + ;; -B|--base|--password|--ftp-password|--http-password|--proxy-password|\ --default-page|--referer|-U|--user-agent|--post-data|--warc-header|-A|\ - --accept|-R|--reject|-I|--include-directories|-X|--exclude-directories) + --accept|-R|--reject|--accept-regex|--reject-regex|-I|\ + --include-directories|-X|--exclude-directories) # argument required but no completions available return ;; @@ -159,6 +167,7 @@ _wget() [[ $COMPREPLY == *= ]] && compopt -o nospace fi -} && complete -F _wget wget +} && +complete -F _wget wget -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wine b/completions/wine index 8cdc9146..be299755 100644 --- a/completions/wine +++ b/completions/wine @@ -17,4 +17,4 @@ _wine() } && complete -F _wine wine -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/withlist b/completions/withlist index 4aaad602..913e410b 100644 --- a/completions/withlist +++ b/completions/withlist @@ -15,4 +15,4 @@ _withlist() } && complete -F _withlist withlist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wodim b/completions/wodim index b6ce2aa6..7380166b 100644 --- a/completions/wodim +++ b/completions/wodim @@ -52,7 +52,7 @@ _cdrecord() COMPREPLY=( $( compgen -W '{25..95}' -- "$cur" ) ) ;; esac - return 0 + return fi generic_options=( -version -v -V -d -silent -force -immed -dummy -clone \ @@ -92,4 +92,4 @@ _cdrecord() } && complete -F _cdrecord cdrecord wodim -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wol b/completions/wol index ce1b7c50..50653385 100644 --- a/completions/wol +++ b/completions/wol @@ -7,34 +7,34 @@ _wol() case $prev in -V|--version|--help|-p|--port|--passwd|-w|--wait) - return 0 + return ;; -h|--host|-i|--ipaddr) # Broadcast addresses local PATH=$PATH:/sbin COMPREPLY=( $( { ip addr show || ifconfig -a; } 2>/dev/null | \ - sed -ne 's/.*[[:space:]]Bcast:\([^[:space:]]*\).*/\1/p' -ne \ + command sed -ne 's/.*[[:space:]]Bcast:\([^[:space:]]*\).*/\1/p' -ne \ 's/.*inet.*[[:space:]]brd[[:space:]]\([^[:space:]]*\).*/\1/p' -ne \ 's/.*[[:space:]]broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' ) ) _known_hosts_real "$cur" - return 0 + return ;; -f|--file) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi _mac_addresses } && complete -F _wol wol -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wsimport b/completions/wsimport index 91504844..d53a17fb 100644 --- a/completions/wsimport +++ b/completions/wsimport @@ -46,4 +46,4 @@ _wsimport() } && complete -F _wsimport wsimport -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wtf b/completions/wtf index cc8352f4..26a0d4b8 100644 --- a/completions/wtf +++ b/completions/wtf @@ -3,11 +3,15 @@ _wtf() { - local cur prev words cword + local cur prev words cword addf _init_completion || return - [[ $prev == -f ]] && _filedir && return 0 - [[ $cur == -* ]] && COMPREPLY=( -f ) && return 0 + [[ $prev == -f ]] && _filedir && return + [[ ${words[@]} == *\ -f* ]] && addf= || addf=-f + if [[ $cur == -* ]]; then + COMPREPLY=( $addf ) + return + fi local db @@ -18,10 +22,19 @@ _wtf() fi shift done - [[ -z $db ]] && db=${ACRONYMDB:-/usr/share/misc/acronyms*} - COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur^^}" ) ) + if [[ -z "$db" ]]; then + local f + for f in "$ACRONYMDB" /usr/share/misc/acronyms \ + /usr/share/games/bsdgames/acronyms; do + [[ -f "$f" ]] && db="$f" && break + done + [[ -z "$db" ]] && return + fi + + COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db* 2>/dev/null ) $addf" \ + -- "${cur^^}" ) ) } && complete -F _wtf wtf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/wvdial b/completions/wvdial index da2dbfb3..e456f1b1 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -8,7 +8,7 @@ _wvdial() case $prev in --config) _filedir - return 0 + return ;; esac @@ -33,7 +33,7 @@ _wvdial() done # parse config files for sections and # remove default section - COMPREPLY=( $( sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config \ + COMPREPLY=( $( command sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config \ 2>/dev/null | command grep -v '^Defaults$')) # escape spaces COMPREPLY=${COMPREPLY// /\\ } @@ -43,4 +43,4 @@ _wvdial() } && complete -F _wvdial wvdial -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xfreerdp b/completions/xfreerdp index f0188446..9ca7ac81 100644 --- a/completions/xfreerdp +++ b/completions/xfreerdp @@ -7,21 +7,21 @@ _xfreerdp() case $prev in -k) - COMPREPLY=( $( compgen -W "$(xfreerdp --kbd-list | \ - awk '/^0x/ {print $1}')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 --kbd-list | \ + awk '/^0x/ {print $1}')" -- "$cur" ) ) + return ;; -a) COMPREPLY=( $( compgen -W '8 15 16 24 32' -- "$cur" ) ) - return 0 + return ;; -x) COMPREPLY=( $( compgen -W 'b broadband m modem l lan' -- "$cur" ) ) - return 0 + return ;; --plugin) COMPREPLY=( $( compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur" ) ) - return 0 + return ;; esac @@ -29,10 +29,11 @@ _xfreerdp() COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -t -g -a -z -f -x -O -o -k --kbd-list -h --plugin --data' -- "$cur" ) ) else - _known_hosts_real "$cur" + COMPREPLY=( $( compgen -W "$(awk '{print $1}' ~/.freerdp/known_hosts \ + 2>/dev/null)" -- "$cur" ) ) fi } && complete -F _xfreerdp xfreerdp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xgamma b/completions/xgamma index c5b8a76b..eda46d62 100644 --- a/completions/xgamma +++ b/completions/xgamma @@ -7,7 +7,7 @@ _xgamma() case "$prev" in -screen) - local screens=$( xrandr --query 2>/dev/null | sed -n \ + local screens=$( xrandr --query 2>/dev/null | command sed -n \ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null ) COMPREPLY=( $( compgen -W "$screens" -- "$cur" ) ) return @@ -30,7 +30,7 @@ _xgamma() compopt -o nospace elif [[ "$cur" == :*.* ]]; then # local screen numbers - local t screens=$( xrandr --query 2>/dev/null | sed -ne \ + local t screens=$( xrandr --query 2>/dev/null | command sed -ne \ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null ) t="${cur#:}" COMPREPLY=( $( compgen -P "${t%.*}." -W "$screens" -- \ @@ -53,6 +53,7 @@ _xgamma() [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return fi -} && complete -F _xgamma xgamma +} && +complete -F _xgamma xgamma -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xhost b/completions/xhost index 22839e4f..8f605a90 100644 --- a/completions/xhost +++ b/completions/xhost @@ -13,4 +13,4 @@ _xhost () } && complete -F _xhost xhost -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xm b/completions/xm index e3ae9796..93852f61 100644 --- a/completions/xm +++ b/completions/xm @@ -184,7 +184,7 @@ _xm() case $prev in -d) _xen_domain_names - return 0 + return ;; esac ;; @@ -198,11 +198,11 @@ _xm() case $prev in -f|-F|--defconfig|--config) _filedir - return 0 + return ;; --path) _filedir -d - return 0 + return ;; esac @@ -216,9 +216,7 @@ _xm() esac fi fi - - return 0 } && complete -F _xm xm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xmllint b/completions/xmllint index 928a5b67..e9a35d06 100644 --- a/completions/xmllint +++ b/completions/xmllint @@ -8,38 +8,38 @@ _xmllint() case $prev in -o|--output) _filedir - return 0 + return ;; --path|--dtdvalidfpi|--maxmem|--encode|--pattern) # argument required but no completions available - return 0 + return ;; --dtdvalid) _filedir 'dtd?(.gz)' - return 0 + return ;; --relaxng) _filedir 'rng?(.gz)' - return 0 + return ;; --schema) _filedir 'xsd?(.gz)' - return 0 + return ;; --schematron) _filedir 'sch?(.gz)' - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]%:}" ) - return 0 + return fi - _filedir '@(*ml|htm|svg?(z)|xs[dl]|rng|wsdl|jnlp|tld)?(.gz)' + _filedir '@(*ml|htm|svg?(z)|xs[dl]|rng|wsdl|jnlp|tld|dbk|docbook|page)?(.gz)' } && complete -F _xmllint xmllint -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xmlwf b/completions/xmlwf index 15206134..dd7a5457 100644 --- a/completions/xmlwf +++ b/completions/xmlwf @@ -8,25 +8,25 @@ _xmlwf() case $prev in -d) _filedir -d - return 0 + return ;; -e) COMPREPLY=( $( compgen -W 'US-ASCII UTF-8 UTF-16 ISO-8859-1' \ -- "$cur" ) ) - return 0 + return ;; -v) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi - _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld)' + _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld|dbk|docbook|page)' } && complete -F _xmlwf xmlwf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xmms b/completions/xmms index 7d849568..88e65bd4 100644 --- a/completions/xmms +++ b/completions/xmms @@ -24,4 +24,4 @@ _xmms() } && complete -F _xmms xmms -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xmodmap b/completions/xmodmap index 243563d3..4db899b1 100644 --- a/completions/xmodmap +++ b/completions/xmodmap @@ -7,18 +7,18 @@ _xmodmap() case $prev in -display|-e) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-display -help -grammar -verbose -quiet -n -e -pm -pk -pke -pp' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _xmodmap xmodmap -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xrandr b/completions/xrandr index cef0941e..841904a5 100644 --- a/completions/xrandr +++ b/completions/xrandr @@ -12,7 +12,7 @@ _xrandr() return ;; --output|--left-of|--right-of|--above|--below|--same-as) - local outputs=$( xrandr | awk '/connected/ {print $1}' ) + local outputs=$( "$1" | awk '/connected/ {print $1}' ) COMPREPLY=( $( compgen -W "$outputs" -- "$cur" ) ) return ;; @@ -25,7 +25,7 @@ _xrandr() fi done if [[ $output ]]; then - local modes=$( xrandr | sed -e "1,/$output/ d" \ + local modes=$( "$1" | command sed -e "1,/$output/ d" \ -e "/connected/,$ d" \ -e "s/\([^[:space:]]\)[[:space:]].*/\1/" ) COMPREPLY=( $( compgen -W "$modes" -- "$cur" ) ) @@ -45,11 +45,18 @@ _xrandr() COMPREPLY=( $( compgen -W 'normal inverted left right' -- "$cur" ) ) return ;; + --setprovideroutputsource|--setprovideroffloadsink) + local providers=$( "$1" --listproviders 2>/dev/null | + command sed -ne 's/.* name:\([^ ]*\).*/\1/p' ) + COMPREPLY=( $( compgen -W "$providers" -- "$cur" ) ) + # TODO 2nd arg needed, is that a provider as well? + return + ;; esac COMPREPLY=( $( compgen -W '$( "$1" -help 2>&1 | - sed -e "s/ or / /g" -e "s/<[^>]*>]//g" | _parse_help - )' -- "$cur" ) ) + command sed -e "s/ or / /g" -e "s/<[^>]*>]//g" | _parse_help - )' -- "$cur" ) ) } && complete -F _xrandr xrandr -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xrdb b/completions/xrdb index 7a6eefe6..1f517cb3 100644 --- a/completions/xrdb +++ b/completions/xrdb @@ -7,21 +7,21 @@ _xrdb() case $prev in -backup|-display|-help) - return 0 + return ;; -cpp|-edit) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _xrdb xrdb -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xsltproc b/completions/xsltproc index 7c38591f..98d3e72a 100644 --- a/completions/xsltproc +++ b/completions/xsltproc @@ -6,44 +6,44 @@ _xsltproc() _init_completion || return case $prev in - --output|-o) + --output|-o) _filedir - return 0 + return ;; # TODO : number only --maxdepth) - return 0 + return ;; --encoding) # some aliases removed - COMPREPLY=( $( compgen -W "$( iconv -l | sed -e '/^UTF[1378]/d' \ + COMPREPLY=( $( compgen -W "$( iconv -l | command sed -e '/^UTF[1378]/d' \ -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" ) ) - return 0 + return ;; --param|--stringparam) - return 0 + return ;; # not really like --writesubtree --path) _filedir -d - return 0 + return ;; --writesubtree) _filedir -d - return 0 + return ;; esac - [[ $cword -gt 2 && `_get_cword '' 2` == --?(string)param ]] && \ - return 0 + [[ $cword -gt 2 && `_get_cword '' 2` == --?(string)param ]] && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]%:}" ) else - _filedir '@(xsl|xslt|xml)' + # TODO: 1st file xsl|xslt, 2nd XML + _filedir '@(xsl|xslt|xml|dbk|docbook|page)' fi } && complete -F _xsltproc xsltproc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xxd b/completions/xxd index 050a2b66..f190d75a 100644 --- a/completions/xxd +++ b/completions/xxd @@ -20,4 +20,4 @@ _xxd() } && complete -F _xxd xxd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xz b/completions/xz index e2e1b709..53e6b398 100644 --- a/completions/xz +++ b/completions/xz @@ -13,36 +13,40 @@ _xz() ;; --files|--files0) _filedir - return 0 + return ;; -C|--check) COMPREPLY=( $( compgen -W 'crc32 crc64 sha256 none' -- "$cur" ) ) - return 0 + return ;; -F|--format) COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- "$cur" ) ) - return 0 + return + ;; + -T|--threads) + COMPREPLY=( $( compgen -W "{0..$(_ncpus)}" -- "$cur" ) ) + return ;; -M|--memlimit|--memlimit-compress|--memlimit-decompress|--memory|\ -S|--suffix|--delta|--lzma1|--lzma2) # argument required but no completions available - return 0 + return ;; -h|--help|-H|--long-help|-V|--version|--info-memory) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return - _expand || return 0 + _expand || return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \ -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi local IFS=$'\n' @@ -52,4 +56,4 @@ _xz() } && complete -F _xz xz pxz -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/xzdec b/completions/xzdec index fc32492e..5475a8e2 100644 --- a/completions/xzdec +++ b/completions/xzdec @@ -8,24 +8,24 @@ _xzdec() case $prev in -M|--memory) # argument required but no completions available - return 0 + return ;; -h|--help|-V|--version) # all other arguments are noop with these - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi _filedir xz # no lzma support here as of xz 4.999.9beta } && complete -F _xzdec xzdec -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ypmatch b/completions/ypmatch index 99d80c43..c6de48b3 100644 --- a/completions/ypmatch +++ b/completions/ypmatch @@ -7,22 +7,20 @@ _ypmatch() local map cmd=${1##*/} - [[ $cmd == ypcat && $cword -gt 1 ]] && return 0 - [[ $cmd == ypmatch && $cword -gt 2 ]] && return 0 + [[ $cmd == ypcat && $cword -gt 1 ]] && return + [[ $cmd == ypmatch && $cword -gt 2 ]] && return if [[ $cmd == ypmatch && $cword -eq 1 && ${#words[@]} -eq 3 ]]; then map=${words[2]} COMPREPLY=( $( compgen -W '$( ypcat $map 2>/dev/null | \ cut -d':' -f 1 )' -- "$cur" ) ) else - [[ $cmd == ypmatch && $cword -ne 2 ]] && return 0 + [[ $cmd == ypmatch && $cword -ne 2 ]] && return COMPREPLY=( $( compgen -W \ '$( printf "%s\n" $(ypcat -x 2>/dev/null | \ cut -d"\"" -f 2) )' -- "$cur" ) ) fi - - return 0 } && complete -F _ypmatch ypmatch ypcat -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/yum-arch b/completions/yum-arch index 8c217373..9dac178e 100644 --- a/completions/yum-arch +++ b/completions/yum-arch @@ -13,4 +13,4 @@ _yum_arch() } && complete -F _yum_arch yum-arch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/zopfli b/completions/zopfli new file mode 100644 index 00000000..23da6dbf --- /dev/null +++ b/completions/zopfli @@ -0,0 +1,31 @@ +# bash completion for zopfli -*- shell-script -*- + +_zopfli() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( _parse_help "$1" -h | command sed -e "s/#$//" )' -- "$cur" ) ) + [[ $COMPREPLY == --i ]] && compopt -o nospace + return + fi + + local IFS=$'\n' xspec="*.@(gz|t[ag]z)" + + _expand || return + + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _zopfli zopfli + +# ex: filetype=sh diff --git a/completions/zopflipng b/completions/zopflipng new file mode 100644 index 00000000..88ddbe68 --- /dev/null +++ b/completions/zopflipng @@ -0,0 +1,39 @@ +# bash completion for zopflipng -*- shell-script -*- + +_zopflipng() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help) + return + ;; + --splitting) + COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( _parse_help "$1" -h ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]%:}' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + if [[ ${words[@]} != *\ --prefix=* ]]; then + # 2 png args only if --prefix not given + local args + _count_args + [[ $args -lt 3 ]] && _filedir png + else + # otherwise arbitrary number of png args + _filedir png + fi +} && +complete -F _zopflipng zopflipng + +# ex: filetype=sh diff --git a/configure b/configure deleted file mode 100755 index d764b736..00000000 --- a/configure +++ /dev/null @@ -1,3391 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bash-completion 2.1. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 </dev/null -exec 6>&1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='bash-completion' -PACKAGE_TARNAME='bash-completion' -PACKAGE_VERSION='2.1' -PACKAGE_STRING='bash-completion 2.1' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_subst_vars='LTLIBOBJS -LIBOBJS -compatdir -LN_S -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -' - ac_precious_vars='build_alias -host_alias -target_alias' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures bash-completion 2.1 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/bash-completion] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of bash-completion 2.1:";; - esac - cat <<\_ACEOF - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -bash-completion configure 2.1 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by bash-completion $as_me 2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -am__api_version='1.11' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# 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]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -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 ( - 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 - rm -f conftest.file - 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". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -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 --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != 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 - -# 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. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -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 - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - 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 - - -# Define the identity of the package. - PACKAGE='bash-completion' - VERSION='2.1' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - - -compatdir=$sysconfdir/bash_completion.d - -ac_config_files="$ac_config_files Makefile completions/Makefile doc/Makefile helpers/Makefile test/Makefile bash-completion.pc" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by bash-completion $as_me 2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -bash-completion config.status 2.1 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "completions/Makefile") CONFIG_FILES="$CONFIG_FILES completions/Makefile" ;; - "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "helpers/Makefile") CONFIG_FILES="$CONFIG_FILES helpers/Makefile" ;; - "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - "bash-completion.pc") CONFIG_FILES="$CONFIG_FILES bash-completion.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' <conf$$subs.awk | sed ' -/^[^""]/{ - N - s/\n// -} -' >>$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/configure.ac b/configure.ac index 82e88ac2..3ea55598 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,17 @@ AC_PREREQ([2.60]) -AC_INIT([bash-completion], [2.1]) -AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip -Wall -Werror]) +AC_INIT([bash-completion], [2.7]) +AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip -Wall -Werror]) AC_PROG_LN_S AC_PROG_MKDIR_P AC_SUBST(compatdir, $sysconfdir/bash_completion.d) -AC_CONFIG_FILES([Makefile completions/Makefile doc/Makefile helpers/Makefile test/Makefile bash-completion.pc]) +AC_CONFIG_FILES([ +Makefile +completions/Makefile +doc/Makefile +helpers/Makefile +test/Makefile +bash-completion.pc +bash-completion-config.cmake +bash-completion-config-version.cmake +]) AC_OUTPUT diff --git a/doc/Makefile.in b/doc/Makefile.in deleted file mode 100644 index 42551b57..00000000 --- a/doc/Makefile.in +++ /dev/null @@ -1,336 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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 = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -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) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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 -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -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@ -EXTRA_DIST = \ - bash_completion.txt \ - bashrc \ - inputrc \ - main.txt \ - makeHtml.sh \ - styleguide.txt \ - testing.txt - -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 doc/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign doc/Makefile -.PRECIOUS: 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): -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -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 -check: check-am -all-am: Makefile -installdirs: -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: - -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-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: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am 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 uninstall uninstall-am - - -# 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/doc/bash_completion.txt b/doc/bash_completion.txt index c6e53d4c..e67f98bc 100644 --- a/doc/bash_completion.txt +++ b/doc/bash_completion.txt @@ -4,10 +4,11 @@ Bash completion Configuration files ------------------- -*~/.bash_completion*:: +*$BASH_COMPLETION_USER_FILE*:: Sourced late by bash_completion, pretty much after everything else. Use this file for example to load additional completions, and to remove - and override ones installed by bash_completion. + and override ones installed by bash_completion. Defaults to + `~/.bash_completion` if unset or null. *$XDG_CONFIG_HOME/bash_completion*:: Sourced by the bash_completion.sh profile.d script. This file is @@ -18,6 +19,12 @@ Configuration files Environment variables --------------------- +*BASH_COMPLETION_COMPAT_DIR*:: + Directory for pre-dynamic loading era (pre-2.0) backwards compatibility + completion files that are loaded eagerly from `bash_completion` when it is + loaded. If unset or null, the default compatibility directory to use is + `/etc/bash_completion.d`. + *COMP_CONFIGURE_HINTS*:: If set and not null, `configure` completion will return the entire option string (e.g. `--this-option=DESCRIPTION`) so one can see what kind of data diff --git a/doc/bashrc b/doc/bashrc index fd72b816..e22ec0e0 100644..120000 --- a/doc/bashrc +++ b/doc/bashrc @@ -1,41 +1 @@ -# bashrc file for DejaGnu testsuite - - # Use emacs key bindings -set -o emacs - # Use bash strict mode -set -o posix - # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this - # troubles and slows down testing -unset -f command_not_found_handle - # Set fixed prompt `/@' -TESTDIR=$(pwd) -export PS1='/@' -export PS2='> ' - # Configure readline -export INPUTRC=$SRCDIR/config/inputrc - # When not running via cron, avoid escape junk at beginning of line from - # readline, see e.g. http://bugs.gentoo.org/246091 -[ "$CRON" ] || export TERM=dummy - # Ensure enough columns so expect doesn't have to care about line breaks -stty columns 150 - # Also test completions of system administrator commands, which are - # installed via the same PATH expansion in `bash_completion.have()' -export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin - - # Make sure default settings are in effect -unset -v \ - COMP_CONFIGURE_HINTS \ - COMP_CVS_REMOTE \ - COMP_KNOWN_HOSTS_WITH_HOSTFILE \ - COMP_TAR_INTERNAL_PATHS - - # Load bash testsuite helper functions -. $SRCDIR/lib/library.sh - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh +../test/config/bashrc
\ No newline at end of file diff --git a/doc/inputrc b/doc/inputrc index 33134da6..b6f22e65 100644..120000 --- a/doc/inputrc +++ b/doc/inputrc @@ -1,21 +1 @@ -# Readline init file for DejaGnu testsuite -# See: info readline - - # Press TAB once (instead of twice) to auto-complete -set show-all-if-ambiguous on - # No bell. No ^G in output -set bell-style none - # Don't query user about viewing the number of possible completions -set completion-query-items -1 - # Display completions sorted horizontally, not vertically -set print-completions-horizontally on - # Don't use pager when showing completions -set page-completions off - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh +../test/config/inputrc
\ No newline at end of file diff --git a/doc/testing.txt b/doc/testing.txt index c4b7cf18..0e7d3d31 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -192,8 +192,8 @@ git pull # Run tests on bash-4 -./runUnit --outdir log/bash-4 --tool_exec /opt/bash-4.0/bin/bash > $LOG || cat $LOG -./runCompletion --outdir log/bash-4 --tool_exec /opt/bash-4.0/bin/bash > $LOG || cat $LOG +./runUnit --outdir log/bash-4 --tool_exec /opt/bash-4.3/bin/bash > $LOG || cat $LOG +./runCompletion --outdir log/bash-4 --tool_exec /opt/bash-4.3/bin/bash > $LOG || cat $LOG # Clean up log file [ -f $LOG ] && rm $LOG @@ -207,7 +207,7 @@ Using `--tool_exec` you can specify which bash binary you want to run the test suite against, e.g.: ---------------- -./runUnit --tool_exec /opt/bash-4.0/bin/bash +./runUnit --tool_exec /opt/bash-4.3/bin/bash ---------------- diff --git a/extra/make-changelog.py b/extra/make-changelog.py new file mode 100755 index 00000000..184a1d2e --- /dev/null +++ b/extra/make-changelog.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- + +from collections import defaultdict +from email.utils import formatdate +import sys +from textwrap import wrap + +import git + +repo = git.Repo('.') +changelog = defaultdict(list) + +for id in repo.iter_commits('%s..HEAD' % sys.argv[1]): + commit = repo.commit(id) + if not commit.summary.startswith("Merge pull request "): + changelog[commit.author.name].append(commit.summary) + +print('bash-completion (X.Y)') +print('') + +for author in sorted(changelog.keys()): + print(' [ %s ]' % author) + for log in changelog[author]: + print('\n'.join( + wrap(log, initial_indent=' * ', subsequent_indent=' '))) + print('') + +print(' -- Ville Skyttä <ville.skytta@iki.fi> %s' % + formatdate(localtime=True)) diff --git a/helpers/Makefile.am b/helpers/Makefile.am index 0c8ed300..aef19b0c 100644 --- a/helpers/Makefile.am +++ b/helpers/Makefile.am @@ -1,4 +1,4 @@ helpersdir = $(pkgdatadir)/helpers -helpers_DATA = perl +helpers_DATA = perl python EXTRA_DIST = $(helpers_DATA) diff --git a/helpers/Makefile.in b/helpers/Makefile.in deleted file mode 100644 index 04ccc164..00000000 --- a/helpers/Makefile.in +++ /dev/null @@ -1,385 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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 = helpers -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -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) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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)$(helpersdir)" -DATA = $(helpers_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -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@ -helpersdir = $(pkgdatadir)/helpers -helpers_DATA = perl -EXTRA_DIST = $(helpers_DATA) -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 helpers/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign helpers/Makefile -.PRECIOUS: 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-helpersDATA: $(helpers_DATA) - @$(NORMAL_INSTALL) - @list='$(helpers_DATA)'; test -n "$(helpersdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(helpersdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(helpersdir)" || 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)$(helpersdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(helpersdir)" || exit $$?; \ - done - -uninstall-helpersDATA: - @$(NORMAL_UNINSTALL) - @list='$(helpers_DATA)'; test -n "$(helpersdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(helpersdir)'; $(am__uninstall_files_from_dir) -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -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 -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(helpersdir)"; 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: - -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-helpersDATA - -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-helpersDATA - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am \ - install-helpersDATA 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 uninstall uninstall-am uninstall-helpersDATA - - -# 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/helpers/perl b/helpers/perl index f847dc74..2a01a096 100644 --- a/helpers/perl +++ b/helpers/perl @@ -2,12 +2,13 @@ use strict; use Config; +use Cwd; use File::Spec::Functions; my %seen; sub print_modules_real { - my ($base, $dir, $word) = @_; + my ($base, $dir, $word, $include_pod) = @_; # return immediately if potential completion doesn't match current word # a double comparison is used to avoid dealing with string lengths @@ -23,8 +24,9 @@ sub print_modules_real { chdir($dir) or return; # print each file - foreach my $file (glob('*.pm')) { - $file =~ s/\.pm$//; + foreach my $file (sort(glob('*.pm'),glob('*.pod'))) { + next if ($file =~ /\.pod$/ and not $include_pod); + $file =~ s/\.(?:pm|pod)$//; my $module = $base . $file; next if $module !~ /^\Q$word/; next if $seen{$module}++; @@ -36,19 +38,21 @@ sub print_modules_real { my $subdir = $dir . '/' . $directory; if ($directory =~ /^(?:[.\d]+|$Config{archname}|auto)$/) { # exclude subdirectory name from base - print_modules_real(undef, $subdir, $word); + print_modules_real(undef, $subdir, $word, $include_pod); } else { # add subdirectory name to base - print_modules_real($base . $directory . '::', $subdir, $word); + print_modules_real($base . $directory . '::', $subdir, $word, $include_pod); } } } sub print_modules { - my ($word) = @_; + my ($word, $include_pod) = @_; + my $origdir = getcwd; foreach my $directory (@INC) { - print_modules_real(undef, $directory, $word); + print_modules_real(undef, $directory, $word, $include_pod); + chdir $origdir; } } @@ -86,4 +90,7 @@ if ($type eq 'functions') { print_functions($word); } elsif ($type eq 'modules') { print_modules($word); +} elsif ($type eq 'perldocs') { + print_modules($word, 1); } + diff --git a/helpers/python b/helpers/python new file mode 100644 index 00000000..23c14bde --- /dev/null +++ b/helpers/python @@ -0,0 +1,6 @@ +# -*- python -*- + +import pkgutil + +for mod in pkgutil.iter_modules(): + print(mod[1]) diff --git a/install-sh b/install-sh deleted file mode 100755 index a9244eb0..00000000 --- a/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-01-19.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for `test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for `test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for `test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/missing b/missing deleted file mode 100755 index 86a8fc31..00000000 --- a/missing +++ /dev/null @@ -1,331 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2012-01-06.13; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. - -# 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, see <http://www.gnu.org/licenses/>. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -Send bug reports to <bug-automake@gnu.org>." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te*) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison*|yacc*) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex*|flex*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi - ;; - - makeinfo*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 00000000..2ea9dc1e --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,4 @@ +dbg.log +xtrace.log +site.exp +site.bak diff --git a/test/Makefile.in b/test/Makefile.in deleted file mode 100644 index 5cdd4f51..00000000 --- a/test/Makefile.in +++ /dev/null @@ -1,387 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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 = test -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -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) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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 -RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir -EXPECT = expect -RUNTEST = runtest -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -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@ -DEJATOOL = completion install unit -AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log -EXTRA_DIST = completion \ - config \ - fixtures \ - lib \ - unit - -AUTOMAKE_OPTIONS = dejagnu -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 test/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/Makefile -.PRECIOUS: 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): -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -check-DEJAGNU: site.exp - srcdir='$(srcdir)'; export srcdir; \ - EXPECT=$(EXPECT); export EXPECT; \ - runtest=$(RUNTEST); \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ - if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ - then :; else exit_status=1; fi; \ - done; \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi; \ - exit $$exit_status -site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set srcdir "$(srcdir)"' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp - @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ - echo "## Begin content included from file $$f. Do not modify. ##" \ - && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ - && echo "## End content included from file $$f. ##" \ - || exit 1; \ - done >> site.tmp - @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp - @if test -f site.exp; then \ - sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ - fi - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - -distclean-DEJAGNU: - -rm -f site.exp site.bak - -l='$(DEJATOOL)'; for tool in $$l; do \ - rm -f $$tool.sum $$tool.log; \ - done - -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-DEJAGNU -check: check-am -all-am: Makefile -installdirs: -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: - -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-DEJAGNU distclean-generic \ - distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -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: - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ - distclean distclean-DEJAGNU distclean-generic distclean-local \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am 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 uninstall uninstall-am - - -all: - $(MKDIR_P) log tmp - -distclean-local: - rm -rf log tmp - -# 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/test/completion/2to3.exp b/test/completion/2to3.exp new file mode 100644 index 00000000..9efdd77e --- /dev/null +++ b/test/completion/2to3.exp @@ -0,0 +1 @@ +assert_source_completions 2to3 diff --git a/test/completion/7z.exp b/test/completion/7z.exp new file mode 100644 index 00000000..0796b7a5 --- /dev/null +++ b/test/completion/7z.exp @@ -0,0 +1 @@ +assert_source_completions 7z diff --git a/test/completion/acroread.exp b/test/completion/acroread.exp index 6ee03d6e..95704601 100644 --- a/test/completion/acroread.exp +++ b/test/completion/acroread.exp @@ -1,12 +1,3 @@ -set test "Completion via _filedir_xspec() should be installed" -set cmd "complete -p acroread" -send "$cmd\r" - -set expected "^$cmd\r\ncomplete -F _filedir_xspec acroread\r\n/@$" -expect { - -re $expected { pass "$test" } - -re /@ { fail "$test at prompt" } -}; # expect - +assert_xspec_completion_installed acroread source "$::srcdir/lib/completions/acroread.exp" diff --git a/test/completion/adb.exp b/test/completion/adb.exp new file mode 100644 index 00000000..0da0ad12 --- /dev/null +++ b/test/completion/adb.exp @@ -0,0 +1 @@ +assert_source_completions adb diff --git a/test/completion/alpine.exp b/test/completion/alpine.exp new file mode 100644 index 00000000..04ac8b01 --- /dev/null +++ b/test/completion/alpine.exp @@ -0,0 +1 @@ +assert_source_completions alpine diff --git a/test/completion/appdata-validate.exp b/test/completion/appdata-validate.exp new file mode 100644 index 00000000..5fae5959 --- /dev/null +++ b/test/completion/appdata-validate.exp @@ -0,0 +1 @@ +assert_source_completions appdata-validate diff --git a/test/completion/arch.exp b/test/completion/arch.exp index 254acd53..25cda56f 100644 --- a/test/completion/arch.exp +++ b/test/completion/arch.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions arch +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/bind.exp b/test/completion/bind.exp new file mode 100644 index 00000000..d93003b7 --- /dev/null +++ b/test/completion/bind.exp @@ -0,0 +1 @@ +assert_source_completions bind diff --git a/test/completion/change_pw.exp b/test/completion/change_pw.exp index 0b152a1c..aed916fb 100644 --- a/test/completion/change_pw.exp +++ b/test/completion/change_pw.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions change_pw +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/checksec.exp b/test/completion/checksec.exp new file mode 100644 index 00000000..7e25e898 --- /dev/null +++ b/test/completion/checksec.exp @@ -0,0 +1 @@ +assert_source_completions checksec diff --git a/test/completion/chroot.exp b/test/completion/chroot.exp new file mode 100644 index 00000000..5cdf8f52 --- /dev/null +++ b/test/completion/chroot.exp @@ -0,0 +1 @@ +assert_source_completions chroot diff --git a/test/completion/cleanarch.exp b/test/completion/cleanarch.exp index 93646e07..504f6865 100644 --- a/test/completion/cleanarch.exp +++ b/test/completion/cleanarch.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions cleanarch +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/configure.exp b/test/completion/configure.exp index cf5611ce..16130d48 100644 --- a/test/completion/configure.exp +++ b/test/completion/configure.exp @@ -1 +1 @@ -assert_source_completions configure +source "$::srcdir/lib/completions/configure.exp" diff --git a/test/completion/createuser.exp b/test/completion/createuser.exp new file mode 100644 index 00000000..ad1c24c9 --- /dev/null +++ b/test/completion/createuser.exp @@ -0,0 +1 @@ +assert_source_completions createuser diff --git a/test/completion/declare.exp b/test/completion/declare.exp new file mode 100644 index 00000000..a62f9891 --- /dev/null +++ b/test/completion/declare.exp @@ -0,0 +1 @@ +assert_source_completions declare diff --git a/test/completion/deja-dup.exp b/test/completion/deja-dup.exp new file mode 100644 index 00000000..b2dc288d --- /dev/null +++ b/test/completion/deja-dup.exp @@ -0,0 +1 @@ +assert_source_completions deja-dup diff --git a/test/completion/dropuser.exp b/test/completion/dropuser.exp new file mode 100644 index 00000000..1be7988a --- /dev/null +++ b/test/completion/dropuser.exp @@ -0,0 +1 @@ +assert_source_completions dropuser diff --git a/test/completion/dumpdb.exp b/test/completion/dumpdb.exp index 1bfaecc8..96aee537 100644 --- a/test/completion/dumpdb.exp +++ b/test/completion/dumpdb.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions dumpdb +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/flake8.exp b/test/completion/flake8.exp new file mode 100644 index 00000000..8050e8a8 --- /dev/null +++ b/test/completion/flake8.exp @@ -0,0 +1 @@ +assert_source_completions flake8 diff --git a/test/completion/freebsd-update.exp b/test/completion/freebsd-update.exp new file mode 100644 index 00000000..80c35662 --- /dev/null +++ b/test/completion/freebsd-update.exp @@ -0,0 +1 @@ +assert_source_completions freebsd-update diff --git a/test/completion/function.exp b/test/completion/function.exp new file mode 100644 index 00000000..04c6e2b2 --- /dev/null +++ b/test/completion/function.exp @@ -0,0 +1 @@ +assert_source_completions function diff --git a/test/completion/genaliases.exp b/test/completion/genaliases.exp index eeee394f..bd33abb3 100644 --- a/test/completion/genaliases.exp +++ b/test/completion/genaliases.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions genaliases +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/gm.exp b/test/completion/gm.exp new file mode 100644 index 00000000..82177a28 --- /dev/null +++ b/test/completion/gm.exp @@ -0,0 +1 @@ +assert_source_completions gm diff --git a/test/completion/gnokii.exp b/test/completion/gnokii.exp new file mode 100644 index 00000000..4cd3055c --- /dev/null +++ b/test/completion/gnokii.exp @@ -0,0 +1 @@ +assert_source_completions gnokii diff --git a/test/completion/hostname.exp b/test/completion/hostname.exp new file mode 100644 index 00000000..3c6983ee --- /dev/null +++ b/test/completion/hostname.exp @@ -0,0 +1 @@ +assert_source_completions hostname diff --git a/test/completion/hping3.exp b/test/completion/hping3.exp new file mode 100644 index 00000000..5ffb9b06 --- /dev/null +++ b/test/completion/hping3.exp @@ -0,0 +1 @@ +assert_source_completions hping3 diff --git a/test/completion/indent.exp b/test/completion/indent.exp deleted file mode 100644 index 91eae727..00000000 --- a/test/completion/indent.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions indent diff --git a/test/completion/inject.exp b/test/completion/inject.exp index c2a18a46..6fcd8093 100644 --- a/test/completion/inject.exp +++ b/test/completion/inject.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions inject +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/jpegoptim.exp b/test/completion/jpegoptim.exp new file mode 100644 index 00000000..1d43b944 --- /dev/null +++ b/test/completion/jpegoptim.exp @@ -0,0 +1 @@ +assert_source_completions jpegoptim diff --git a/test/completion/jshint.exp b/test/completion/jshint.exp new file mode 100644 index 00000000..4416472c --- /dev/null +++ b/test/completion/jshint.exp @@ -0,0 +1 @@ +assert_source_completions jshint diff --git a/test/completion/kdvi.exp b/test/completion/kdvi.exp index 9f6aa664..78bd4a94 100644 --- a/test/completion/kdvi.exp +++ b/test/completion/kdvi.exp @@ -1 +1,3 @@ -assert_source_completions kdvi +assert_xspec_completion_installed kdvi + +source "$::srcdir/lib/completions/kdvi.exp" diff --git a/test/completion/kpdf.exp b/test/completion/kpdf.exp index d0a17749..53417c32 100644 --- a/test/completion/kpdf.exp +++ b/test/completion/kpdf.exp @@ -1 +1,3 @@ -assert_source_completions kpdf +assert_xspec_completion_installed kpdf + +source "$::srcdir/lib/completions/kpdf.exp" diff --git a/test/completion/list_owners.exp b/test/completion/list_owners.exp index 88262b09..9f6cf03d 100644 --- a/test/completion/list_owners.exp +++ b/test/completion/list_owners.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions list_owners +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/lz4.exp b/test/completion/lz4.exp new file mode 100644 index 00000000..9db680ed --- /dev/null +++ b/test/completion/lz4.exp @@ -0,0 +1 @@ +assert_source_completions lz4 diff --git a/test/completion/mailmanctl.exp b/test/completion/mailmanctl.exp index 2784b27c..58773291 100644 --- a/test/completion/mailmanctl.exp +++ b/test/completion/mailmanctl.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions mailmanctl +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/mock.exp b/test/completion/mock.exp new file mode 100644 index 00000000..22910a84 --- /dev/null +++ b/test/completion/mock.exp @@ -0,0 +1 @@ +assert_source_completions mock diff --git a/test/completion/mr.exp b/test/completion/mr.exp new file mode 100644 index 00000000..85f38ccd --- /dev/null +++ b/test/completion/mr.exp @@ -0,0 +1 @@ +assert_source_completions mr diff --git a/test/completion/newgrp.exp b/test/completion/newgrp.exp new file mode 100644 index 00000000..bbd12372 --- /dev/null +++ b/test/completion/newgrp.exp @@ -0,0 +1 @@ +assert_source_completions newgrp diff --git a/test/completion/optipng.exp b/test/completion/optipng.exp new file mode 100644 index 00000000..b3207543 --- /dev/null +++ b/test/completion/optipng.exp @@ -0,0 +1 @@ +assert_source_completions optipng diff --git a/test/completion/pdftotext.exp b/test/completion/pdftotext.exp new file mode 100644 index 00000000..d84cee5d --- /dev/null +++ b/test/completion/pdftotext.exp @@ -0,0 +1 @@ +assert_source_completions pdftotext diff --git a/test/completion/pngfix.exp b/test/completion/pngfix.exp new file mode 100644 index 00000000..7cea7218 --- /dev/null +++ b/test/completion/pngfix.exp @@ -0,0 +1 @@ +assert_source_completions pngfix diff --git a/test/completion/portsnap.exp b/test/completion/portsnap.exp new file mode 100644 index 00000000..424004e0 --- /dev/null +++ b/test/completion/portsnap.exp @@ -0,0 +1 @@ +assert_source_completions portsnap diff --git a/test/completion/pushd.exp b/test/completion/pushd.exp new file mode 100644 index 00000000..44556cdb --- /dev/null +++ b/test/completion/pushd.exp @@ -0,0 +1 @@ +assert_source_completions pushd diff --git a/test/completion/py.test.exp b/test/completion/py.test.exp new file mode 100644 index 00000000..8f09927d --- /dev/null +++ b/test/completion/py.test.exp @@ -0,0 +1 @@ +assert_source_completions py.test diff --git a/test/completion/pyflakes.exp b/test/completion/pyflakes.exp new file mode 100644 index 00000000..b10445f6 --- /dev/null +++ b/test/completion/pyflakes.exp @@ -0,0 +1 @@ +assert_source_completions pyflakes diff --git a/test/completion/pyvenv.exp b/test/completion/pyvenv.exp new file mode 100644 index 00000000..ce5c8a62 --- /dev/null +++ b/test/completion/pyvenv.exp @@ -0,0 +1 @@ +assert_source_completions pyvenv diff --git a/test/completion/qrunner.exp b/test/completion/qrunner.exp index 567dcb4d..e8b30af7 100644 --- a/test/completion/qrunner.exp +++ b/test/completion/qrunner.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions qrunner +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/repomanage.exp b/test/completion/repomanage.exp new file mode 100644 index 00000000..79ec53b2 --- /dev/null +++ b/test/completion/repomanage.exp @@ -0,0 +1 @@ +assert_source_completions repomanage diff --git a/test/completion/ssh-keygen.exp b/test/completion/ssh-keygen.exp new file mode 100644 index 00000000..f074b5a4 --- /dev/null +++ b/test/completion/ssh-keygen.exp @@ -0,0 +1 @@ +assert_source_completions ssh-keygen diff --git a/test/completion/synclient.exp b/test/completion/synclient.exp new file mode 100644 index 00000000..9a277096 --- /dev/null +++ b/test/completion/synclient.exp @@ -0,0 +1 @@ +assert_source_completions synclient diff --git a/test/completion/timeout.exp b/test/completion/timeout.exp new file mode 100644 index 00000000..434a291a --- /dev/null +++ b/test/completion/timeout.exp @@ -0,0 +1 @@ +assert_source_completions timeout diff --git a/test/completion/tipc.exp b/test/completion/tipc.exp new file mode 100644 index 00000000..51a6a7d7 --- /dev/null +++ b/test/completion/tipc.exp @@ -0,0 +1 @@ +assert_source_completions tipc diff --git a/test/completion/udevadm.exp b/test/completion/udevadm.exp new file mode 100644 index 00000000..69c980ff --- /dev/null +++ b/test/completion/udevadm.exp @@ -0,0 +1 @@ +assert_source_completions udevadm diff --git a/test/completion/unshunt.exp b/test/completion/unshunt.exp index fea1a7a3..9755c784 100644 --- a/test/completion/unshunt.exp +++ b/test/completion/unshunt.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions unshunt +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/vi.exp b/test/completion/vi.exp index b0191404..675ea06a 100644 --- a/test/completion/vi.exp +++ b/test/completion/vi.exp @@ -1 +1,3 @@ -assert_source_completions vi +assert_xspec_completion_installed vi + +source "$::srcdir/lib/completions/vi.exp" diff --git a/test/completion/zopfli.exp b/test/completion/zopfli.exp new file mode 100644 index 00000000..086f78cf --- /dev/null +++ b/test/completion/zopfli.exp @@ -0,0 +1 @@ +assert_source_completions zopfli diff --git a/test/completion/zopflipng.exp b/test/completion/zopflipng.exp new file mode 100644 index 00000000..e16a74ab --- /dev/null +++ b/test/completion/zopflipng.exp @@ -0,0 +1 @@ +assert_source_completions zopflipng diff --git a/test/config/bashrc b/test/config/bashrc index fd72b816..d16c9033 100644 --- a/test/config/bashrc +++ b/test/config/bashrc @@ -4,7 +4,7 @@ set -o emacs # Use bash strict mode set -o posix - # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this + # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this # troubles and slows down testing unset -f command_not_found_handle # Set fixed prompt `/@' @@ -15,12 +15,21 @@ export PS2='> ' export INPUTRC=$SRCDIR/config/inputrc # When not running via cron, avoid escape junk at beginning of line from # readline, see e.g. http://bugs.gentoo.org/246091 -[ "$CRON" ] || export TERM=dummy +[ "$CRON" ] || export TERM=dumb # Ensure enough columns so expect doesn't have to care about line breaks stty columns 150 # Also test completions of system administrator commands, which are # installed via the same PATH expansion in `bash_completion.have()' export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin + # ...as well as games on some systems not in PATH by default: +export PATH=$PATH:/usr/games:/usr/local/games + # For clean test state, avoid sourcing user's ~/.bash_completion +export BASH_COMPLETION_USER_FILE=/dev/null + # ...and avoid stuff in BASH_COMPLETION_USER_DIR overriding in-tree + # completions. The user dir is first in the lookup path, so this should also + # give precedence to the in-tree "completions" dir over other ones, e.g. + # the one possibly in /usr/share/bash-completion. +export BASH_COMPLETION_USER_DIR=$(cd "$SRCDIR/.."; pwd) # Make sure default settings are in effect unset -v \ @@ -34,8 +43,5 @@ unset -v \ # Local variables: # mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil # End: -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/test/config/default.exp b/test/config/default.exp index 1eb47a2c..246499b4 100644 --- a/test/config/default.exp +++ b/test/config/default.exp @@ -2,20 +2,20 @@ expect_after { eof { if {[info exists test]} { - fail "$test at eof" + fail "$test at eof" } elseif {[info level] > 0} { - fail "[info level 1] at eof" + fail "[info level 1] at eof" } else { fail "eof" - } - } + } + } timeout { if {[info exists test]} { - fail "$test at timeout" + fail "$test at timeout" } elseif {[info level] > 0} { - fail "[info level 1] at timeout" + fail "[info level 1] at timeout" } else { - fail "timeout" - } - } + fail "timeout" + } + } } diff --git a/test/config/inputrc b/test/config/inputrc index 33134da6..5992491a 100644 --- a/test/config/inputrc +++ b/test/config/inputrc @@ -14,8 +14,5 @@ set page-completions off # Local variables: # mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil # End: -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/test/docker/Dockerfile-centos6 b/test/docker/Dockerfile-centos6 new file mode 100644 index 00000000..8686fde4 --- /dev/null +++ b/test/docker/Dockerfile-centos6 @@ -0,0 +1,18 @@ +FROM centos:6 + +# TODO: more coverage +# /usr/bin/which: https://bugzilla.redhat.com/show_bug.cgi?id=1443357 +RUN sed -i -e /tsflags=nodocs/d /etc/yum.conf \ + && \ + yum -y install \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm \ + && \ + yum -y install \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + /usr/bin/xvfb-run /usr/bin/which + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/Dockerfile-fedoradev b/test/docker/Dockerfile-fedoradev new file mode 100644 index 00000000..423f836b --- /dev/null +++ b/test/docker/Dockerfile-fedoradev @@ -0,0 +1,41 @@ +FROM fedora:rawhide + +# TODO: more coverage +# /usr/bin/which: https://bugzilla.redhat.com/show_bug.cgi?id=1443357 +RUN dnf --refresh -y install \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + /usr/bin/xvfb-run /usr/bin/which \ + && \ + dnf -y install \ + /usr/bin/checksec \ + /usr/bin/compare \ + /usr/bin/dcop \ + /usr/sbin/ether-wake \ + /usr/bin/g77 \ + /usr/sbin/hping2 \ + /usr/bin/koji \ + /usr/bin/lua \ + /usr/bin/luac \ + /usr/sbin/mii-diag \ + /usr/bin/mock \ + /usr/bin/msynctool \ + /usr/bin/mutt \ + /usr/bin/ncftp \ + /usr/bin/phing \ + /usr/bin/plague-client \ + /usr/bin/pngfix \ + /usr/bin/pyvenv \ + /usr/bin/snownews \ + /usr/bin/stream \ + /usr/bin/svk \ + /usr/sbin/tipc \ + /usr/bin/wine \ + /usr/bin/wol \ + /usr/bin/xmms \ + /usr/bin/zopflipng + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/Dockerfile-ubuntu14 b/test/docker/Dockerfile-ubuntu14 new file mode 100644 index 00000000..8db91503 --- /dev/null +++ b/test/docker/Dockerfile-ubuntu14 @@ -0,0 +1,197 @@ +FROM ubuntu:14.04 + +# TODO: more coverage +# TODO: wine needs dpkg --add-architecture i386 before apt-get update, but +# that results in apt-get update errors (some index files not found) +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + xvfb \ + software-properties-common && \ + apt-add-repository multiverse && \ + apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + a2ps \ + abook \ + acpi \ + alpine \ + android-tools-adb \ + ant \ + apache2 \ + apache2-utils \ + apt-build \ + asciidoc \ + aspell \ + autoconf \ + automake \ + bc \ + bind9-host \ + bison \ + bluez \ + bridge-utils \ + bsdgames \ + ccache \ + cfengine2 \ + chrony \ + chrpath \ + cksfv \ + clisp \ + cowsay \ + cppcheck \ + cryptsetup-bin \ + cups-bsd \ + cups-client \ + curl \ + cvs \ + cvsps \ + deja-dup \ + desktop-file-utils \ + dict \ + dnsutils \ + dselect \ + dsniff \ + enscript \ + eog \ + evince \ + expat \ + fbi \ + feh \ + file-roller \ + finger \ + freerdp-x11 \ + fuse \ + gcj-jdk \ + gcl \ + gdb \ + genisoimage \ + gkrellm \ + gnat-4.6 \ + gnokii-cli \ + gnome-mplayer \ + gperf \ + gphoto2 \ + graphicsmagick \ + graphicsmagick-imagemagick-compat \ + graphviz \ + growisofs \ + grub \ + hddtemp \ + hping3 \ + htop \ + icedtea-netx \ + idn \ + iftop \ + info \ + iperf \ + ipmitool \ + iputils-arping \ + iputils-ping \ + iputils-tracepath \ + ipv6calc \ + isc-dhcp-client \ + jpegoptim \ + k3b \ + kcov \ + kplayer \ + ldap-utils \ + ldapvi \ + lftp \ + liblz4-tool \ + libuser \ + lilo \ + links \ + lrzip \ + lsof \ + lvm2 \ + lzip \ + lzop \ + mailman \ + man \ + mariadb-client-5.5 \ + mc \ + mcrypt \ + mdadm \ + medusa \ + mencoder \ + minicom \ + monodevelop \ + mplayer-gui \ + mr \ + mtx \ + mussh \ + net-tools \ + nethogs \ + network-manager \ + nfs-common \ + ngrep \ + nis \ + nodejs-legacy \ + npm \ + ntpdate \ + open-iscsi-utils \ + openjdk-7-jdk \ + openswan \ + optipng \ + p7zip-full \ + patchutils \ + perl-doc \ + pinfo \ + poppler-utils \ + postgresql-client-9.3 \ + postfix \ + prelink \ + protobuf-compiler \ + puppet-common \ + pwgen \ + pyflakes \ + pylint \ + python-flake8 \ + python-pytest \ + python3 \ + quota \ + rcs \ + rdesktop \ + reportbug \ + reptyr \ + ri \ + rpm \ + rsync \ + samba-common-bin \ + sbcl \ + screen \ + sharutils \ + sitecopy \ + smartmontools \ + smbclient \ + sqlite3 \ + strace \ + subversion \ + sysbench \ + tcpdump \ + texinfo \ + tshark \ + unace \ + unrar \ + units \ + unixodbc \ + valgrind \ + vpnc \ + wget \ + wireless-tools \ + wodim \ + wvdial \ + x11-xserver-utils \ + xserver-xorg-input-synaptics \ + xsltproc \ + xvnc4viewer \ + xzdec \ + yum \ + yum-utils \ + zopfli && \ + npm install -g jshint + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/docker-script.sh b/test/docker/docker-script.sh new file mode 100755 index 00000000..6ba6fa90 --- /dev/null +++ b/test/docker/docker-script.sh @@ -0,0 +1,19 @@ +#!/bin/sh -ex + +export bashcomp_bash=bash +env + +autoreconf -i +./configure +make + +make -C completions check + +cd test +xvfb-run ./runCompletion --all +./runInstall --all +./runUnit --all + +cd .. +mkdir install-test +make install DESTDIR=$(pwd)/install-test diff --git a/test/fixtures/7z/a.7z b/test/fixtures/7z/a.7z Binary files differnew file mode 100644 index 00000000..33570649 --- /dev/null +++ b/test/fixtures/7z/a.7z diff --git a/test/fixtures/7z/f.txt b/test/fixtures/7z/f.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/7z/f.txt @@ -0,0 +1 @@ + diff --git a/test/fixtures/_filedir/a"b/d b/test/fixtures/_get_cword/sea index e69de29b..e69de29b 100644 --- a/test/fixtures/_filedir/a"b/d +++ b/test/fixtures/_get_cword/sea diff --git a/test/fixtures/make/empty_dir/.nothing_here b/test/fixtures/_get_cword/seb index e69de29b..e69de29b 100644 --- a/test/fixtures/make/empty_dir/.nothing_here +++ b/test/fixtures/_get_cword/seb diff --git a/test/fixtures/man/man3/Bash::Completion.3pm.gz b/test/fixtures/_get_cword/sec index e69de29b..e69de29b 100644 --- a/test/fixtures/man/man3/Bash::Completion.3pm.gz +++ b/test/fixtures/_get_cword/sec diff --git a/test/fixtures/_get_cword/ääää§ b/test/fixtures/_get_cword/ääää§ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/_get_cword/ääää§ diff --git a/test/fixtures/_known_hosts_real/.ssh/config_relative_path b/test/fixtures/_known_hosts_real/.ssh/config_relative_path new file mode 100644 index 00000000..a7ad4d14 --- /dev/null +++ b/test/fixtures/_known_hosts_real/.ssh/config_relative_path @@ -0,0 +1 @@ +Host relative_path diff --git a/test/fixtures/_known_hosts_real/config b/test/fixtures/_known_hosts_real/config index 77770ffe..1231dd79 100644 --- a/test/fixtures/_known_hosts_real/config +++ b/test/fixtures/_known_hosts_real/config @@ -2,5 +2,6 @@ # Unindented Host gee jar + HostName %h.example.com # Indented Host hus # With comment diff --git a/test/fixtures/_known_hosts_real/config_full_path b/test/fixtures/_known_hosts_real/config_full_path new file mode 100644 index 00000000..a91649b9 --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_full_path @@ -0,0 +1 @@ +Include ~/config_include_recursion diff --git a/test/fixtures/_known_hosts_real/config_include b/test/fixtures/_known_hosts_real/config_include new file mode 100644 index 00000000..fe6f537e --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_include @@ -0,0 +1,5 @@ +#$HOME set to fixtures/_known_hosts_real in unit test +# Include with full path (recursive one) +Include ~/config_full_path +# Include with relative path +Include config_relative_path diff --git a/test/fixtures/_known_hosts_real/config_include_recursion b/test/fixtures/_known_hosts_real/config_include_recursion new file mode 100644 index 00000000..27770690 --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_include_recursion @@ -0,0 +1 @@ +Host recursion diff --git a/test/fixtures/ant/.gitignore b/test/fixtures/ant/.gitignore new file mode 100644 index 00000000..459f1019 --- /dev/null +++ b/test/fixtures/ant/.gitignore @@ -0,0 +1,2 @@ +.ant-targets-build.xml +.ant-targets-named-build.xml diff --git a/test/fixtures/ant/build-with-import.xml b/test/fixtures/ant/build-with-import.xml new file mode 100644 index 00000000..881981a5 --- /dev/null +++ b/test/fixtures/ant/build-with-import.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project default="build-with-import" name="bash-completion"> + <import file="imported-build.xml" /> + + <target name="build-with-import"> + <!-- ... --> + </target> +</project> diff --git a/test/fixtures/ant/build.xml b/test/fixtures/ant/build.xml index 146c7f3b..09b4cd2a 100644 --- a/test/fixtures/ant/build.xml +++ b/test/fixtures/ant/build.xml @@ -8,9 +8,9 @@ <!-- ... --> </target> - <target foo="bar" name="init"></target> + <target description="bar" name="init"></target> <target -foo="bar" +description="bar" name='bashcomp' > <!-- ... --> </target> diff --git a/test/fixtures/ant/imported-build.xml b/test/fixtures/ant/imported-build.xml new file mode 100644 index 00000000..0cc438f0 --- /dev/null +++ b/test/fixtures/ant/imported-build.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project default="imported-build" name="bash-completion"> + <target name="imported-build"> + <!-- ... --> + </target> +</project> diff --git a/test/fixtures/ant/named-build.xml b/test/fixtures/ant/named-build.xml new file mode 100644 index 00000000..e61386d5 --- /dev/null +++ b/test/fixtures/ant/named-build.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project basedir="." default="named-build" name="bash-completion"> + <target name="named-build"> + <!-- ... --> + </target> +</project> diff --git a/test/fixtures/java/no-complete.txt b/test/fixtures/java/no-complete.txt new file mode 100644 index 00000000..8ca1ef6a --- /dev/null +++ b/test/fixtures/java/no-complete.txt @@ -0,0 +1 @@ +This file should not be included in classpath etc completions. diff --git a/test/fixtures/make/.gitignore b/test/fixtures/make/.gitignore new file mode 100644 index 00000000..3d1325c6 --- /dev/null +++ b/test/fixtures/make/.gitignore @@ -0,0 +1 @@ +extra_makefile diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile index 1a6416cd..b04a6eb2 100644 --- a/test/fixtures/make/Makefile +++ b/test/fixtures/make/Makefile @@ -1,10 +1,15 @@ +$(info confuse: make) + +CFLAGS=-MMD -MP NAME := sample .PHONY: all all: $(NAME) -$(NAME): sample.c - cc -o $@ $^ +$(NAME): sample.o + +.INTERMEDIATE: sample.o +sample.o: sample.c .PHONY: install install: all @@ -14,3 +19,28 @@ install: all .PHONY: clean clean: -rm -f $(NAME) + +.test_passes: + ./sample >/dev/null + touch ^@ + +.cache/.1: + touch $@ + +.cache/.2: + touch $@ + +.cache/1: + touch $@ + +.cache/2: + touch $@ + +ifndef __BASH_MAKE_COMPLETION__ +-include sample.d +endif + +VARIABLE_LOOKS_A_BIT_LIKE_A_TARGET := fooled-you +extra_makefile: + touch $@ +include extra_makefile diff --git a/test/fixtures/make/sample.c b/test/fixtures/make/sample.c index 2be4600f..4212596a 100644 --- a/test/fixtures/make/sample.c +++ b/test/fixtures/make/sample.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include "sample.h" int main(void) { diff --git a/test/fixtures/make/sample.d b/test/fixtures/make/sample.d new file mode 100644 index 00000000..27979ffb --- /dev/null +++ b/test/fixtures/make/sample.d @@ -0,0 +1,3 @@ +sample.o: sample.c sample.h + +sample.h: diff --git a/test/fixtures/make/sample.h b/test/fixtures/make/sample.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/make/sample.h diff --git a/test/fixtures/perl/Devel/BashCompletion.pm b/test/fixtures/perl/Devel/BashCompletion.pm new file mode 100644 index 00000000..0afc6045 --- /dev/null +++ b/test/fixtures/perl/Devel/BashCompletion.pm @@ -0,0 +1 @@ +1; diff --git a/test/fixtures/perldoc/BashCompletionDoc.pod b/test/fixtures/perldoc/BashCompletionDoc.pod new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/perldoc/BashCompletionDoc.pod diff --git a/test/fixtures/perldoc/BashCompletionModule.pm b/test/fixtures/perldoc/BashCompletionModule.pm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/perldoc/BashCompletionModule.pm diff --git a/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri b/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri Binary files differnew file mode 100644 index 00000000..7263da8c --- /dev/null +++ b/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri diff --git a/test/fixtures/ri/cache.ri b/test/fixtures/ri/cache.ri Binary files differnew file mode 100644 index 00000000..4a8fc662 --- /dev/null +++ b/test/fixtures/ri/cache.ri diff --git a/test/fixtures/ri/created.rid b/test/fixtures/ri/created.rid new file mode 100644 index 00000000..ced9a4e0 --- /dev/null +++ b/test/fixtures/ri/created.rid @@ -0,0 +1 @@ +Sat, 29 Apr 2017 07:21:09 +0000 diff --git a/test/fixtures/scp/config b/test/fixtures/scp/config index fea6620e..9f94b9ef 100644 --- a/test/fixtures/scp/config +++ b/test/fixtures/scp/config @@ -4,3 +4,5 @@ UserKnownHostsFile known_hosts Host gee # Indented, multiple hosts HostName hus ike + +Host hut diff --git a/test/fixtures/sftp/config b/test/fixtures/sftp/config index fea6620e..9f94b9ef 100644 --- a/test/fixtures/sftp/config +++ b/test/fixtures/sftp/config @@ -4,3 +4,5 @@ UserKnownHostsFile known_hosts Host gee # Indented, multiple hosts HostName hus ike + +Host hut diff --git a/test/fixtures/shared/empty_dir/.nothing_here b/test/fixtures/shared/empty_dir/.nothing_here new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/shared/empty_dir/.nothing_here diff --git a/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub b/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub new file mode 100644 index 00000000..4c656eba --- /dev/null +++ b/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa meh comment diff --git a/test/fixtures/tar/archive.tar.xz b/test/fixtures/tar/archive.tar.xz Binary files differnew file mode 100644 index 00000000..c8d27256 --- /dev/null +++ b/test/fixtures/tar/archive.tar.xz diff --git a/test/fixtures/tar/dir/fileA b/test/fixtures/tar/dir/fileA new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/tar/dir/fileA diff --git a/test/fixtures/tar/dir/fileB b/test/fixtures/tar/dir/fileB new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/tar/dir/fileB diff --git a/test/fixtures/tar/dir/fileC b/test/fixtures/tar/dir/fileC new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/tar/dir/fileC diff --git a/test/fixtures/tar/dir/hello b/test/fixtures/tar/dir/hello new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/tar/dir/hello diff --git a/test/fixtures/tar/dir2/.nothing_here b/test/fixtures/tar/dir2/.nothing_here new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/tar/dir2/.nothing_here diff --git a/test/fixtures/tar/escape.tar b/test/fixtures/tar/escape.tar Binary files differnew file mode 100644 index 00000000..7af7e9f2 --- /dev/null +++ b/test/fixtures/tar/escape.tar diff --git a/test/generate b/test/generate new file mode 100755 index 00000000..deeba05a --- /dev/null +++ b/test/generate @@ -0,0 +1,64 @@ +#!/bin/bash -eu +# Generate skeleton files for completion of specified command. +# Test skeleton files are generated as well. +# @param $1 string Command, e.g. 'make' +# @param $2 string Completion function, e.g. _command +# @param $3 string Completion arguments, e.g. '-o filenames' + + +# Generate test code +# @param $1 string Command, e.g. 'make' +generate_test_completion() { + local path="completion/$1.exp" + # Does file already exist? + #if [ ! -f "$path" ]; then + # No, file doesn't exist; generate file + cat <<EXPECT > "$path" +assert_source_completions $1 +EXPECT + #fi +} # generate_test_completion() + + +# Generate test code +# @param $1 string Command, e.g. 'make' +# @param $2 string Completion function, e.g. _command +# @param $3 string Completion arguments, e.g. ' -o filenames' +generate_test_lib_completions() { + local path="lib/completions/$1.exp" + # Does file already exist? + #if [ ! -f "$path" ]; then + # No, file doesn't exist; generate file + cat <<EXPECT > "$path" +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "$1 " +sync_after_int + + +teardown +EXPECT + #fi +} # generate_test_lib_completions() + + + # If argument count is wrong, show help +if [ $# -ne 1 ]; then + echo "Usage: $0 command" + echo "Example: $0 make" + exit 1 +fi + +generate_test_completion "$1" +generate_test_lib_completions "$1" diff --git a/test/lib/completions/indent.exp b/test/lib/completions/2to3.exp index 5c5bb1c7..101fbf87 100644 --- a/test/lib/completions/indent.exp +++ b/test/lib/completions/2to3.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "indent --" - - +assert_complete_any "2to3 " sync_after_int diff --git a/test/lib/completions/7z.exp b/test/lib/completions/7z.exp new file mode 100644 index 00000000..4e7e8689 --- /dev/null +++ b/test/lib/completions/7z.exp @@ -0,0 +1,37 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +} + + +setup + + +assert_complete_any "7z " +sync_after_int + + +assert_complete "-tzip" "7z a ar -tzi" +sync_after_int + + +set dir $::srcdir/fixtures/_filedir +assert_complete_dir "-wa\\ b/" "7z x -wa\\ " $dir "" -nospace +sync_after_int + + +set dir $::srcdir/fixtures/7z +assert_complete_dir "a.7z" "7z x " $dir +sync_after_int + + +set dir $::srcdir/fixtures/7z +assert_complete_dir "abc" "7z d a.7z " $dir +sync_after_int + + +teardown diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp index 43f62729..463a28c0 100644 --- a/test/lib/completions/abook.exp +++ b/test/lib/completions/abook.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "abook " +assert_complete_any "abook -" sync_after_int diff --git a/test/lib/completions/adb.exp b/test/lib/completions/adb.exp new file mode 100644 index 00000000..0d41fd2d --- /dev/null +++ b/test/lib/completions/adb.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "adb " +sync_after_int + + +teardown diff --git a/test/lib/completions/alpine.exp b/test/lib/completions/alpine.exp new file mode 100644 index 00000000..5ae1901c --- /dev/null +++ b/test/lib/completions/alpine.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "alpine -" +sync_after_int + + +teardown diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp index acff23ec..bcf87711 100644 --- a/test/lib/completions/ant.exp +++ b/test/lib/completions/ant.exp @@ -6,6 +6,7 @@ proc setup {} { proc teardown {} { assert_env_unmodified { /OLDPWD=/d + /ANT_ARGS=/d } } @@ -21,4 +22,18 @@ assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/an sync_after_int +assert_complete_dir "named-build" "ant -f named-build.xml " $::srcdir/fixtures/ant +sync_after_int + + +assert_complete_dir "build-with-import imported-build" "ant -f build-with-import.xml " $::srcdir/fixtures/ant +sync_after_int + + +assert_bash_exec {OLD_ANT_ARGS=$ANT_ARGS; ANT_ARGS="-f named-build.xml"} +assert_complete_dir "named-build" "ant " $::srcdir/fixtures/ant "ant with buildfile from ANT_ARGS" +sync_after_int +assert_bash_exec {ANT_ARGS=$OLD_ANT_ARGS; unset -v OLD_ANT_ARGS} + + teardown diff --git a/test/lib/completions/appdata-validate.exp b/test/lib/completions/appdata-validate.exp new file mode 100644 index 00000000..583c2952 --- /dev/null +++ b/test/lib/completions/appdata-validate.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "appdata-validate " +sync_after_int + + +teardown diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp index 66887bd0..270d6fe8 100644 --- a/test/lib/completions/apt-get.exp +++ b/test/lib/completions/apt-get.exp @@ -11,11 +11,14 @@ proc teardown {} { setup -set commands {autoclean autoremove build-dep check clean dist-upgrade - dselect-upgrade install purge remove source update upgrade} -assert_complete $commands "apt-get " - - +set test "Tab should complete commands" +set cmd "apt-get " +send "$cmd\t" +set expected "^$cmd\r\n.* install .* update .*\r\n/@$cmd$" +expect { + -re $expected { pass "$test" } + default { fail "$test" } +} sync_after_int diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp index 0550c76b..5bad0e60 100644 --- a/test/lib/completions/arch.exp +++ b/test/lib/completions/arch.exp @@ -11,10 +11,7 @@ proc teardown {} { setup -set options {--wipe -s --start= -e --end= -q --quiet -h --help} -assert_complete $options "arch -" - - +assert_complete_any "arch -" sync_after_int diff --git a/test/lib/completions/bind.exp b/test/lib/completions/bind.exp new file mode 100644 index 00000000..09bbaaa1 --- /dev/null +++ b/test/lib/completions/bind.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "bind -" +sync_after_int + +assert_complete_any "bind k" +sync_after_int + + +teardown diff --git a/test/lib/completions/bts.exp b/test/lib/completions/bts.exp new file mode 100644 index 00000000..38b92b9d --- /dev/null +++ b/test/lib/completions/bts.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "bts -" +sync_after_int + +assert_complete "bts " +sync_after_int + + +teardown diff --git a/test/lib/completions/ccache.exp b/test/lib/completions/ccache.exp index 156c881a..7cb3103e 100644 --- a/test/lib/completions/ccache.exp +++ b/test/lib/completions/ccache.exp @@ -15,4 +15,29 @@ assert_complete_any "ccache -" sync_after_int +set test "Tab should offer correct options from partial option" +assert_complete_partial [list "--cleanup" "--clear"] "ccache" "--clea" $test +sync_after_int + + +set test "Tab should complete a command after ccache" +assert_complete [list "stty"] "ccache stt" $test +sync_after_int + + +set test "Tab should complete a command after ccache --FLAG" +assert_complete [list "stty"] "ccache --zero-stats stt" $test +sync_after_int + + +set test "Tab should complete a command's flags after ccache" +assert_complete [list "--help"] "ccache ls --hel" $test +sync_after_int + + +set test "Tab should complete a command's flags after ccache --FLAG" +assert_complete [list "--help"] "ccache --zero-stats ls --hel" $test +sync_after_int + + teardown diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp index 55bae158..6f36c881 100644 --- a/test/lib/completions/cd.exp +++ b/test/lib/completions/cd.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } @@ -42,7 +42,15 @@ assert_bash_exec "CDPATH=\$PWD"; assert_complete "$::srcdir/fixtures/shared/default/foo.d/" \ "cd $::srcdir/fixtures/shared/default/fo" $test -nospace -expect-cmd-minus fo sync_after_int - # Reset CDPATH + +assert_bash_exec "unset CDPATH" +# Assuming no subdirs here +assert_bash_exec "cd $::srcdir/fixtures/shared/default/foo.d" +assert_no_complete "cd " "cd shouldn't complete when there are no subdirs or CDPATH" +sync_after_int + + # Reset PWD and CDPATH +assert_bash_exec "cd \"\$OLDPWD\"" assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH" diff --git a/test/lib/completions/checksec.exp b/test/lib/completions/checksec.exp new file mode 100644 index 00000000..03abd575 --- /dev/null +++ b/test/lib/completions/checksec.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "checksec -" +sync_after_int + + +teardown diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp index dae3b3bd..1714144d 100644 --- a/test/lib/completions/chkconfig.exp +++ b/test/lib/completions/chkconfig.exp @@ -11,9 +11,16 @@ proc teardown {} { setup -assert_complete_any "chkconfig " +assert_complete_any "chkconfig -" +sync_after_int +# systemd may not be running e.g. in a docker container, and listing services +# will then fail. +if {[assert_exec {systemctl list-units} "" "" "unsupported" ]} { + # TODO test this also if systemctl command is not available at all + assert_complete_any "chkconfig " +} sync_after_int diff --git a/test/lib/completions/chroot.exp b/test/lib/completions/chroot.exp new file mode 100644 index 00000000..ba9f63a1 --- /dev/null +++ b/test/lib/completions/chroot.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "chroot " +sync_after_int + + +teardown diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp index b4399cb1..1be8e167 100644 --- a/test/lib/completions/configure.exp +++ b/test/lib/completions/configure.exp @@ -1,19 +1,23 @@ proc setup {} { + # Make sure our own ./configure is in PATH + assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/..:$PATH"} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} } setup -assert_complete_any "configure --prefix " - +assert_complete_any "configure --" +sync_after_int +assert_complete_any "configure --prefix " sync_after_int diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp index aafff1b6..234817f9 100644 --- a/test/lib/completions/createdb.exp +++ b/test/lib/completions/createdb.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "createdb " - - +assert_complete_any "createdb -" sync_after_int diff --git a/test/lib/completions/createuser.exp b/test/lib/completions/createuser.exp new file mode 100644 index 00000000..87d4ac87 --- /dev/null +++ b/test/lib/completions/createuser.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "createuser -" +sync_after_int + + +teardown diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp index 53512bc4..e05c023e 100644 --- a/test/lib/completions/curl.exp +++ b/test/lib/completions/curl.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "curl -" +assert_complete_any "curl --h" sync_after_int diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp index 1e27346b..dcff2802 100644 --- a/test/lib/completions/dcop.exp +++ b/test/lib/completions/dcop.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -if {[assert_exec {dcop} words]} { +if {[assert_exec {dcop} words "" "untested"]} { assert_complete $words "dcop " } diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp index e02e037c..4946e54d 100644 --- a/test/lib/completions/dd.exp +++ b/test/lib/completions/dd.exp @@ -18,7 +18,7 @@ sync_after_int set test "option should be suffixed with =" -set cmd "dd if" +set cmd "dd bs" send "$cmd\t" expect -ex "$cmd" expect { diff --git a/test/lib/completions/declare.exp b/test/lib/completions/declare.exp new file mode 100644 index 00000000..8830b676 --- /dev/null +++ b/test/lib/completions/declare.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "declare -" +sync_after_int + +assert_complete_any "declare +" +sync_after_int + +assert_complete {BASH_ARGC BASH_ARGV} "declare -p BASH_ARG" +sync_after_int + +assert_complete_any "declare -f _parse_" +sync_after_int + +teardown diff --git a/test/lib/completions/deja-dup.exp b/test/lib/completions/deja-dup.exp new file mode 100644 index 00000000..d46549cf --- /dev/null +++ b/test/lib/completions/deja-dup.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "deja-dup -" +sync_after_int + +assert_no_complete "deja-dup --help " +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp index f358e172..0ea6ded3 100644 --- a/test/lib/completions/dpkg.exp +++ b/test/lib/completions/dpkg.exp @@ -12,17 +12,23 @@ setup assert_complete_any "dpkg --c" - - sync_after_int - # Build list of installed packages -if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} { +# Build list of installed packages +if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages "" "untested"]} { assert_complete $packages "dpkg -L " } +sync_after_int +set test "dpkg -i ~part should complete to ~full/ if home dir exists" +# https://bugs.debian.org/864691 +# Create list of users, having existing home dir +assert_bash_exec {for u in $(compgen -u); do \ + eval test -d ~$u && echo $u; unset u; done} {} /@ users +find_unique_completion_pair $users part full +assert_complete "~$full/" "dpkg -i ~$part" $test -nospace sync_after_int diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp index 8f2d5bfb..d68cd48a 100644 --- a/test/lib/completions/dropdb.exp +++ b/test/lib/completions/dropdb.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "dropdb " - - +assert_complete_any "dropdb -" sync_after_int diff --git a/test/lib/completions/dropuser.exp b/test/lib/completions/dropuser.exp new file mode 100644 index 00000000..8b36fa5e --- /dev/null +++ b/test/lib/completions/dropuser.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "dropuser " +sync_after_int + + +teardown diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp index 129e1f4d..28e90d99 100644 --- a/test/lib/completions/feh.exp +++ b/test/lib/completions/feh.exp @@ -17,8 +17,10 @@ assert_complete_any "feh " sync_after_int -set test "--lis<TAB> should complete \"--list\"" -assert_complete "--list" "feh --lis" $test +if {[assert_exec {feh --help | grep "man feh" || exit 1} "" "" "unsupported"]} { + set test "--lis<TAB> should complete \"--list\"" + assert_complete "--list" "feh --lis" $test +} sync_after_int diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index f11d11fe..5a3d3e9e 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -14,7 +14,7 @@ setup set test "Tab should complete usernames" # Build string list of usernames set users {} -foreach u [exec bash -c "compgen -A user"] { +foreach u [exec bash -c "compgen -A user -S @"] { lappend users $u } assert_complete $users "finger " $test @@ -24,7 +24,7 @@ sync_after_int set test "Tab should complete partial username" -assert_complete_partial [exec bash -c "compgen -A user"] "finger" "" $test -nospace +assert_complete_partial [exec bash -c "compgen -A user -S @"] "finger" "" $test -nospace sync_after_int diff --git a/test/lib/completions/flake8.exp b/test/lib/completions/flake8.exp new file mode 100644 index 00000000..469f96ed --- /dev/null +++ b/test/lib/completions/flake8.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "flake8 " +sync_after_int + + +teardown diff --git a/test/lib/completions/freebsd-update.exp b/test/lib/completions/freebsd-update.exp new file mode 100644 index 00000000..3657ebfd --- /dev/null +++ b/test/lib/completions/freebsd-update.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "freebsd-update " +sync_after_int + + +teardown diff --git a/test/lib/completions/function.exp b/test/lib/completions/function.exp new file mode 100644 index 00000000..823811f1 --- /dev/null +++ b/test/lib/completions/function.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "function _parse_" +sync_after_int + + +teardown diff --git a/test/lib/completions/gm.exp b/test/lib/completions/gm.exp new file mode 100644 index 00000000..43f0bce2 --- /dev/null +++ b/test/lib/completions/gm.exp @@ -0,0 +1,27 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "gm " +sync_after_int + +assert_complete_any "gm help " +sync_after_int + +assert_complete_any "gm time " +sync_after_int + +assert_no_complete "gm version " +sync_after_int + + +teardown diff --git a/test/lib/completions/gnokii.exp b/test/lib/completions/gnokii.exp new file mode 100644 index 00000000..11bfeb6c --- /dev/null +++ b/test/lib/completions/gnokii.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "gnokii " +sync_after_int + + +teardown diff --git a/test/lib/completions/hostname.exp b/test/lib/completions/hostname.exp new file mode 100644 index 00000000..9d9e4963 --- /dev/null +++ b/test/lib/completions/hostname.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hostname -" +sync_after_int + + +teardown diff --git a/test/lib/completions/hping3.exp b/test/lib/completions/hping3.exp new file mode 100644 index 00000000..991ee3ad --- /dev/null +++ b/test/lib/completions/hping3.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hping3 " +sync_after_int + + +teardown diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp index 7849f3f7..7341ceb8 100644 --- a/test/lib/completions/ifdown.exp +++ b/test/lib/completions/ifdown.exp @@ -11,9 +11,14 @@ proc teardown {} { setup -assert_complete_any "ifdown " - +if {[info exists ::env(CI)]} { + unsupported "ifdown should show completions" +} else { + assert_complete_any "ifdown " + sync_after_int +} +assert_no_complete "ifdown bash-completion " sync_after_int diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp index 2c1c010e..31b5ade4 100644 --- a/test/lib/completions/ifup.exp +++ b/test/lib/completions/ifup.exp @@ -11,9 +11,14 @@ proc teardown {} { setup -assert_complete_any "ifup " - +if {[info exists ::env(CI)]} { + unsupported "ifup should show completions" +} else { + assert_complete_any "ifup " + sync_after_int +} +assert_no_complete "ifup bash-completion " sync_after_int diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp index 8f45f6a3..f57712cb 100644 --- a/test/lib/completions/ip.exp +++ b/test/lib/completions/ip.exp @@ -12,8 +12,9 @@ setup assert_complete_any "ip " +sync_after_int - +assert_complete_any "ip a " sync_after_int diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp index 948fe8c8..83b11d7f 100644 --- a/test/lib/completions/javac.exp +++ b/test/lib/completions/javac.exp @@ -12,8 +12,9 @@ setup assert_complete_any "javac " +sync_after_int - +assert_complete "a/ bashcomp.jar" "javac -cp $::srcdir/fixtures/java/" sync_after_int diff --git a/test/lib/completions/jpegoptim.exp b/test/lib/completions/jpegoptim.exp new file mode 100644 index 00000000..4b735e80 --- /dev/null +++ b/test/lib/completions/jpegoptim.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "jpegoptim " +sync_after_int + + +teardown diff --git a/test/lib/completions/jshint.exp b/test/lib/completions/jshint.exp new file mode 100644 index 00000000..553883e1 --- /dev/null +++ b/test/lib/completions/jshint.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "jshint " +sync_after_int + + +teardown diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp index bc07bc48..9aeb8412 100644 --- a/test/lib/completions/kill.exp +++ b/test/lib/completions/kill.exp @@ -11,8 +11,10 @@ proc teardown {} { setup -assert_complete_any "kill 1" -sync_after_int +if {[assert_bash_type ps]} { + assert_complete_any "kill 1" + sync_after_int +} assert_complete [get_signals] "kill -s " diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp index 8f93db24..af9a71a8 100644 --- a/test/lib/completions/look.exp +++ b/test/lib/completions/look.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -if {[assert_exec {look foo | grep ^foo} words]} { +if {[assert_exec {look foo | grep ^foo} words {} "unsupported"]} { assert_complete $words "look foo" } diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp index 0d16ec03..e176e13f 100644 --- a/test/lib/completions/ls.exp +++ b/test/lib/completions/ls.exp @@ -14,30 +14,24 @@ setup if {[assert_exec {ls --help} "" "" "unsupported"]} { assert_complete_any "ls --" } - - sync_after_int -set test "~part should complete to ~full/ if existing dir" +set test "~part should complete to ~full/ if home dir exists" # Create list of users, having existing home dir assert_bash_exec {for u in $(compgen -u); do \ eval test -d ~$u && echo $u; unset u; done} {} /@ users find_unique_completion_pair $users part full assert_complete "~$full/" "ls ~$part" $test -nospace - - sync_after_int -set test "~part should complete to ~full<space> if non-existing dir" +set test "~part should complete to ~full<space> if home dir does not exist" # Create list of users, having non-existing home dir assert_bash_exec {for u in $(compgen -u); do \ eval test -d ~$u || echo $u; unset u; done} {} /@ users find_unique_completion_pair $users part full assert_complete "~$full " "ls ~$part" $test -nospace - - sync_after_int diff --git a/test/lib/completions/lz4.exp b/test/lib/completions/lz4.exp new file mode 100644 index 00000000..df392939 --- /dev/null +++ b/test/lib/completions/lz4.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lz4 " +sync_after_int + + +teardown diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp index 977485d2..0c188dba 100644 --- a/test/lib/completions/make.exp +++ b/test/lib/completions/make.exp @@ -18,18 +18,50 @@ assert_complete_dir "Makefile" "make -f Ma" $dir $test sync_after_int - set test "\"make <TAB>\" should complete targets" set dir $::srcdir/fixtures/make -set targets "all sample install clean" +set targets "all sample install clean extra_makefile" +file delete $dir/extra_makefile assert_complete_dir $targets "make " $dir $test sync_after_int +set test "\"make .<TAB>\" should complete hidden targets" +set dir $::srcdir/fixtures/make +set targets ".test_passes .cache/" +assert_complete_dir $targets "make ." $dir $test + + +sync_after_int + + +set test "\"make .cache/<TAB>\" should complete targets" +set dir $::srcdir/fixtures/make +set targets "1 2" +assert_complete_dir $targets "make .cache/" $dir $test + + +sync_after_int + + +# FIXME: for some reason this fails in centos6, even though the behavior +# appears to be correct; skip in CI for now. +set test "\"make .cache/.<TAB>\" should complete hidden targets" +if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} { + xfail $test +} else { + set dir $::srcdir/fixtures/make + set targets ".1 .2" + assert_complete_dir $targets "make .cache/." $dir $test \ + -expect-cmd-minus "." + sync_after_int +} + + set test "\"make <TAB>\" should not show anything in directory without makefile" -set dir $::srcdir/fixtures/make/empty_dir +set dir $::srcdir/fixtures/shared/empty_dir assert_complete_dir "" "make " $dir $test diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp index 66b565a2..1a031ff1 100644 --- a/test/lib/completions/man.exp +++ b/test/lib/completions/man.exp @@ -1,11 +1,19 @@ proc setup {} { - assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man" + assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man:$::srcdirabs/tmp/man" save_env + + if {! [is_cygwin]} { # Colon not allowed in filenames + assert_bash_exec {(cd $TESTDIR/tmp && mkdir -p man/man3 && touch man/man3/Bash::Completion.3pm.gz || true)} + } } proc teardown {} { assert_env_unmodified {/OLDPWD/d} + + if {! [is_cygwin]} { + assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)} + } } @@ -24,10 +32,10 @@ assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man sync_after_int -assert_complete "Bash::Completion" "man Bash::C" - - -sync_after_int +if {! [is_cygwin]} { + assert_complete "Bash::Completion" "man Bash::C" + sync_after_int +} assert_complete_dir "man/quux.8" "man man/" $::srcdir/fixtures/man diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp index 525ccbc3..e194446b 100644 --- a/test/lib/completions/mcrypt.exp +++ b/test/lib/completions/mcrypt.exp @@ -12,8 +12,12 @@ setup assert_complete_any "mcrypt " +sync_after_int +assert_complete_any "mcrypt -a " +sync_after_int +assert_complete_any "mcrypt -m " sync_after_int diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp index 4dde214f..70d2a126 100644 --- a/test/lib/completions/mmsitepass.exp +++ b/test/lib/completions/mmsitepass.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "mmsitepass " +assert_complete_any "mmsitepass -" sync_after_int diff --git a/test/lib/completions/mock.exp b/test/lib/completions/mock.exp new file mode 100644 index 00000000..8190264a --- /dev/null +++ b/test/lib/completions/mock.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "mock " +sync_after_int + + +teardown diff --git a/test/lib/completions/modinfo.exp b/test/lib/completions/modinfo.exp index bd8f965c..90e9702a 100644 --- a/test/lib/completions/modinfo.exp +++ b/test/lib/completions/modinfo.exp @@ -11,8 +11,11 @@ proc teardown {} { setup -set test "in<TAB> should complete modulename" -assert_complete_any "modinfo in" $test +set uname [exec bash -c "uname -r"] +if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} { + set test "in<TAB> should complete modulename" + assert_complete_any "modinfo in" $test +} sync_after_int diff --git a/test/lib/completions/modprobe.exp b/test/lib/completions/modprobe.exp index a1cd6987..b0a530ef 100644 --- a/test/lib/completions/modprobe.exp +++ b/test/lib/completions/modprobe.exp @@ -11,15 +11,18 @@ proc teardown {} { setup -set test "--remov<TAB> should complete \"--remove\"" -assert_complete "--remove" "modprobe --remov" $test +set test "--al<TAB> should complete \"--all\"" +assert_complete "--all" "modprobe --al" $test sync_after_int -set test "in<TAB> should complete modulename" -assert_complete_any "modprobe in" $test +set uname [exec bash -c "uname -r"] +if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} { + set test "in<TAB> should complete modulename" + assert_complete_any "modprobe in" $test +} sync_after_int diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp index 1298f36f..fea99b85 100644 --- a/test/lib/completions/mount.exp +++ b/test/lib/completions/mount.exp @@ -1,35 +1,9 @@ -# mount completion from fstab can't be tested directly because it -# (correctly) uses absolute paths. So we create a custom completion which -# reads from a file in our text fixture instead. -proc setup_dummy_mnt {} { - assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _mnt} - - assert_bash_exec { \ - _mnt() { \ - local cur=$(_get_cword); \ - _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \ - }; \ - complete -F _mnt mnt \ - } -} - - -proc teardown_dummy_mnt {} { - assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _mnt} - assert_bash_exec {complete -r mnt} -} - - proc setup {} { save_env - setup_dummy_mnt } proc teardown {} { - teardown_dummy_mnt assert_env_unmodified {/OLDPWD/d} } @@ -69,59 +43,4 @@ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} sync_after_int -set test "Testing internal __linux_fstab_unescape function for mount" -# One round of slashes is for bash. -assert_bash_exec {var=one\'two\\040three\\} -assert_bash_exec {__linux_fstab_unescape var} -set cmd {echo $var} -send "$cmd\r" -expect { - -ex "$cmd\r\none'two three\\" { pass $test } -# default { fail $test } -} -sync_after_int -assert_bash_exec {unset var} - - -sync_after_int - - -# Begin testing through mnt (see setup_dummy_mnt). -assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p} -sync_after_int - -assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p} -sync_after_int - -assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p} -sync_after_int - -assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p} -sync_after_int - -assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \ - {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ } -sync_after_int - -assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} -sync_after_int - -assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'} -sync_after_int - -assert_complete {/mnt/other\'test\ path} {mnt /mnt/other} -sync_after_int - -assert_complete {Ubuntu\ Karmic} {mnt -L Ubu} -sync_after_int - -assert_complete {Debian-it\'s\ awesome} {mnt -L Deb} -sync_after_int - -# This does not work. Proper support for this requires smarter parsing of -# $COMP_LINE and it's not worth doing just for mount. -#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n} -#sync_after_int - - teardown diff --git a/test/lib/completions/mr.exp b/test/lib/completions/mr.exp new file mode 100644 index 00000000..d7d41bb6 --- /dev/null +++ b/test/lib/completions/mr.exp @@ -0,0 +1,46 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + +setup + +assert_complete_any "mr " +sync_after_int + +# Some versions require man to be around for useful output. +if {[assert_exec {man -h} "" "" "unsupported"]} { + + assert_complete_any "mr --" + sync_after_int + + assert_complete {"foo"} "mr -c $::srcdir/fixtures/shared/default/foo.d/" + sync_after_int + + assert_complete {"bar bar.d/" "foo.d/"} "mr -d $::srcdir/fixtures/shared/default/" + sync_after_int + + assert_complete {"bar" "bar bar.d/" "foo" "foo.d/"} "mr bootstrap $::srcdir/fixtures/shared/default/" + sync_after_int + + # Disabled for now; "clean" doesn't exist before mr 1.20141023 + #assert_complete "-f" "mr clean -" + #sync_after_int + + assert_complete "-m" "mr commit -" + sync_after_int + + assert_no_complete "mr status " + sync_after_int + + # Disabled temporarily: suggesting all commands produces too much output for + # test suite. + #assert_complete_any "mr run " + #sync_after_int +} + +teardown diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp index 62a64fc2..b7a50b81 100644 --- a/test/lib/completions/mysql.exp +++ b/test/lib/completions/mysql.exp @@ -12,8 +12,10 @@ setup assert_complete_any "mysql --" +sync_after_int +assert_complete_any "mysql --default-character-set=" sync_after_int diff --git a/test/lib/completions/newgrp.exp b/test/lib/completions/newgrp.exp new file mode 100644 index 00000000..a5cddb8c --- /dev/null +++ b/test/lib/completions/newgrp.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "newgrp " +sync_after_int + + +teardown diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp index 0696ec5e..dfabdc50 100644 --- a/test/lib/completions/newlist.exp +++ b/test/lib/completions/newlist.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "newlist " +assert_complete_any "newlist -" sync_after_int diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp index d1357002..3adbbae7 100644 --- a/test/lib/completions/openssl.exp +++ b/test/lib/completions/openssl.exp @@ -28,5 +28,8 @@ sync_after_int assert_complete_any "openssl pkey -cipher " sync_after_int +assert_complete_any "openssl dgst -s" +sync_after_int + teardown diff --git a/test/lib/completions/optipng.exp b/test/lib/completions/optipng.exp new file mode 100644 index 00000000..0a079190 --- /dev/null +++ b/test/lib/completions/optipng.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "optipng " +sync_after_int + + +teardown diff --git a/test/lib/completions/pdftotext.exp b/test/lib/completions/pdftotext.exp new file mode 100644 index 00000000..4c5cfca5 --- /dev/null +++ b/test/lib/completions/pdftotext.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pdftotext " +sync_after_int + + +teardown diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp index f3a51841..3a92a6b9 100644 --- a/test/lib/completions/perl.exp +++ b/test/lib/completions/perl.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/PERL5LIB=/d} } @@ -117,4 +117,15 @@ sync_after_int assert_complete_any "perl -m-File::" sync_after_int +# Make sure at least our mock Devel::* module is around +assert_bash_exec {OLDPERL5LIB=$PERL5LIB; export PERL5LIB=$TESTDIR/fixtures/perl} + +assert_complete_any "perl -d:" +sync_after_int + +assert_complete_any "perl -dt:" +sync_after_int + +assert_bash_exec {export PERL5LIB=$OLDPERL5LIB; unset -v OLDPERL5LIB} + teardown diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp index a745b55d..3197bf5c 100644 --- a/test/lib/completions/perldoc.exp +++ b/test/lib/completions/perldoc.exp @@ -1,4 +1,5 @@ proc setup {} { + assert_bash_exec {export PERL5LIB=$SRCDIR/fixtures/perldoc} save_env } @@ -31,4 +32,8 @@ assert_complete_any "perldoc -" sync_after_int +assert_complete "BashCompletionModule BashCompletionDoc" "perldoc BashCompletion" +sync_after_int + + teardown diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp index 622bf064..9919a4cb 100644 --- a/test/lib/completions/pine.exp +++ b/test/lib/completions/pine.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "pine " - - +assert_complete_any "pine -" sync_after_int diff --git a/test/lib/completions/pngfix.exp b/test/lib/completions/pngfix.exp new file mode 100644 index 00000000..d492610d --- /dev/null +++ b/test/lib/completions/pngfix.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pngfix " +sync_after_int + +assert_complete_any "pngfix -" +sync_after_int + + +teardown diff --git a/test/lib/completions/portsnap.exp b/test/lib/completions/portsnap.exp new file mode 100644 index 00000000..d6028cae --- /dev/null +++ b/test/lib/completions/portsnap.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "portsnap " +sync_after_int + + +teardown diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp index 7b7da3e7..8b82a160 100644 --- a/test/lib/completions/puppet.exp +++ b/test/lib/completions/puppet.exp @@ -12,8 +12,9 @@ setup assert_complete_any "puppet " +sync_after_int - +assert_complete_any "puppet agent --" sync_after_int diff --git a/test/lib/completions/pushd.exp b/test/lib/completions/pushd.exp new file mode 100644 index 00000000..54e3ad8b --- /dev/null +++ b/test/lib/completions/pushd.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pushd " +sync_after_int + + +teardown diff --git a/test/lib/completions/py.test.exp b/test/lib/completions/py.test.exp new file mode 100644 index 00000000..736b9828 --- /dev/null +++ b/test/lib/completions/py.test.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "py.test " +sync_after_int + +assert_complete_any "py.test -" +sync_after_int + + +teardown diff --git a/test/lib/completions/pyflakes.exp b/test/lib/completions/pyflakes.exp new file mode 100644 index 00000000..22a8cf7c --- /dev/null +++ b/test/lib/completions/pyflakes.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pyflakes " +sync_after_int + + +teardown diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp index 446e3d09..29a10bf6 100644 --- a/test/lib/completions/python.exp +++ b/test/lib/completions/python.exp @@ -17,5 +17,29 @@ sync_after_int assert_complete_any "python -" sync_after_int +assert_no_complete "python -c " +sync_after_int + +assert_complete {"bar bar.d/" foo.d/} "python $::srcdir/fixtures/shared/default/" +sync_after_int + +assert_complete {bar "bar bar.d/" foo foo.d/} "python -c foo $::srcdir/fixtures/shared/default/" +sync_after_int + +assert_no_complete "python -c foo -" +sync_after_int + +assert_no_complete "python -m foo -" +sync_after_int + +assert_complete_any "python -m sy" +sync_after_int + +assert_complete_any "python -W " +sync_after_int + +assert_complete_any "python -Wa" +sync_after_int + teardown diff --git a/test/lib/completions/pyvenv.exp b/test/lib/completions/pyvenv.exp new file mode 100644 index 00000000..9eca0e4c --- /dev/null +++ b/test/lib/completions/pyvenv.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pyvenv " +sync_after_int + + +teardown diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp index 4200da32..353d204a 100644 --- a/test/lib/completions/quotacheck.exp +++ b/test/lib/completions/quotacheck.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "quotacheck " +assert_complete_any "quotacheck -" sync_after_int diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp index 4acc70e1..b8279e59 100644 --- a/test/lib/completions/quotaon.exp +++ b/test/lib/completions/quotaon.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "quotaon " +assert_complete_any "quotaon -" sync_after_int diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp index fdc859b4..5e25ddea 100644 --- a/test/lib/completions/renice.exp +++ b/test/lib/completions/renice.exp @@ -11,32 +11,15 @@ proc teardown {} { setup -set test "Tab should show complete process ids" - # Try completion -set cmd "renice 1" -send "$cmd\t" -expect { - -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - +if {[assert_bash_type ps]} { -sync_after_int + assert_complete_any "renice 1" + sync_after_int + assert_complete_any "renice -g " + sync_after_int -set test "Tab should show complete process group ids" - # Try completion -set cmd "renice -g " -send "$cmd\t" -expect { - -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } } -sync_after_int - - teardown diff --git a/test/lib/completions/repomanage.exp b/test/lib/completions/repomanage.exp new file mode 100644 index 00000000..de5169bc --- /dev/null +++ b/test/lib/completions/repomanage.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "repomanage " +sync_after_int + + +teardown diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp index e6661d1b..1210685b 100644 --- a/test/lib/completions/ri.exp +++ b/test/lib/completions/ri.exp @@ -1,19 +1,25 @@ proc setup {} { + assert_bash_exec {OLDRI="$RI"; export RI="-d $SRCDIR/fixtures/ri"} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {RI="$OLDRI"; unset -v OLDRI} } setup -assert_complete_any "ri RI" +assert_complete_any "ri -" +sync_after_int +assert_complete "BashCompletion/ cache.ri" "ri --dump=$::srcdir/fixtures/ri/" +sync_after_int +assert_complete "BashCompletion" "ri BashCompletio" sync_after_int diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp index 42b7af8e..accc6569 100644 --- a/test/lib/completions/rsync.exp +++ b/test/lib/completions/rsync.exp @@ -4,7 +4,9 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified { + /_scp_path_esc=/d + } } diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp index 21c05eab..81ca3206 100644 --- a/test/lib/completions/rtcwake.exp +++ b/test/lib/completions/rtcwake.exp @@ -12,8 +12,6 @@ setup assert_complete_any "rtcwake " - - sync_after_int diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index 7cc6eb07..6b06cb25 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -55,13 +55,13 @@ set test "Tab should complete known-hosts" # Build string list of expected completions # Get hostnames and give them a colon (:) suffix - # Hosts `gee' and `hus' are defined in ./fixtures/scp/config + # Hosts `gee' and `hut' are defined in ./fixtures/scp/config # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts set expected {} foreach host [get_hosts] { lappend expected "$host:" } -lappend expected blah: doo: gee: hus: ike: +lappend expected blah: doo: gee: hut: ike: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" assert_complete $expected "scp -F config " $test diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp index 5e585179..f37d5f5f 100644 --- a/test/lib/completions/screen.exp +++ b/test/lib/completions/screen.exp @@ -24,6 +24,10 @@ assert_complete_any "screen cat" sync_after_int +assert_complete_any "screen -T " +sync_after_int + + assert_complete_any "screen -T foo cat" sync_after_int diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 27fe7511..3c18ddb7 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -21,9 +21,9 @@ setup # Build string list of expected completions set expected [get_hosts] - # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config + # Hosts `gee' and `hut' are defined in ./fixtures/sftp/config # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected 10.10.10.10 doo gee hus ike +lappend expected 10.10.10.10 doo gee hut ike assert_complete $expected "sftp -F config " @@ -48,9 +48,9 @@ sync_after_int # Build string list of expected completions # Get hostnames and give them a colon (:) suffix set expected [get_hosts] - # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf" + # Hosts `gee' and `jar' are defined in "./fixtures/sftp/spaced conf" # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected 10.10.10.10 doo gee hus ike jar +lappend expected 10.10.10.10 doo gee ike jar assert_complete $expected "sftp -F spaced\\ \\ conf " diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp index e8b643fd..5abe303d 100644 --- a/test/lib/completions/ssh-copy-id.exp +++ b/test/lib/completions/ssh-copy-id.exp @@ -1,10 +1,16 @@ proc setup {} { save_env + # Some old versions of ssh-copy-id won't output even usage if no + # identities are found. Try to make sure there is at least one (for CI). + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/ssh-copy-id} } proc teardown {} { - assert_env_unmodified + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } } diff --git a/test/lib/completions/ssh-keygen.exp b/test/lib/completions/ssh-keygen.exp new file mode 100644 index 00000000..fea2529e --- /dev/null +++ b/test/lib/completions/ssh-keygen.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ssh-keygen -" +sync_after_int + + +teardown diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp index 3ef0bb69..c082558e 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -60,7 +60,23 @@ sync_after_int set test "First argument should complete partial hostname" -assert_complete_partial [get_known_hosts] ssh "l" $test -ltrim-colon-completions +# Build string list of hostnames, starting with the character of the first +# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:). +# Hosts starting with a COMP_WORDBREAKS character are left out because these +# are exceptional cases, requiring specific tests. +set hosts {} +set char "" +foreach h [get_known_hosts] { + set first [string range $h 0 0] + if {$char == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first} + if {$char != ""} { + # Only append unique hostnames starting with $char + if {$first == $char && [lsearch -exact $hosts "$h"] == -1} { + lappend hosts "$h" + } + } +} +assert_complete $hosts "ssh $char" $test -ltrim-colon-completions -expect-cmd-minus "$char" sync_after_int diff --git a/test/lib/completions/synclient.exp b/test/lib/completions/synclient.exp new file mode 100644 index 00000000..1e9c7b5b --- /dev/null +++ b/test/lib/completions/synclient.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "synclient -" +sync_after_int + + +# synclient -l may error out with e.g. +# Couldn't find synaptics properties. No synaptics driver loaded? +if {[assert_exec {synclient -l} "" "" "unsupported"]} { + assert_complete_any "synclient " +} +sync_after_int + + +teardown diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp index 37f1ae4b..75434e94 100644 --- a/test/lib/completions/tar.exp +++ b/test/lib/completions/tar.exp @@ -2,19 +2,131 @@ proc setup {} { save_env } - proc teardown {} { - assert_env_unmodified + assert_env_unmodified { + /OLDPWD=/d + /declare -f _tar/d + } } - setup +# Detect whether system's tar is GNU tar +set cmd "tar --version" +send "$cmd\r" +expect "^$cmd\r\n" +expect { + -re "GNU\[^\n\]*\n" { + set tar_version gnu + } + -re ".*\n" { + set tar_version unknown + } +} +sync_after_int + +set test "old option: list escaped chars" +assert_complete_dir "a/b\\'c/" "tar tf escape.tar a/b\\\'" $::srcdir/fixtures/tar $test +sync_after_int + +# TODO: "tar tf escape.tar a/b" + +set test "check that any completion done" assert_complete_any "tar " +sync_after_int + +# Use bsdtar as the it completes to only 'zc zt zx' ('tar' can be GNU tar and it +# can would have more options) +set test "old option: mode is not on first place" +assert_complete {zc zt zx} "bsdtar z" $test +sync_after_int + +set test "old option: test 'f' when mode is not as a first option" +assert_complete_dir "dir/ dir2/" "tar zfc " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: creating archive and 'f' option" +assert_complete_dir "dir/ dir2/" "tar cf " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: archive listing" +assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar tf archive.tar.xz dir/file" $::srcdir/fixtures/tar +sync_after_int +set test "old option: check _second_ option in \"old\" argument" +assert_complete_dir "dir/ dir2/" "bsdtar cbfvv NOT_EXISTS " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: create and members" +assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar cTfvv NOT_EXISTS DONT_CREATE.tar " $::srcdir/fixtures/tar +sync_after_int +set test "old option: extract and archive" +assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar xvf " $::srcdir/fixtures/tar sync_after_int +if { "$tar_version" == "gnu" } { + set test "check short options" + assert_complete_any "tar -c" + sync_after_int + + set test "mode not as a first option" + assert_complete_dir "dir/ dir2/" "tar -zcf " $::srcdir/fixtures/tar + sync_after_int + + # Only directories should be completed. + set test "check that we do not suggest re-writing existing archive" + assert_complete_dir "dir/ dir2/" "tar -cf " $::srcdir/fixtures/tar + sync_after_int + + set test "check --file option" + assert_complete_dir "dir/ dir2/" "tar -c --file " $::srcdir/fixtures/tar + sync_after_int + + set test "check --file option #2" + assert_complete_dir "dir/ dir2/" "tar -cvv --file " $::srcdir/fixtures/tar + sync_after_int + + set test "archive listing" + assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -tf archive.tar.xz dir/file" $::srcdir/fixtures/tar + sync_after_int + + set test "archive listing with --file" + assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -t --file archive.tar.xz dir/file" $::srcdir/fixtures/tar + sync_after_int + + # Some random options should work: + set test "test random tar's long option #1" + assert_complete "--blocking-factor= --block-number" "tar --block" $test + sync_after_int + + set test "test random tar's long option #2" + assert_complete "--add-file=" "tar --add-fil" $test -nospace + sync_after_int + + set test "test random tar's long option #3" + assert_complete "--posix" "tar -cf /dev/null --posi" $test + sync_after_int + + # --owner + set users [exec bash -c "compgen -A user"] + set test "test --owner option" + assert_complete $users "tar --owner=" $test + sync_after_int + + # --group + set groups [exec bash -c "compgen -A group"] + set test "test --group option" + assert_complete $groups "tar --group=" $test + sync_after_int + + # use -b for this as -b is still not handled by tar's completion + set test "short opt -XXXb <TAB> (arg required)" + assert_no_complete "tar -cvvfb " $test + sync_after_int + + # TODO: how to test that 'tar -cf<TAB>' completes to 'tar -cf ' +} teardown diff --git a/test/lib/completions/timeout.exp b/test/lib/completions/timeout.exp new file mode 100644 index 00000000..f56c80f3 --- /dev/null +++ b/test/lib/completions/timeout.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "timeout -" +sync_after_int + +assert_no_complete "timeout " "1st non-option arg=timeout, shouldn't complete" +sync_after_int + + +teardown diff --git a/test/lib/completions/tipc.exp b/test/lib/completions/tipc.exp new file mode 100644 index 00000000..dd88de31 --- /dev/null +++ b/test/lib/completions/tipc.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tipc " +sync_after_int + + +teardown diff --git a/test/lib/completions/udevadm.exp b/test/lib/completions/udevadm.exp new file mode 100644 index 00000000..87a948a8 --- /dev/null +++ b/test/lib/completions/udevadm.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "udevadm " +sync_after_int + + +teardown diff --git a/test/lib/completions/umount.exp b/test/lib/completions/umount.exp index 21a2dfa5..e7703d12 100644 --- a/test/lib/completions/umount.exp +++ b/test/lib/completions/umount.exp @@ -1,10 +1,36 @@ +# umount completion from fstab can't be tested directly because it +# (correctly) uses absolute paths. So we create a custom completion which +# reads from a file in our text fixture instead. +proc setup_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + + assert_bash_exec { \ + _mnt() { \ + local cur=$(_get_cword); \ + _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \ + }; \ + complete -F _mnt mnt \ + } +} + + +proc teardown_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + assert_bash_exec {complete -r mnt} +} + + proc setup {} { save_env + setup_dummy_mnt } proc teardown {} { - assert_env_unmodified + teardown_dummy_mnt + assert_env_unmodified {/OLDPWD/d} } @@ -17,4 +43,59 @@ assert_complete_any "umount " sync_after_int +set test "Testing internal __linux_fstab_unescape function for umount" +# One round of slashes is for bash. +assert_bash_exec {var=one\'two\\040three\\} +assert_bash_exec {__linux_fstab_unescape var} +set cmd {echo $var} +send "$cmd\r" +expect { + -ex "$cmd\r\none'two three\\" { pass $test } +# default { fail $test } +} +sync_after_int +assert_bash_exec {unset var} + + +sync_after_int + + +# Begin testing through mnt (see setup_dummy_mnt). +assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p} +sync_after_int + +assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p} +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p} +sync_after_int + +assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p} +sync_after_int + +assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \ + {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ } +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} +sync_after_int + +assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'} +sync_after_int + +assert_complete {/mnt/other\'test\ path} {mnt /mnt/other} +sync_after_int + +assert_complete {Ubuntu\ Karmic} {mnt -L Ubu} +sync_after_int + +assert_complete {Debian-it\'s\ awesome} {mnt -L Deb} +sync_after_int + +# This does not work. Proper support for this requires smarter parsing of +# $COMP_LINE and it's not worth doing just for umount. +#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n} +#sync_after_int + + teardown diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp index 96cd5860..cac4ce65 100644 --- a/test/lib/completions/unshunt.exp +++ b/test/lib/completions/unshunt.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "unshunt -" +assert_complete_any "unshunt --" sync_after_int diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp index 4cb7dd45..6f3b3e37 100644 --- a/test/lib/completions/vgcreate.exp +++ b/test/lib/completions/vgcreate.exp @@ -12,8 +12,10 @@ setup assert_complete_any "vgcreate -" +sync_after_int +assert_no_complete "vgcreate __does_not_exist__" sync_after_int diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp index b1693c80..0080967c 100644 --- a/test/lib/completions/wtf.exp +++ b/test/lib/completions/wtf.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "wtf " +assert_complete_any "wtf A" sync_after_int diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp new file mode 100644 index 00000000..15738ff0 --- /dev/null +++ b/test/lib/completions/zopfli.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "zopfli " +sync_after_int + + +teardown diff --git a/test/lib/completions/zopflipng.exp b/test/lib/completions/zopflipng.exp new file mode 100644 index 00000000..9c421a14 --- /dev/null +++ b/test/lib/completions/zopflipng.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "zopflipng " +sync_after_int + + +teardown diff --git a/test/lib/library.exp b/test/lib/library.exp index 75bf921c..1e2c7456 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -10,7 +10,7 @@ package require textutil::string # Execute a bash command and make sure the exit status is successful. # If not, output the error message. # @param string $cmd Bash command line to execute. If empty string (""), the -# exit status of the previously executed bash command will be +# exit status of the previously executed bash command will be # checked; specify `title' to adorn the error message. # @param string $title (optional) Command title. If empty, `cmd' is used. # @param string $prompt (optional) Bash prompt. Default is "/@" @@ -51,7 +51,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { # @param string $command Command to locate proc assert_bash_type {command} { set test "$command should be available in bash" - set cmd "type $command &> /dev/null && echo -n 0 || echo -n 1" + set cmd "type $command &> /dev/null && echo -n 0 || echo -n 1" send "$cmd\r" expect "$cmd\r\n" expect { @@ -74,7 +74,7 @@ proc assert_bash_type {command} { # @param list $args Options: # -sort Compare list sorted. Default is unsorted # -prompt Bash prompt. Default is `/@' -# -chunk-size N Compare list N items at a time. Default +# -chunk-size N Compare list N items at a time. Default # is 20. proc assert_bash_list {expected cmd test {args {}}} { array set arg [::cmdline::getoptions args { @@ -114,7 +114,7 @@ proc assert_bash_list {expected cmd test {args {}}} { # @param list $args Options: # -sort Compare list sorted. Default is unsorted # -prompt Bash prompt. Default is `/@' -# -chunk-size N Compare list N items at a time. Default +# -chunk-size N Compare list N items at a time. Default # is 20. proc assert_bash_list_dir {expected cmd dir test {args {}}} { array set arg [::cmdline::getoptions args { @@ -126,7 +126,7 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} { if {$arg(sort)} {set arg_sort "-sort"} else {set arg_sort ""} assert_bash_exec "cd $dir" "" $prompt assert_bash_list $expected $cmd $test $arg_sort \ - -chunk-size $arg(chunk-size) -prompt $prompt + -chunk-size $arg(chunk-size) -prompt $prompt sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} } @@ -253,10 +253,12 @@ proc assert_complete_one {expected cmd {test ""} {args {}}} { if {$test == ""} {set test "$cmd should show completion"} send "$cmd\t" expect -ex "$cmd" + set trimmed false if {$arg(ltrim-colon-completions)} { # If partial contains colon (:), remove partial from begin of items - _ltrim_colon_completions $cmd expected cword - } else { + set trimmed [_ltrim_colon_completions $cmd expected cword] + } + if {! $trimmed} { set cur ""; # Default to empty word to complete on set words [split_words_bash $cmd] if {[llength $words] > 1} { @@ -346,7 +348,7 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { expect { # Match completion, single word. This word is shown on the # same line as the command. - -re "^\\w+ $" { pass "$test" } + -re "^\\S* $" { pass "$test" } # Try matching multiple words again, with new timeout -re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" } } @@ -373,7 +375,7 @@ proc assert_complete_dir {expected cmd dir {test ""} {args {}}} { sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} } - + # Make sure a partial argument is completed. @@ -408,7 +410,7 @@ proc assert_complete_partial {expected cmd {partial ""} {test ""} {args {}}} { # If cword contains colon (:), left-trim completions with cword -# @param string $cmd Command to complete +# @param string $cmd Command to complete # @param list $items Reference to list of completions to trim # @param string $dword Reference to variable to contain word to remove from # expected cmd. @@ -437,7 +439,9 @@ proc _ltrim_colon_completions {cmd items dword} { lset items_out $i [string range $item [string length $cur] end] } } + return true } + return false } @@ -445,13 +449,13 @@ proc _ltrim_colon_completions {cmd items dword} { # to `save_env()'. # @param string $sed Sed commands to preprocess diff output. # Example calls: -# +# # # Replace `COMP_PATH=.*' with `COMP_PATH=PATH' # assert_env_unmodified {s/COMP_PATH=.*/COMP_PATH=PATH/} -# +# # # Remove lines containing `OLDPWD=' # assert_env_unmodified {/OLDPWD=/d} -# +# # @param string $file Filename to generate environment save file from. See # `gen_env_filename()'. # @param string $diff Expected diff output (after being processed by $sed) @@ -488,8 +492,8 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} { expect { -re "^$diff[wd]@$" { pass "$test" } - -re [wd]@ { - fail "$test" + -re [wd]@ { + fail "$test" # Show diff to user @@ -587,7 +591,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} { # "lib/completions/$cmd.exp". proc assert_source_completions {command {file ""}} { if {[assert_bash_type $command] - && [is_bash_completion_installed_for $command]} { + && [assert_install_completion_for $command]} { if {[string length $file] == 0} { set file "$::srcdir/lib/completions/$command.exp" } @@ -598,6 +602,21 @@ proc assert_source_completions {command {file ""}} { } +# Assert that a _filedir_xspec completion is installed for specified command +# @param string $command Command to check completion installation for. +proc assert_xspec_completion_installed {command} { + set test "Completion via _filedir_xspec() should be installed" + set cmd "complete -p $command" + send "$cmd\r" + + set expected "^$cmd\r\ncomplete -F _filedir_xspec $command\r\n/@$" + expect { + -re $expected { pass "$test" } + -re /@ { fail "$test at prompt" } + } +} + + # Sort list. # `exec sort' is used instead of `lsort' to achieve exactly the # same sort order as in bash. @@ -690,13 +709,12 @@ proc init_tcl_bash_globals {} { } -# Check whether completion is installed for the specified command by executing -# `complete -p ...' in bash. -# @param string $command Command to check completion availability for. +# Try installing completion for the specified command. +# @param string $command Command to install completion for. # @return boolean True (1) if completion is installed, False (0) if not. -proc is_bash_completion_installed_for {command} { +proc assert_install_completion_for {command} { set test "$command should have completion installed in bash" - set cmd "complete -p $command &> /dev/null && echo -n 0 || echo -n 1" + set cmd "__load_completion $command ; complete -p $command &> /dev/null && echo -n 0 || echo -n 1" send "$cmd\r" expect "$cmd\r\n" expect { @@ -716,7 +734,7 @@ proc is_cygwin {} { # Expect items, a limited number (20) at a time. # Break items into chunks because `expect' seems to have a limited buffer size -# @param list $items Expected list items +# @param list $items Expected list items # @param list $args Options: # -bash-sort Compare list bash-sorted. Default is # unsorted @@ -846,13 +864,13 @@ proc save_env {{file ""}} { # @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~". # @see assert_env_unmodified() proc _save_env {{file ""}} { - assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\"" + assert_bash_exec "{ (set -o posix ; set); declare -F; shopt -p; set -o; } > \"$file\"" } # Source bash_completion package proc source_bash_completion {} { - assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$(cd "$SRCDIR/.."; pwd)/completions} + assert_bash_exec {BASH_COMPLETION_COMPAT_DIR="$SRCDIR/fixtures/shared/empty_dir"} assert_bash_exec {source $(cd "$SRCDIR/.."; pwd)/bash_completion} } @@ -994,7 +1012,7 @@ proc init_bash_xtrace {{fname xtrace.log}} { # Setup test environment -# +# # Common initialization for unit and completion tests. proc start_interactive_test {} { start_bash diff --git a/test/lib/library.sh b/test/lib/library.sh index 290ec813..0a671595 100644 --- a/test/lib/library.sh +++ b/test/lib/library.sh @@ -24,6 +24,8 @@ diff_env() { /[<>] PPID=/d # Remove BASH_REMATCH bash variable /[<>] BASH_REMATCH=/d +# Remove functions starting with underscore + /[<>] declare -f _/d $3" } # diff_env() @@ -62,12 +64,3 @@ is_bash_version_minimal() { remove_comp_wordbreak_char() { COMP_WORDBREAKS=${COMP_WORDBREAKS//$1} } # remove_comp_wordbreak_char() - - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh diff --git a/test/log/.gitignore b/test/log/.gitignore new file mode 100644 index 00000000..72e8ffc0 --- /dev/null +++ b/test/log/.gitignore @@ -0,0 +1 @@ +* diff --git a/test/run b/test/run new file mode 100755 index 00000000..43651654 --- /dev/null +++ b/test/run @@ -0,0 +1,63 @@ +#!/bin/bash + + +# Print some helpful messages. +usage() { + echo "Run bash-completion tests" + echo + echo "The 'tool' is determined automatically from filenames." + echo "Unrecognized options are passed through to dejagnu by default." + echo + echo "Interesting options:" + echo " --tool_exec= Test against a different bash executable." + echo " --debug Create a dbg.log in the test directory with detailed expect match information." + echo " --timeout Change expect timeout from the default of 10 seconds." + echo " --debug-xtrace Create an xtrace.log in the test directory with set -x output." + echo + echo "Example run: ./run unit/_get_cword.exp unit/compgen.exp" +} + + +# Try to set the tool variable; or fail if trying to set different values. +set_tool() { + if [[ $tool ]]; then + if [[ $tool != $1 ]]; then + echo "Tool spec mismatch ('$tool' and '$1'). See --usage." + exit 1 + fi + else + tool=$1 + fi +} + + +cd "$(dirname "${BASH_SOURCE[0]}")" + + +# Loop over the arguments. +args=() +while [[ $# > 0 ]]; do + case "$1" in + --help|--usage) usage; exit 1;; + --debug-xtrace) args+=(OPT_BASH_XTRACE=1);; + --timeout) shift; timeout=$1;; + --timeout=*) timeout=${1/--timeout=};; + --tool=*) set_tool "${1#/--tool=}";; + --tool) shift; set_tool "$1";; + completion/*.exp|*/completion/*.exp|unit/*.exp|*/unit/*.exp) + arg=${1%/*} + set_tool "${arg##*/}" + args+=("${1##*/}") + ;; + *) args+=("$1") + esac + shift +done + +[[ -n $timeout ]] && args+=("OPT_TIMEOUT=$timeout") +[[ -z $tool ]] && { echo "Must specify tool somehow"; exit 1; } + +runtest --outdir log --tool $tool "${args[@]}" +rc=$? +[[ $rc -ne 0 && -n "$CI" ]] && cat log/$tool.log +exit $rc diff --git a/test/runCompletion b/test/runCompletion new file mode 100755 index 00000000..38a82622 --- /dev/null +++ b/test/runCompletion @@ -0,0 +1,8 @@ +#!/bin/bash + +# NOTE: I tried setting up bash_completion_lib within ./lib files, but DejaGnu +# isn't initialized at that point (i.e. output of `expect' is shown on +# stdout - `open_logs' hasn't run yet?). And running code from a library +# file isn't probably a good idea either. +exec "${bashcomp_bash:-$BASH}" \ + "$(dirname "${BASH_SOURCE[0]}")/run" --tool completion $* diff --git a/test/runInstall b/test/runInstall new file mode 100755 index 00000000..87aea589 --- /dev/null +++ b/test/runInstall @@ -0,0 +1,7 @@ +#!/bin/bash + +# NOTE: I tried setting up bash_completion_lib within ./lib files, but DejaGnu +# isn't initialized at that point (i.e. output of `expect' is shown on +# stdout - `open_logs' hasn't run yet?). And running code from a library +# file isn't probably a good idea either. +exec runtest --outdir log --tool install $* diff --git a/test/runLint b/test/runLint new file mode 100755 index 00000000..2db8f358 --- /dev/null +++ b/test/runLint @@ -0,0 +1,45 @@ +#!/bin/bash + +gitgrep() +{ + local out=$(git grep -I -P -n "$1" | \ + grep -E '^(bash_completion|completions/|test/)' | \ + grep -Fv 'test/runLint') + if [ -n "$out" ] ; then + printf '***** %s\n' "$2" + printf '%s\n\n' "$out" + fi +} + +unset CDPATH +cd $(dirname "$0") ; cd .. + +cmdstart='(^|[[:space:]]|\()' + +gitgrep $cmdstart"awk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \ + 'awk with -F char or -F ERE, use -Fchar instead (Solaris)' + +gitgrep $cmdstart"awk\b.*\[:[a-z]*:\]" \ + 'awk with POSIX character class not supported in mawk (Debian/Ubuntu)' + +gitgrep $cmdstart'sed\b.*\\[?+]' \ + 'sed with ? or +, use POSIX BRE instead (\{m,n\})' + +gitgrep $cmdstart'sed\b.*\\\|' \ + "sed with \|, use POSIX BRE (possibly multiple sed invocations) or another tool instead" + +# TODO: really nonportable? appears to work fine in Linux, FreeBSD, Solaris +#gitgrep $cmdstart'sed\b.*;' \ +# 'sed with ;, use multiple -e options instead (POSIX?) (false positives?)' + +gitgrep $cmdstart'sed\b.*-[^[:space:]]*[rE]' \ + 'sed with -r or -E, drop and use POSIX BRE instead' + +gitgrep $cmdstart'[ef]grep\b' \ + '[ef]grep, use grep -[EF] instead (historical/deprecated)' + +# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in +# Solaris/FreeBSD) + +gitgrep '(?<!command)'$cmdstart'(grep|ls|sed)(\s|$)' \ + 'invoke grep, ls, and sed through "command", e.g. "command grep"' diff --git a/test/runUnit b/test/runUnit new file mode 100755 index 00000000..5df06227 --- /dev/null +++ b/test/runUnit @@ -0,0 +1,8 @@ +#!/bin/bash + +# NOTE: I tried setting up bash_completion_lib within ./lib files, but DejaGnu +# isn't initialized at that point (i.e. output of `expect' is shown on +# stdout - `open_logs' hasn't run yet?). And running code from a library +# file isn't probably a good idea either. +exec "${bashcomp_bash:-$BASH}" \ + "$(dirname "${BASH_SOURCE[0]}")/run" --tool unit $* diff --git a/test/tmp/.gitignore b/test/tmp/.gitignore new file mode 100644 index 00000000..72e8ffc0 --- /dev/null +++ b/test/tmp/.gitignore @@ -0,0 +1 @@ +* diff --git a/test/unit/__expand_tilde_by_ref.exp b/test/unit/__expand_tilde_by_ref.exp index abd549cb..60aa7d52 100644 --- a/test/unit/__expand_tilde_by_ref.exp +++ b/test/unit/__expand_tilde_by_ref.exp @@ -36,7 +36,7 @@ assert_bash_exec {foo() { local aa="~"; __expand_tilde_by_ref aa; }; foo; unset sync_after_int -set test "~user should return /home/user" +set test "~user should return $home" set cmd [format {var="~%s"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user] assert_bash_list "$home" $cmd $test @@ -44,7 +44,7 @@ assert_bash_list "$home" $cmd $test sync_after_int -set test "~/foo should return /home/user/foo" +set test "~/foo should return $home/foo" set cmd {var='~/foo'; __expand_tilde_by_ref var; printf "%s\n" "$var"} assert_bash_list "$home/foo" $cmd $test @@ -52,7 +52,7 @@ assert_bash_list "$home/foo" $cmd $test sync_after_int -set test "~user/bar should return /home/user/bar" +set test "~user/bar should return $home/bar" set cmd [format {var="~%s/bar"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user] assert_bash_list "$home/bar" $cmd $test @@ -60,7 +60,7 @@ assert_bash_list "$home/bar" $cmd $test sync_after_int -set test "~user/\$HOME should return /home/user/\$HOME" +set test "~user/\$HOME should return $home/\$HOME" set cmd [format {var="~%s/\$HOME"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user] assert_bash_list "$home/\$HOME" $cmd $test @@ -68,7 +68,7 @@ assert_bash_list "$home/\$HOME" $cmd $test sync_after_int -set test "'~user/a b' should return '/home/user/a b'" +set test "'~user/a b' should return '$home/a b'" set cmd [format {var="~%s/a b"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user] assert_bash_list [list [format {%s/a b} $home]] $cmd $test @@ -76,7 +76,7 @@ assert_bash_list [list [format {%s/a b} $home]] $cmd $test sync_after_int -set test "~user/* should return /home/user/*" +set test "~user/* should return $home/*" set cmd [format {var="~%s/*"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user] assert_bash_list "$home/\*" $cmd $test diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp index a736e6ed..fb29af5b 100644 --- a/test/unit/_filedir.exp +++ b/test/unit/_filedir.exp @@ -1,6 +1,6 @@ proc setup {} { assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _f} + assert_bash_exec {unset -f _f _fd} save_env # Declare bash completion function `_f' assert_bash_exec { \ @@ -16,9 +16,16 @@ proc setup {} { _g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; \ complete -F _g g \ } - # Create directories `a*b' and `a\b' only when not running on Cygwin/Windows; - # directories containing `*' or `\' aren't allowed on Cygwin/Windows + # Declare bash completion function `_fd' to complete on dirs + assert_bash_exec { \ + _fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; }; \ + complete -F _fd fd \ + } + # Create directories `a"b', `a*b', and `a\b' only when not running on + # Cygwin/Windows (`"', `*', or `\' aren't allowed in filenames there) if {! [is_cygwin]} { + # Create directory `a"b' + assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\"b ] && mkdir a\"b && touch a\"b/d || true)} # Create directory `a*b' assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)} # Create directory `a\b' @@ -29,12 +36,13 @@ proc setup {} { proc teardown {} { if {! [is_cygwin]} { + assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\"b/d && rmdir a\"b/ || true)} assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\\b/g && rmdir a\\b/ || true)} assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)} } assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _f _g} - assert_bash_exec {complete -r f g} + assert_bash_exec {unset -f _f _g _fd} + assert_bash_exec {complete -r f g fd} assert_env_unmodified { /OLDPWD/d /OLD_CTYPE/d @@ -78,31 +86,25 @@ foreach name {f f2} { sync_after_int - set test "completing $name a\\\"b/ should return d"; #" - set cmd "$name a\\\"b/"; #" - assert_complete_dir d $cmd "$::srcdir/fixtures/_filedir" $test - - - sync_after_int - - set test "completing $name a\\\$b/ should return h" - set cmd "$name a\\\$b/" - assert_complete_dir h $cmd "$::srcdir/fixtures/_filedir" $test - + if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} { + xfail $test + } else { + set cmd "$name a\\\$b/" + assert_complete_dir h $cmd "$::srcdir/fixtures/_filedir" $test + sync_after_int + } - sync_after_int + if {! [is_cygwin]} { # Illegal characters in file/dir names + set test "completing $name a\\\"b/ should return d"; #" + set cmd "$name a\\\"b/"; #" + assert_complete_dir d $cmd "$TESTDIR/tmp" $test + sync_after_int - # Execute these tests only when not running on Cygwin/Windows, because - # directories containing asterisk (*) or backslash (\) aren't allowed on - # Cygwin/Windows - if {! [is_cygwin]} { set test "completing $name a\\\\b/ should return g" set cmd "$name a\\\\b/" assert_complete_dir g $cmd "$TESTDIR/tmp" $test - - sync_after_int } @@ -137,13 +139,6 @@ foreach name {f f2} { sync_after_int - set cmd "$name 'a\"b/"; #" - assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir" - - - sync_after_int - - set cmd "$name 'a\$b/" assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir" @@ -151,13 +146,13 @@ foreach name {f f2} { sync_after_int - # Execute these tests only when not running on Cygwin/Windows, because - # directories containing `*' or `\' aren't allowed on Cygwin/Windows - if {! [is_cygwin]} { + if {! [is_cygwin]} { # Illegal characters in file/dir names + set cmd "$name 'a\"b/"; #" + assert_complete_dir {d'} $cmd "$TESTDIR/tmp" + sync_after_int + set cmd "$name '$TESTDIR/tmp/a\\b/" assert_complete_dir {g'} $cmd "$TESTDIR/tmp" - - sync_after_int } @@ -190,18 +185,20 @@ foreach name {f f2} { sync_after_int - set cmd "$name \"a\\\"b/"; #" - assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #" - - - sync_after_int - - - set cmd "$name \"a\\\$b/"; #" - assert_complete_dir {h"} $cmd "$::srcdir/fixtures/_filedir"; #" + if {! [is_cygwin]} { # Illegal characters in file/dir names + set cmd "$name \"a\\\"b/"; #" + assert_complete_dir {d"} $cmd "$TESTDIR/tmp"; #" + sync_after_int + } - sync_after_int + if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} { + xfail "$name \"a\\\$b/ should show completions" + } else { + set cmd "$name \"a\\\$b/"; #" + assert_complete_dir {h"} $cmd "$::srcdir/fixtures/_filedir"; #" + sync_after_int + } set cmd "$name \"a\\b/"; #" @@ -260,4 +257,12 @@ if { sync_after_int +set test "completing fd a\\ should return a\\ b/" +set cmd "fd a\\ " +assert_complete_dir "a\\ b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace + + +sync_after_int + + teardown diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp index 3a582811..3fd3e20e 100644 --- a/test/unit/_get_cword.exp +++ b/test/unit/_get_cword.exp @@ -11,6 +11,7 @@ proc teardown {} { /COMP_WORDBREAKS=/{N d } + /_scp_path_esc=/d } } @@ -249,4 +250,18 @@ expect { sync_after_int +set test "index shouldn't drop below 0" +set dir $::srcdir/fixtures/_get_cword +set cmd "scp" +send "$cmd ääää§ se\t\r\n" +expect { + -re "index: substring expression < 0" { fail "$test" } + -re /@ { pass "$test" } + default { unresolved "$test" } +} + + +sync_after_int + + teardown diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp index 30ede41c..c065f766 100644 --- a/test/unit/_known_hosts_real.exp +++ b/test/unit/_known_hosts_real.exp @@ -120,4 +120,32 @@ assert_bash_exec "unset -v COMP_KNOWN_HOSTS_WITH_HOSTFILE" sync_after_int +set test "Included config files should work" +set hosts [get_hosts -unsorted] + # Host 'recursion' is defined in ./fixtures/_known_hosts_real/config_include_recursion + # Host 'relative_path' is defined in ./fixtures/_known_hosts_real/.ssh/config_relative_path +lappend hosts recursion relative_path +set hosts [join [bash_sort $hosts] "\\s+"] + # Setup environment + # Redefined HOME to handle relative path inclusions on $HOME/.ssh +set cmd {OLDHOME=$HOME; HOME="$SRCDIRABS/fixtures/_known_hosts_real"} +send "$cmd\r" +expect -ex "$cmd\r\n/@" + # Call _known_hosts +set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config_include ''; echo_array COMPREPLY} +send "$cmd\r" +expect -ex "$cmd\r\n" +expect { + -re "^$hosts\r\n/@$" { pass "$test" } + default { unresolved "$test" } +} + # Teardown environment +set cmd {HOME=$OLDHOME} +send "$cmd\r" +expect -ex "$cmd\r\n/@" + + +sync_after_int + + teardown diff --git a/test/unit/_tilde.exp b/test/unit/_tilde.exp index 2e22b848..19f47241 100644 --- a/test/unit/_tilde.exp +++ b/test/unit/_tilde.exp @@ -46,6 +46,12 @@ sync_after_int set test "~part should complete to ~full" set cmd [format {_tilde "~%s"; printf "%%s\n" "${COMPREPLY[@]}"} $part] assert_bash_list "~$full" $cmd $test +sync_after_int + + +# Debian #766163 +assert_no_complete "_tilde ~-o" +sync_after_int teardown diff --git a/test/unit/_variables.exp b/test/unit/_variables.exp new file mode 100644 index 00000000..31411d53 --- /dev/null +++ b/test/unit/_variables.exp @@ -0,0 +1,39 @@ +proc setup {} { + assert_bash_exec { unset assoc1 && declare -A assoc1=([idx]=1)} + assert_bash_exec { unset assoc2 && declare -A assoc2=([idx1]=1 [idx2]=2)} + assert_bash_exec { unset ${!___v*} && declare ___var='' } + save_env +} + + +proc teardown {} { + assert_bash_exec {unset assoc1 assoc2} +} + + +setup + +set test "Complete simple variable names" +assert_complete "\$___var" ": \$___v" $test + +set test "Complete single array index" +assert_complete "\$\{assoc1\[idx\]\}" ": \$\{assoc1\[" $test +sync_after_int + +set test "Complete closing curly bracket after square bracket" +assert_complete "\$\{assoc1\[bogus\]\}" ": \$\{assoc1\[bogus\]" $test +sync_after_int + +set test "Complete closing brackets after @ index" +assert_complete "\$\{assoc1\[@\]\}" ": \$\{assoc1\[@" $test +sync_after_int + +# For some reason -expect-cmd-minus is necessary here +set test "Complete multiple array indexes" +assert_complete_partial { \$\{assoc2\[idx1\]\} \$\{assoc2\[idx2\]\} } ":" "\$\{assoc2\[" $test -expect-cmd-minus "\${assoc2\[" +sync_after_int + +set test "Complete variables prefixed with #" +assert_complete "\$\{#___var\}" ": \$\{#___v" $test + +teardown |