diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2019-08-07 09:17:13 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2019-08-07 09:17:13 -0300 |
commit | 5732da2af736c40cf693354485446ab4867ecb4d (patch) | |
tree | 76d76cdfa16ca62d20fb109da13895ec64fff110 | |
parent | 9cd22d1df8f0f5b554858471c86faa9f37b8fed4 (diff) | |
download | bash-completion-5732da2af736c40cf693354485446ab4867ecb4d.tar.gz |
New upstream version 2.9upstream/2.9
2463 files changed, 16510 insertions, 20989 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index ce251c0a..db8dc273 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,3 +1,8 @@ -;; bash-completion shell-script mode additional settings for Emacs +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") -((sh-mode . ((sh-indent-comment . t)))) +((python-mode + (eval add-hook 'before-save-hook 'blacken-buffer nil t)) + (sh-mode + (flycheck-sh-bash-args "-O" "extglob") + (sh-indent-comment . t))) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..61f2dc9f --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +**/__pycache__/ diff --git a/.editorconfig b/.editorconfig index 93f55b83..1ef5717d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,6 @@ max_line_length = 79 [Makefile.am] indent_style = tab + +[*.yml] +indent_size = 2 @@ -16,3 +16,10 @@ bash_completion.sh bash-completion.pc bash-completion-config.cmake bash-completion-config-version.cmake +__pycache__/ +.pytest_cache/ +.python-version +pytestdebug.log +helpers/perl.bak +helpers/perl.tdy +helpers/perl.ERR diff --git a/.perltidyrc b/.perltidyrc new file mode 100644 index 00000000..cf0a0e4c --- /dev/null +++ b/.perltidyrc @@ -0,0 +1,5 @@ +--perl-best-practices +--maximum-line-length=79 +--paren-tightness=2 +--cuddled-else +--warning-output diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..bb16bdda --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,2 @@ +shell=bash +disable=SC1090,SC2039,SC2128,SC2155,SC2166 diff --git a/.travis.yml b/.travis.yml index d3573a74..7f7bd35e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,35 @@ env: - DIST=centos6 - DIST=fedoradev - DIST=ubuntu14 + - DIST=ubuntu14 BSD=true NETWORK=none + - DIST=tools before_install: - docker build -t bash-completion:$DIST -f test/docker/Dockerfile-$DIST . script: - - docker run -e CI=true -e DIST=$DIST -t bash-completion:$DIST test/docker/docker-script.sh + - docker run --name bash-completion + -e CI=true -e DIST=$DIST -e BSD=$BSD + ${NETWORK:+--network $NETWORK} + -t bash-completion:$DIST test/docker/docker-script.sh + - if test $DIST = tools; then + test/run-shellcheck -f gcc bash_completion completions/!(Makefile*); + test/run-shellcheck -f gcc -s sh bash_completion.sh.in; + fi + +before_deploy: + - docker start bash-completion + - docker exec bash-completion + sh -c "tar c bash-completion-$TRAVIS_TAG.tar.*" | tar xv + - docker kill bash-completion + +deploy: + provider: releases + api_key: + secure: MoK9nzmS6CBzPPIrhC0Ch6hIB3zEzLqZE6k4axoCyz/wmJFLJgX9OCq5K8zS4Jv8NuaA2C1YTcr+m56IO9N0RTmIWrS4q40fLIhKlYv6255u+wXMkGfqXbiFAZG5yndhUo8NE6QXAtixd3nQ/3/MOt2PdsOn+OdxTDmcPSXaW/ltkd/fMHynWzupdyRJ1v46IofPBrjsC1pTzW0iVqVHz64Ix3kPVjjPR9BMHzgKMJ8sPWBGZtF2ovjwsTHYPSpEyytVRecqrmEjM6QBCgfhQDqH87jOw6Y81xh1fWDCoxaZw7HlEcQ+HeHOkDdA24AYaxVoYXrKdIDXUXWt8w674Po7UWB6kIUn3J59Xaw60Sp4VaN88Y2eX9UKRcoDRHLWc8HKt4f9AUDR9YpFF08N+gKRmJFt9mCxqeJ+pyYD/coHGkGb8XvewTKihCSuH/qCWjM8XqM493DLDlJ5aELgMEcJXPXX4TmjsriOeErTY1qxRTRHJPmfUJ/kHtmpE+DxNXpwZOnyG+VoO5aEaIKbzHxX9QzWyyEhTflupdatZ2JFt1pmVDpwH9zcEifBwE0cUwhXk+LJuxHd5ePIIpvepAAnXKaxlYwchj4cFaJp7S9GZoAQughgQQkyfz0qr3J6hBhg360QAq4yjPOWjGgGz4iAG8kWd3MVXLvL+TtfBeY= + file: bash-completion-$TRAVIS_TAG.tar.xz + skip_cleanup: true + on: + repo: scop/bash-completion + condition: $DIST = fedoradev + tags: true @@ -4,4 +4,4 @@ Guillame Rousse (Mandriva) <Guillaume.Rousse@inria.fr> 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> +Ville Skyttä <ville.skytta@iki.fi> @@ -1,3 +1,436 @@ +bash-completion (2.9) + + [ Antonio Terceiro ] + * dpkg-source: Add --before-build --after-build --commit, and + --print-format + + [ Gabriel F. T. Gomes ] + * xm: Deprecate completion for obsolete command (#284) + * _filedir_xspec: Fallback to suggesting all files if requested + (#260) + * tar: Support completions for zstd compression extensions (#255) + * dpkg: List held packages (#250) + * cvs: Add completion for the log command + + [ Guillaume Mella ] + * unzip, zipinfo: Associate with *.xar (eXist-db application + package) (#257) + + [ Igor Susman ] + * mplayer: Associate with *.w64 + + [ Jaak Ristioja ] + * okular: Added support for xz-compressed files. + + [ John Swinbank ] + * _xspecs: Declare as global on bash >= 4.2 + + [ Kevin Locke ] + * test: Increase expect pty to 160 columns + * test: avoid interrupting magic mark output + + [ Per Lundberg ] + * 7z: add .msi support + + [ Peter Wu ] + * tshark: speed up tshark -O completion + * tshark: fix completion of -Xlua_script option + * tshark: Support preferences (-o) completion with memoization + * test: fix misinterpretation of completion output in tests + * test: fix flake8 complaints about unused imports + * conftest: fix RemovedInPytest4Warning due to use of + node.get_marker + * chromium-browser: consider chrome and chromium as aliases + * tshark: support .gz and .cap files for -r expansion + * tshark: prevent a single-character file from breaking -G + completion + * tshark: update -T and -t completions + + [ Russell Davis ] + * man: Fix completion when failglob option is enabled (#225) + + [ Timo Taipalus ] + * mplayer: Add common supported module music formats + + [ Tomasz N ] + * _longopt: pick first long option on a line, not last + + [ Ville Skyttä ] + * *: avoid shellcheck SC1007 and SC1010 + * 7z: add some TODO notes on parsing "i" output for extensions + * ssh: make -o protocol completion less hardcoded + * ssh: make option completion case insensitive + * ssh: fix suboption completion with combined -*o + * xvnc4viewer: code cleanups + * doc/testing: remove lots of legacy info, add some new + * CONTRIBUTING: add upstream vs bash-completion considerations + * CONTRIBUTING: note runLint and run-shellcheck + * __parse_options, 7z: avoid herestrings + * arp, ccze, ifstat, inotifywait, makepkg: invoke sed with "command" + * shellcheck: disable bunch of warnings when in "-S warning" mode + * test: move default shell option from run-shellcheck to + .shellcheckrc + * test: make runLint search for herestrings + * tar, valgrind: avoid some herestrings + * travis: run shellcheck on bash_completion.sh.in too + * travis: fail on shellcheck errors + * make: quote eval array definitions to work around shellcheck + SC1036 bug + * test: add make -C test case + * *: shellcheck error fixes + * _included_ssh_config_files: store found included files in an array + * _included_ssh_config_files: doc grammar fixes + * test: add invoke-rc.d test case for not repeating already given + options + * ebtables: improve existing table arg parsing + * test: add script to run shellcheck, run it in Travis, allowing + failure for now + * iptables: improve existing table arg parsing + * test: shorten long gdb test core file name so tar doesn't croak on + it + * AUTHORS: remove unrelated project association from my entry + * apt-get: protect source against regex specials + * mypy, mysql, xmms: don't complete unknown split long option args + * synclient: remove unused local variable "split" + * test: adjust _get_comp_words_by_ref test to changed error output + * apt-cache: protect showsrc against regex specials + * test: improve tshark -O arg completion test + * tshark: ignore stderr when parsing -G, -L, and -h output + * *: error output consistency, use bash_completion prefix + * _upvar: deprecate in favor of _upvars + * *: add missing "ex: filetype=sh" + * phing: fix getting just a tab for options on CentOS 6 + * phing: don't complete -l with files + * various: apply file vs dir special cases also when invoked with + full path + * *: whitespace tweaks + * ssh: don't offer protocol v1 specific options if it's not + supported + * test: add some gdb non-core files + * _parse_help: look for long options somewhat more eagerly + * gdb: relax core filename pattern + * test/tools: fix exit status incrementation + * *: arithmetic expression related cleanups + * test/tools: run all tools, don't stop at first failure + * test: check for perltidy errors and warnings + * *: format Perl code with perltidy + * *: format Python code with black + * .dir-locals.el: use flycheck-sh-bash-args + * valgrind: look up tools from libexec dirs too + * *: make _parse_usage fallbacks more concise + * svn, svk, wget: use _iconv_charsets + * *: spelling fixes + * msynctool: code cleanups + * *: remove whitespace after redirections + * *: remove spaces immediately within $() + * bzip2: recognize *.tbz2 as bzipped + * modprobe: module parameter boolean values + * ping, tracepath: parse options primarily with _parse_help + * ulimit: new completion + * shellcheck: new completion + * dnssec-keygen: new completion + * modprobe: append = to module parameter completions + * test: include test_unit_longopt.py in dist + * test: add some _longopt unit tests + * _longopt: simplify regex, use printf instead of echo, drop + unnecessary sort + * nsupdate: new completion + * _longopt: don't complete --no-* with file/dirname arg + * copyright: add 2019 + * pytest: complete --pythonwarnings/-W arg + * python: make warning action list reusable + * test: use pytest-xdist + * extra: add git pre-push hook for triggering Docker Hub builds + * post-commit: trigger on test/requirements.txt too + * pytest: complete pytest-xdist --dist, --numprocesses, and + --rsyncdir + * test: remove no longer needed completion/*.exp + * xfreerdp: reinstate support for old versions with dash option + syntax + * test: rewrite "generate" in Python, fix trailing backslash in + EXTRA_DIST + * test: sort t/Makefile.am EXTRA_DIST in C locale + * ssh: support RemoteCommand and SyslogFacility options + * test: Expect failure for chown all users test as non-root + * test: Fix declare test case with bash 5.0 + * adb: Deprecate in favor of one shipped with the Android SDK + * xfreerdp: Update for more modern xfreerdp + * jsonschema: New completion + * test: Remove unnecessary ri xfail + * test: Clean up man tmp dir + * .gitignore: Add .python-version (for pyenv) + * test: Remove unnecessary autouse=True from fixtures + * ifstat: Make work with iproute2 version + * iperf, iperf3: Add some option arg (non-)completions + * test: Fix test generation wrt results checking improvements + * ifstat: New completion + * __parse_options: Avoid non-zero exit status + * test: Refactor/improve completion results checking + * test: Match Python's default locale unaware sort in bash setup + * test: Rename completion.line to .output + * test: Add man failglob test case + * test: Add pre_cmds support for completion fixture + * inotifywatch: New completion, common with inotifywait + * inotifywait: Fix -e completion with BSD sed + * inotifywait: Avoid some false positive event names + * test: extend _ip_addresses unit tests some + * _ip_addresses: Avoid completing ipv4 ones with -6 + * inotifywait: New completion + * test: Mark some xfails based on if in docker instead of in CI + * test: Skip ifup options test if it doesn't grok --help, not in CI + * test: Clean up and docker-ignore __pycache__ dirs + * build: Include test/t in dist tarball + * test/t: Avoid trailing backslash in Makefile.am's to appease + automake + * test: Remove some no longer used old test suite code + * _xspecs: Simplify bash version check + * chmod: Fix "-" completion + * sysctl: Treat -f as alias for -p/--load + * .gitignore: Add pytestdebug.log + * chmod: Fix file completion after modes starting with a dash + * _count_args: Add 3rd arg for treating option-like things as args + * test: Fix _count_args test_7 to test intended case + * pydocstyle: New completion + * Travis: Remove unused PYTEST env var + * doc: Note email issues gateway + * tcpdump: Various option and their arg completion updates + * test: Fix arp CI (non)expectations, remove redundant test case + * test: Be more consistent with "CI" env var examination and xfails + * arp: New completion, somewhat incomplete + * test: Expect failure in gkrellm if there's no X display + * doc: Update docs on generating simple tests + * doc: Some test dependency doc updates + * test: Add requirements.txt for installing dependencies + * grpck: Parse options with _parse_help, falling back to + _parse_usage + * grpck: Add --root/-R arg completion + * test suite: Ignore _scp_path_esc in env for ssh-copy-id + * ssh-copy-id: Add -i and -o arg (non-)completions + * tar: Clean up some redundant code + * cancel: Split long line + * cancel: Add some option arg (non-)completions + * locale-gen: New completion + * makepkg: Don't apply to other than Slackware makepkg + * test: Allow unknowns options in makepkg option completion + * makepkg: Use _parse_help instead of hardcoding option list + * mypy: New completion + * op: New completion + * hunspell: New completion + * xmllint: Improve --encode, --pretty, and --xpath arg + (non-)completions + * test: Remove leftover completion/ls.exp + * gcc: Add g++, gcc, gccgo, and gfortran *-[568] aliases + * perlcritic: New completion + * gnome-screenshot: New completion + * isort: New completion + * freeciv: Option and arg completion updates + * freeciv-gtk2: Install for freeciv and freeciv-gtk3, rename to + freeciv + * mplayer etc: Complete on *.crdownload partial downloads in + addition to *.part + * chromium-browser, google-chrome*: New non-xspec completion + * firefox etc: New non-xspec completion + * Merge branch 'master' into wip-pexpect + * nc: Add some more option (non-)completions + * test: Mark MANPATH without leading/trailing colons test an xfail + on CI CentOS 6 + * test: Remove kill, killall remnants + * test: Make case specific env entries shell code, not escaped + * Merge branch 'master' into wip-pexpect + * unzip, zipinfo: Associate with *.whl + * __load_completion: Avoid unnecessary lookups from nonexistent dirs + * Merge branch 'master' into wip-pexpect + * gcc: Add g++, gcc, gccgo, and gfortran *-7 aliases + * test: Use test_unit_* prefix for unit tests, to avoid name clashes + * test: Support setting cmd=None to require no command, for unit + tests + * test: Misc test suite fixes + * test: Fix jq and scrub skipif commands + * test: Don't require complete marker on test methods + * test: Add support for per-test env modifications + * test: Use more conventional Python file names for tests + * test: Sort completion results in Python for ease of use in Python + tests + * test: Allow __load_completion to fail + * test: chdir to fixtures dir in Python as well + * test: Mark xfreerdp as expected failure for now + * test: Replace + with Plus in test class names + * test: Implement load_completion_for using assert_bash_exec + * test: Add ability to selectively ignore diffs in environment + * test: Fixture reorganization + * test: Pass through $HOME and $DISPLAY to test bash + * test: Log pexpect interaction to $BASHCOMP_TEST_LOGFILE if set + * test: Rename BASHCOMP_* test env variables to BASHCOMP_TEST_* + * test: Add python3 test case + * test: Add class level skipif based on bash exec result + * test: Include command name in test class name, use numbered test + method names + * test: Fix some regressions introduced in recent test conversions + * test: Add support for running test case in a specified dir + * test: Add support for skipping individual tests based on shell + command status + * test: Make test base work with Python 3.3+ + * test: Add some iperf, iperf3 and xmodmap test cases + * xmodmap: Use _parse_help instead of hardcoded option list + * iperf: Improve client/server specific option parsing + * iperf: Install for iperf3 too + * iperf: Add g/G to --format completions + * xmodmap: Use _parse_help instead of hardcoded option list + * iperf: Improve client/server specific option parsing + * iperf: Install for iperf3 too + * iperf: Add g/G to --format completions + * test: Use /root/.local/bin/pytest on ubuntu14 by default + * test: Add generated test files to t/Makefile.am automatically + * test: Add new test files to EXTRA_DIST + * test: Use /root/.local/bin/pytest on centos6 by default + * test: Use make pytest docker executable env-configurable, default + pytest-3 + * test: Update generate for pytest+pexpect + * test: Convert majority of test cases to pytest+pexpect + * tox: Fall back to --listenvs for env list if --listenvs-all fails + * git-post-commit: Avoid some error trash when HEAD is not a + symbolic ref + * test: Add pylint-3 test case + * test: Limit number of pylint option completions + * pydoc, pylint: Determine python2/3 based on command basename only + * pylint: Bring -f/--format arg completion up to date with pylint + 1.9.2 + * pylint: Implement comma separated --confidence arg completion + * test: Fix buffer size option listing in run --help + * test: Bump expect's match_max to 20000 by default + * test: Run docker tests with --verbose + * _services: Try systemctl list-unit-files if systemctl list-units + fails + * extra/git-post-commit.sh: Add git post-commit Docker Hub trigger + hook + * gpgv: New completion + * pydoc, pylint: Skip module completion if current looks like a path + * travis: Run ubuntu14/bsd with no network + * travis: Split long lines in script + * test: Limit number of wget option completions to avoid unresolved + result + * test: Mark flake8 untested if it seems broken + * pylint: Option arg completion improvements + * tshark: Get available interfaces from -D output + * ngrep: Add "any" to -d arg completions + * fio: New completion + * test: Fix iwspy test case + * uscan: Use _parse_help instead of hardcoded option list + * urlsnarf: Add -p arg completion + * tracepath: Add -m and -p arg non-completions + * tracepath: Actually use our separate completion instead of + _known_hosts + * test: Skip jq option completion test if its --help doesn't list + them + * xdg-settings: Make help parsing work on BSD + * test: Support running with local BSD binaries, do it w/ ubuntu14 + in CI + * jq, sqlite3: Protect against negative array subscripts + * sudo: Improve long option arg handling + * sysctl: Recognize --pattern/-r and --load options + * test: Add sysctl option parsing test case + * sudo: Parse options from help/usage output, add some long option + support + * strace: Use _parse_help instead of hardcoded option list + * sshow: Add -p arg completion + * sqlite3: Add some option arg (non-)completions + * tune2fs: Update -o/-O argument lists + * jq: New completion + * reportbug: Run _parse_help and apt-cache more selectively + * querybts: Use _parse_help, not hardcoded option list, misc + improvements + * pyvenv: Support versioned 3.6-3.8 executables + * passwd: Try _parse_help before _parse_usage to parse options + * profile.d: Avoid tested variable values being confused as [ ] + operators + * cryptsetup: Add some option arg (non-)completions + * cryptsetup, nc, sh: Skip option args when counting arguments + * modinfo: Fall back to _parse_usage if _parse_help yields no + results + * mysql, mysqladmin: Complete --ssl-{ca,cert,key} option arg + * mysqladmin: Reuse --default-character-set completion from mysql + * modinfo: Use _parse_help instead of hardcoded option list + * minicom: Use _parse_help instead of hardcoded option list + * mplayer: Associate with *.S[3T]M, *.med, *.MED + * completions/Makefile.am: Use install-data-hook, not install-data- + local + * ifup etc: Add option and option argument completion + * _count_args: Add support for not counting specified option args + * ifquery: New ifup alias completion + * ngrep, tshark: Complete on *.pcapng too + * rpm: Complete --licensefiles with -q + * pytest: Rename from py.test to follow upstream recommended name + * README: Add instructions for overriding completions system wide + * README: Note $BASH_COMPLETION_USER_DIR + * test: Mark psql etc test cases untested if --help doesn't work + * aclocal, automake: Support versioned 1.16 executables + * __load_completion: Avoid bad array subscript on "commands" ending + with slash + * lzma: Use _parse_help instead of hardcoded option list + * test: Run perlcritic and flake8 on perl and python helpers in + Travis + * build: Improve cleanup of test/log and test/tmp dirs + * pkg-config: Complete on *.pc files + * build: Use AC_PROG_SED to locate sed + * build: Do cmake, pc, and profile variable replacements in Makefile + * README: Add Q/A on overriding a completion, modernize local + install answer + * json_xs: New completion + * chmod: New completion + * iperf, nc: Include IPv6 addresses in bind address completions + * links: Major rework, parse options from --help, add option arg + completion + * _ip_addresses: Add option to complete all/v4/v6 addresses, add + unit test + * wget: Remove nonexistent arg to _ip_addresses + * _filedir: Drop unnecessary evals + * iconv: Split charset completion to _iconv_charsets, add test case + * links: Install completion for links2 too + * xgamma: Comment spelling fix + * lftp: handle -s + * test: Skip scrub -p test when its --help doesn't list available + patterns + * ecryptfs-migrate-home: New completion + * scrub: New completion + * ether-wake: Install for etherwake as well + * *: Support completing arg of last bundled short option + * dselect: Parse options with _parse_help + * dhclient: Add some option arg (non-)completions + * dhclient: Parse options with _parse_usage + * chage, chpasswd: Add -R/--root arg completion + * reportbug: Add bunch of option arg (non-)completions + * .dir-locals.el: Set -O extglob for flycheck bash checks + * mount, umount: Deprecate on Linux in favor of util-linux >= 2.28 + ones + * _known_hosts_real: Reimplement known hosts file parsing in pure + bash + * test: Add comment line to fixtures/_known_hosts_real/known_hosts + * ssh: Complete all *File option args with _filedir + * README: Point Debian and openSUSE badges towards unstable and + Tumbleweed + * README: Link to various distro packages + * apt-get: Add -h/-v/-o non-completions + * apt-get: Sync option list with apt 1.5.1 + * apt-get: Simplify -t and friends completion, support Ubuntu + * apt-get: Add indextargets to list of suggested commands + * apt-get: Complete install package=versions + * ssh: Sync config option lists with OpenSSH 7.5p1, add some value + completions + * ssh: Sync query type list with OpenSSH 7.5p1 + * ssh: Order various switch cases closer to alphabetical + * completions/Makefile: Fix check-local in VPATH builds + + [ dmerge ] + * _filedir: Refactor to remove heredoc-dependent loop + + [ marxin ] + * gccgo: Add as a GCC completion target (#227) + + [ ovf ] + * xrandr: match the output name exactly for --mode + + -- Ville Skyttä <ville.skytta@iki.fi> Sat, 27 Apr 2019 11:50:12 +0300 + bash-completion (2.8) [ Andrea Dari ] @@ -71,7 +504,7 @@ bash-completion (2.8) * mkdir: Complete files without appending space * __load_completion: Load "xspec" completions dynamically too * __load_completion: Code cleanup - * _avaiable_interfaces: Get rid of eval + * _available_interfaces: Get rid of eval * make: Pass script to sed as parameter instead of using process substitution * ccze: New completion diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41287366..44865ba7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,8 +4,39 @@ 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: +However, before submitting a completion to us, first consider submitting it to +the project that ships the commands your completion is for. Having the +completion shipped along with the command opens up some liberties we don't have +if the completion is included with bash-completion. For example, we generally +do not want to hardcode lists of available command options and their +completions, because they quite probably vary between versions of the completed +command, and therefore resort to scraping --help output and the like. While we +do fairly well there, depending on the command, this can be fragile or +expensive, or just not possible. If the completion is shipped alongside the +command, they can be kept in sync and use more hardcoding etc. They are also +more likely to be maintained and/or watched by people intimately familiar with +the completed commands. See instructions in README.md how to install completion +files from other projects so they are automatically enabled and dynamically +loaded by bash-completion. + +On the other hand, we do have a pretty nice test suite and a bunch of helper +functions that you may find useful. And a whole slew of completions in one +package. Our functions can be used from "external" completions as well, just +make sure you test for their existence and/or fail gracefully if you intend +your completion to be usable without having bash-completion installed. + +It's nowhere near clear cut always what is the best place for the completion, +upstream project or us. Even if it would seem to be upstream, not all upstreams +are interested in shipping completions, or their install systems might not +easily support installing completion files properly. But give it some thought, +and ask if unsure. + +If you wish to contribute code to us, volunteering for long term maintainership +of your code within bash-completion is welcome. When exactly you will be asked +to do that depends on the case; don't be disappointed if it does or doesn't +happen instantly. + +Also, 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 @@ -55,7 +86,7 @@ guidelines in mind: As another example, ```shell - bar=$( echo $foo | sed -e 's/bar/baz/g' ) + bar=$(echo $foo | command sed -e 's/bar/baz/g') ``` can be replaced by: @@ -137,9 +168,15 @@ guidelines in mind: 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. +- In addition to running the test suite, there are a few scripts in the test/ + dir that catch some common issues, see and use for example runLint and + run-shellcheck. + - 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 + https://github.com/scop/bash-completion or send them to the email + gateway address bash-completion@fire.fundersclub.com which will pipe + them to GitHub issues (with your email address visible). + Sending them to the developers might work too, but is really strongly 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, diff --git a/Makefile.am b/Makefile.am index 1df73ae0..8f441185 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,22 +15,25 @@ 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 >$@ +%: %.in Makefile + $(SED) \ + -e 's|@prefix[@]|$(prefix)|' \ + -e 's|@compatdir[@]|$(compatdir)|' \ + -e 's|@pkgdatadir[@]|$(pkgdatadir)|' \ + -e 's|@VERSION[@]|$(VERSION)|' \ + <$(srcdir)/$@.in >$@ -CLEANFILES = bash_completion.sh bash-completion.pc +CLEANFILES = bash_completion.sh bash-completion.pc \ + bash-completion-config.cmake bash-completion-config-version.cmake EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ - .editorconfig README.md CONTRIBUTING.md + .editorconfig README.md CONTRIBUTING.md pyproject.toml .perltidyrc \ + .shellcheckrc bash-completion.pc.in bash-completion-config.cmake.in \ + bash-completion-config-version.cmake.in install-data-hook: tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ - sed -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ - $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ - cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ - sed -e 's|\$${prefix}|$(prefix)|' \ - $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \ - > $$tmpfile && \ - cat $$tmpfile > \ - $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \ + $(SED) -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ + $(DESTDIR)$(pkgdatadir)/bash_completion >$$tmpfile && \ + cat $$tmpfile >$(DESTDIR)$(pkgdatadir)/bash_completion && \ rm $$tmpfile @@ -5,8 +5,22 @@ ## 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 +available in many operating system distributions, some examples are listed +below. The package's name is usually bash-completion. + +[![Alpine](https://img.shields.io/badge/Alpine-%28see%20website%29-brightgreen.svg)](https://pkgs.alpinelinux.org/packages?name=bash-completion) +[![Arch](https://img.shields.io/badge/dynamic/json.svg?uri=https%3A%2F%2Fwww.archlinux.org%2Fpackages%2Fextra%2Fany%2Fbash-completion%2Fjson%2F&query=%24.pkgver&label=Arch)](https://www.archlinux.org/packages/extra/any/bash-completion/) +[![Debian](https://img.shields.io/badge/dynamic/json.svg?uri=https%3A%2F%2Fapi.ftp-master.debian.org%2Fmadison%3Fpackage%3Dbash-completion%26f%3Djson%26s%3Dunstable&query=%24..source_version&label=Debian)](https://packages.debian.org/search?keywords=bash-completion&searchon=names&exact=1) +[![Fedora](https://img.shields.io/badge/dynamic/json.svg?uri=https%3A%2F%2Fapps.fedoraproject.org%2Fmdapi%2Frawhide%2Fpkg%2Fbash-completion&query=%24.version&label=Fedora)](https://apps.fedoraproject.org/packages/bash-completion) +[![FreshPorts](https://img.shields.io/badge/FreshPorts-%28see%20website%29-brightgreen.svg)](https://www.freshports.org/shells/bash-completion) +[![Gentoo](https://img.shields.io/badge/Gentoo-%28see%20website%29-brightgreen.svg)](https://packages.gentoo.org/packages/app-shells/bash-completion) +[![Homebrew](https://img.shields.io/homebrew/v/bash-completion%402.svg)](http://formulae.brew.sh/formula/bash-completion%402) +[![OpenCSW](https://img.shields.io/badge/OpenCSW-%28see%20website%29-brightgreen.svg)](https://www.opencsw.org/package/bash_completion/) +[![openSUSE](https://img.shields.io/badge/openSUSE-%28see%20website%29-brightgreen.svg)](https://software.opensuse.org/package/bash-completion?baseproject=openSUSE%3AFactory) +[![Slackware](https://img.shields.io/badge/Slackware-%28see%20website%29-brightgreen.svg)](https://packages.slackware.com/?search=bash-completion) +[![Ubuntu](https://img.shields.io/badge/Ubuntu-%28see%20website%29-brightgreen.svg)](https://packages.ubuntu.com/search?keywords=bash-completion&searchon=names&exact=1) + +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: @@ -26,7 +40,7 @@ standard commands for GNU autotools packages: autoreconf -i # if not installing from prepared release tarball ./configure make -make check # optional, requires dejagnu and tcllib +make check # optional, requires python3 with pytest >= 3.6 and pexpect, dejagnu, and tcllib make install # as root ``` @@ -115,11 +129,30 @@ A. No. Use `M-/` to (in the words of the bash man page) attempt file 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?** +**Q. How can I override a completion shipped by bash-completion?** -A. Put them in `~/.bash_completion`, which is parsed at the end of the - main completion script. See also the next question. +A. Install a local completion of your own appropriately for the desired + command, and it will take precedence over the one shipped by us. See the + next answer for details where to install it, if you are doing it on per + user basis. If you want to do it system wide, you can install eagerly + loaded files in `compatdir` (see a couple of questions further down for + more info) and install a completion for the commands to override our + completion for in them. + + If you want to use bash's default completion instead of one of ours, + something like this should work (where `$cmd` is the command to override + completion for): `complete -o default -o bashdefault $cmd` + +**Q. Where should I install my own local completions?** + +A. Put them in the `completions` subdir of `$BASH_COMPLETION_USER_DIR` + (defaults to `$XDG_DATA_HOME/bash-completion` or + `~/.local/share/bash-completion` + if `$XDG_DATA_HOME` is not set) to have them loaded on demand. + See also the next question's answer for considerations for these + files' names, they apply here as well. Alternatively, you can write + them directly in `~/.bash_completion` which is loaded eagerly by + our main script. **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 @@ -283,7 +316,7 @@ A. Probably because the database is being queried every time and this uses a #!/bin/sh rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ - | sort > /var/log/rpmpkgs + | sort >/var/log/rpmpkgs ``` rpm completion will use this flat text file instead of the RPM database, diff --git a/bash-completion-config.cmake.in b/bash-completion-config.cmake.in index ccc6e052..d907b76c 100644 --- a/bash-completion-config.cmake.in +++ b/bash-completion-config.cmake.in @@ -5,7 +5,7 @@ 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_COMPLETIONSDIR "@pkgdatadir@/completions") +set (BASH_COMPLETION_HELPERSDIR "@pkgdatadir@/helpers") set (BASH_COMPLETION_FOUND "TRUE") diff --git a/bash-completion.pc.in b/bash-completion.pc.in index bde217db..ea03fd75 100644 --- a/bash-completion.pc.in +++ b/bash-completion.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ compatdir=@compatdir@ -completionsdir=@datarootdir@/@PACKAGE@/completions -helpersdir=@datarootdir@/@PACKAGE@/helpers +completionsdir=@pkgdatadir@/completions +helpersdir=@pkgdatadir@/helpers Name: bash-completion Description: programmable completion for the bash shell diff --git a/bash_completion b/bash_completion index ca84b01d..58987a7f 100644 --- a/bash_completion +++ b/bash_completion @@ -3,7 +3,7 @@ # bash_completion - programmable completion functions for bash 4.1+ # # Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> -# © 2009-2018, Bash Completion Maintainers +# © 2009-2019, 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 @@ -23,7 +23,7 @@ # # https://github.com/scop/bash-completion -BASH_COMPLETION_VERSINFO=(2 8) +BASH_COMPLETION_VERSINFO=(2 9) if [[ $- == *v* ]]; then BASH_COMPLETION_ORIGINAL_V_VALUE="-v" @@ -85,7 +85,7 @@ complete -b builtin # @param $1 userland to check for _userland() { - local userland=$( uname -s ) + local userland=$(uname -s) [[ $userland == @(Linux|GNU/*) ]] && userland=GNU [[ $userland == $1 ]] } @@ -124,7 +124,7 @@ have() # _rl_enabled() { - [[ "$( bind -v )" == *$1+([[:space:]])on* ]] + [[ "$(bind -v)" == *$1+([[:space:]])on* ]] } # This function shell-quotes the argument @@ -146,7 +146,7 @@ quote_readline() # This function shell-dequotes the argument dequote() { - eval printf %s "$1" 2> /dev/null + eval printf %s "$1" 2>/dev/null } @@ -161,6 +161,8 @@ dequote() # See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference _upvar() { + echo "bash_completion: $FUNCNAME: deprecated function," \ + "use _upvars instead" >&2 if unset -v "$1"; then # Unset & validate varname if (( $# == 2 )); then eval $1=\"\$2\" # Return single value @@ -182,32 +184,33 @@ _upvar() _upvars() { if ! (( $# )); then - echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\ - "value] | [-aN varname [value ...]] ..." 1>&2 + echo "bash_completion: $FUNCNAME: usage: $FUNCNAME" \ + "[-v varname value] | [-aN varname [value ...]] ..." >&2 return 2 fi while (( $# )); do case $1 in -a*) # Error checking - [[ ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing"\ - "number specifier" 1>&2; return 1; } - printf %d "${1#-a}" &> /dev/null || { echo "bash:"\ - "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2 + [[ ${1#-a} ]] || { echo "bash_completion: $FUNCNAME:" \ + "\`$1': missing number specifier" >&2; return 1; } + printf %d "${1#-a}" &>/dev/null || { echo bash_completion: \ + "$FUNCNAME: \`$1': invalid number specifier" >&2 return 1; } # Assign array of -aN elements [[ "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && - shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:"\ - "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1; } + shift $((${1#-a} + 2)) || { echo bash_completion: \ + "$FUNCNAME: \`$1${2+ }$2': missing argument(s)" \ + >&2; return 1; } ;; -v) # Assign single value [[ "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && - shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing"\ - "argument(s)" 1>&2; return 1; } + shift 3 || { echo "bash_completion: $FUNCNAME: $1:" \ + "missing argument(s)" >&2; return 1; } ;; *) - echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2 + echo "bash_completion: $FUNCNAME: $1: invalid option" >&2 return 1 ;; esac done @@ -275,7 +278,7 @@ __reassemble_comp_words_by_ref() [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" else # No, list of word completions separators hasn't changed; - for i in ${!COMP_WORDS[@]}; do + for i in "${!COMP_WORDS[@]}"; do printf -v "$2[i]" %s "${COMP_WORDS[i]}" done fi @@ -318,7 +321,7 @@ __get_cword_at_cursor_by_ref() local old_size=${#cur} cur="${cur#"${words[i]}"}" local new_size=${#cur} - index=$(( index - old_size + new_size )) + (( index -= old_size - new_size )) fi done # Clear $cur if just space(s) @@ -380,10 +383,10 @@ _get_comp_words_by_ref() prev) vprev=prev ;; cword) vcword=cword ;; words) vwords=words ;; - *) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" \ - 1>&2; return 1 + *) echo "bash_completion: $FUNCNAME: \`${!OPTIND}':" \ + "unknown argument" >&2; return 1 ;; esac - let "OPTIND += 1" + (( OPTIND += 1 )) done __get_cword_at_cursor_by_ref "$exclude" words cword cur @@ -448,7 +451,7 @@ _get_cword() local old_size="${#cur}" cur="${cur#${words[i]}}" local new_size="${#cur}" - index=$(( index - old_size + new_size )) + (( index -= old_size - new_size )) fi done @@ -553,12 +556,11 @@ _filedir() _tilde "$cur" || return local -a toks - local x tmp + local x reset - x=$( compgen -d -- "$cur" ) && - while read -r tmp; do - toks+=( "$tmp" ) - done <<< "$x" + reset=$(shopt -po noglob); set -o noglob + toks=( $(compgen -d -- "$cur") ) + IFS=' '; $reset; IFS=$'\n' if [[ "$1" != -d ]]; then local quoted @@ -567,17 +569,16 @@ _filedir() # Munge xspec to contain uppercase version too # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 local xspec=${1:+"!*.@($1|${1^^})"} - x=$( compgen -f -X "$xspec" -- $quoted ) && - while read -r tmp; do - toks+=( "$tmp" ) - done <<< "$x" + reset=$(shopt -po noglob); set -o noglob + toks+=( $(compgen -f -X "$xspec" -- $quoted) ) + IFS=' '; $reset; IFS=$'\n' # 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" + [[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && { + reset=$(shopt -po noglob); set -o noglob + toks+=( $(compgen -f -- $quoted) ) + IFS=' '; $reset; IFS=$'\n' + } fi if [[ ${#toks[@]} -ne 0 ]]; then @@ -616,8 +617,8 @@ _variables() # 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]} ) ) + 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 @@ -628,14 +629,14 @@ _variables() fi else # Complete $var with $variable - COMPREPLY+=( $( compgen -A variable -P '$' -- "${BASH_REMATCH[3]}" ) ) + 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]}" ) ) + 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]}]}" ) @@ -652,7 +653,7 @@ _variables() TZ) cur=/usr/share/zoneinfo/$cur _filedir - for i in ${!COMPREPLY[@]}; do + for i in "${!COMPREPLY[@]}"; do if [[ ${COMPREPLY[i]} == *.tab ]]; then unset 'COMPREPLY[i]' continue @@ -686,7 +687,7 @@ _variables() # _init_completion() { - local exclude= flag outx errx inx OPTIND=1 + local exclude="" flag outx errx inx OPTIND=1 while getopts "n:e:o:i:s" flag "$@"; do case $flag in @@ -739,9 +740,9 @@ _init_completion() # If "bare" redirect, remove also the next word (skip=2). [[ ${words[i]} == $redir ]] && skip=2 || skip=1 words=( "${words[@]:0:i}" "${words[@]:i+skip}" ) - [[ $i -le $cword ]] && cword=$(( cword - skip )) + [[ $i -le $cword ]] && (( cword -= skip )) else - i=$(( ++i )) + (( i++ )) fi done @@ -760,8 +761,7 @@ __parse_options() # Take first found long option, or first one (short) if not found. option= - local -a array - read -a array <<<"$1" + local -a array=( $1 ) for i in "${array[@]}"; do case "$i" in ---*) break ;; @@ -770,7 +770,7 @@ __parse_options() *) break ;; esac done - [[ $option ]] || return + [[ $option ]] || return 0 IFS=$' \t\n' # affects parsing of the regexps below... @@ -792,18 +792,18 @@ __parse_options() # _parse_help() { - eval local cmd=$( quote "$1" ) + eval local cmd=$(quote "$1") local line { case $cmd in -) cat ;; - *) LC_ALL=C "$( dequote "$cmd" )" ${2:---help} 2>&1 ;; + *) LC_ALL=C "$(dequote "$cmd")" ${2:---help} 2>&1 ;; esac } \ | while read -r line; do [[ $line == *([[:blank:]])-* ]] || continue # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc while [[ $line =~ \ - ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do + ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+([,_-]+[A-Z0-9]+)?(\.\.+)?\]? ]]; do line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"} done __parse_options "${line// or /, }" @@ -817,11 +817,11 @@ _parse_help() # _parse_usage() { - eval local cmd=$( quote "$1" ) + eval local cmd=$(quote "$1") local line match option i char { case $cmd in -) cat ;; - *) LC_ALL=C "$( dequote "$cmd" )" ${2:---usage} 2>&1 ;; + *) LC_ALL=C "$(dequote "$cmd")" ${2:---usage} 2>&1 ;; esac } \ | while read -r line; do @@ -850,7 +850,7 @@ _parse_usage() # @param $1 prefix _signals() { - local -a sigs=( $( compgen -P "$1" -A signal "SIG${cur#$1}" ) ) + local -a sigs=( $(compgen -P "$1" -A signal "SIG${cur#$1}") ) COMPREPLY+=( "${sigs[@]/#${1}SIG/${1}}" ) } @@ -865,7 +865,7 @@ _mac_addresses() # - ifconfig on Linux: HWaddr or ether # - ifconfig on FreeBSD: ether # - ip link: link/ether - COMPREPLY+=( $( \ + 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 \ @@ -874,15 +874,15 @@ _mac_addresses() ) ) # ARP cache - COMPREPLY+=( $( { arp -an || ip neigh show; } 2>/dev/null | command 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" ) ) + "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p") ) # /etc/ethers - COMPREPLY+=( $( command sed -ne \ - "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) ) + COMPREPLY+=( $(command sed -ne \ + "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) __ltrim_colon_completions "$cur" } @@ -892,44 +892,51 @@ _configured_interfaces() { if [[ -f /etc/debian_version ]]; then # Debian system - COMPREPLY=( $( compgen -W "$( command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ - /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null )" \ - -- "$cur" ) ) + 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' \ + COMPREPLY=( $(compgen -W "$(printf '%s\n' \ /etc/sysconfig/network/ifcfg-* | \ - command 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 \ + COMPREPLY=( $(compgen -W "$(command ls -B \ /etc/sysconfig/interfaces | \ - command 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' \ + COMPREPLY=( $(compgen -W "$(printf '%s\n' \ /etc/sysconfig/network-scripts/ifcfg-* | \ - command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur") ) fi } # Local IP addresses. +# -4: IPv4 addresses only (default) +# -6: IPv6 addresses only +# -a: All addresses # _ip_addresses() { + local n + case $1 in + -a) n='6\?' ;; + -6) n='6' ;; + esac local PATH=$PATH:/sbin - COMPREPLY+=( $( compgen -W \ - "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | command sed -ne \ - 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne \ - 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ - -- "$cur" ) ) + local addrs=$({ LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | + command sed -e 's/[[:space:]]addr:/ /' -ne \ + "s|.*inet${n}[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p") + COMPREPLY+=( $(compgen -W "$addrs" -- "$cur") ) } # This function completes on available kernels # _kernel_versions() { - COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(command ls /lib/modules)' -- "$cur") ) } # This function completes on all available network interfaces @@ -940,7 +947,7 @@ _available_interfaces() { local PATH=$PATH:/sbin - COMPREPLY=( $( { + COMPREPLY=( $({ if [[ ${1:-} == -w ]]; then iwconfig elif [[ ${1:-} == -a ]]; then @@ -949,9 +956,9 @@ _available_interfaces() ifconfig -a || ip link show fi } 2>/dev/null | awk \ - '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }' ) ) + '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }') ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur") ) } # Echo number of CPUs, falling back to 1 on failure. @@ -959,7 +966,7 @@ _ncpus() { local var=NPROCESSORS_ONLN [[ $OSTYPE == *linux* ]] && var=_$var - local n=$( getconf $var 2>/dev/null ) + local n=$(getconf $var 2>/dev/null) printf %s ${n:-1} } @@ -972,7 +979,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 @@ -1032,11 +1039,11 @@ _expand() [[ $OSTYPE == *@(solaris|aix)* ]] && _pids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pid | command sed 1d )' -- "$cur" )) + COMPREPLY=( $(compgen -W '$(command ps -efo pid | command sed 1d)' -- "$cur") ) } || _pids() { - COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(command ps axo pid=)' -- "$cur") ) } # This function completes on process group IDs. @@ -1044,11 +1051,11 @@ _pids() [[ $OSTYPE == *@(solaris|aix)* ]] && _pgids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pgid | command sed 1d )' -- "$cur" )) + COMPREPLY=( $(compgen -W '$(command ps -efo pgid | command sed 1d)' -- "$cur") ) } || _pgids() { - COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- "$cur" )) + COMPREPLY=( $(compgen -W '$(command ps axo pgid=)' -- "$cur") ) } # This function completes on process names. @@ -1057,14 +1064,14 @@ _pgids() [[ $OSTYPE == *@(solaris|aix)* ]] && _pnames() { - COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps -efo comm | \ - command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) + COMPREPLY=( $(compgen -X '<defunct>' -W '$(command ps -efo comm | \ + command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u)' -- "$cur") ) } || _pnames() { if [[ "$1" == -s ]]; then - COMPREPLY=( $( compgen -X '<defunct>' \ - -W '$( command ps axo comm | command sed -e 1d )' -- "$cur" ) ) + 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 @@ -1072,12 +1079,12 @@ _pnames() # 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 \ + COMPREPLY=( $(compgen -X '<defunct>' -W '$(command ps axo command= | command sed -e \ "s/ .*//" -e \ "s:.*/::" -e \ "s/:$//" -e \ "s/^[[(-]//" -e \ - "s/[])]$//" | sort -u )' -- "$cur" ) ) + "s/[])]$//" | sort -u)' -- "$cur") ) fi } @@ -1086,12 +1093,12 @@ _pnames() _uids() { if type getent &>/dev/null; then - COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(getent passwd | cut -d: -f3)' -- "$cur") ) elif type perl &>/dev/null; then - COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"')' -- "$cur") ) else # make do with /etc/passwd - COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(cut -d: -f3 /etc/passwd)' -- "$cur") ) fi } @@ -1100,13 +1107,12 @@ _uids() _gids() { if type getent &>/dev/null; then - COMPREPLY=( $( compgen -W '$( getent group | cut -d: -f3 )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(getent group | cut -d: -f3)' -- "$cur") ) elif type perl &>/dev/null; then - COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"')' -- "$cur") ) else # make do with /etc/group - COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/group )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(cut -d: -f3 /etc/group)' -- "$cur") ) fi } @@ -1121,9 +1127,9 @@ _xinetd_services() local xinetddir=/etc/xinetd.d if [[ -d $xinetddir ]]; then local IFS=$' \t\n' reset=$(shopt -p nullglob); shopt -s nullglob - local -a svcs=( $( printf '%s\n' $xinetddir/!($_backup_glob) ) ) + local -a svcs=( $(printf '%s\n' $xinetddir/!($_backup_glob)) ) $reset - COMPREPLY+=( $( compgen -W '${svcs[@]#$xinetddir/}' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '${svcs[@]#$xinetddir/}' -- "$cur") ) fi } @@ -1136,17 +1142,18 @@ _services() local IFS=$' \t\n' reset=$(shopt -p nullglob); shopt -s nullglob COMPREPLY=( \ - $( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README) ) ) + $(printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README)) ) $reset - COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \ - awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) ) + COMPREPLY+=( $({ systemctl list-units --full --all || \ + systemctl list-unit-files; } 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 ) ) + COMPREPLY+=( $(initctl list 2>/dev/null | cut -d' ' -f1) ) fi - COMPREPLY=( $( compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur") ) } # This completes on a list of all available service scripts for the @@ -1167,14 +1174,14 @@ _service() else local sysvdirs _sysvdirs - COMPREPLY=( $( compgen -W '`command 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" ) ) + ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur") ) fi } && complete -F _service service _sysvdirs -for svcdir in ${sysvdirs[@]}; do +for svcdir in "${sysvdirs[@]}"; do for svc in $svcdir/!($_backup_glob); do [[ -x $svc ]] && complete -F _service $svc done @@ -1187,16 +1194,16 @@ _modules() { local modpath modpath=/lib/modules/$1 - COMPREPLY=( $( compgen -W "$( command ls -RL $modpath 2>/dev/null | \ - command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command ls -RL $modpath 2>/dev/null | \ + command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p')" -- "$cur") ) } # This function completes on installed modules # _installed_modules() { - COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" lsmod | \ - awk '{if (NR != 1) print $1}' )" -- "$1" ) ) + COMPREPLY=( $(compgen -W "$(PATH="$PATH:/sbin" lsmod | \ + awk '{if (NR != 1) print $1}')" -- "$1") ) } # This function completes on user or user:group format; as for chown and cpio. @@ -1223,9 +1230,9 @@ _usergroup() _allowed_groups "$mycur" else local IFS=$'\n' - COMPREPLY=( $( compgen -g -- "$mycur" ) ) + COMPREPLY=( $(compgen -g -- "$mycur") ) fi - COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) ) + COMPREPLY=( $(compgen -P "$prefix" -W "${COMPREPLY[@]}") ) elif [[ $cur == *:* ]]; then # Completing group after 'user:gr<TAB>'. # Reply with a list of unprefixed groups since readline with split on : @@ -1235,7 +1242,7 @@ _usergroup() _allowed_groups "$mycur" else local IFS=$'\n' - COMPREPLY=( $( compgen -g -- "$mycur" ) ) + COMPREPLY=( $(compgen -g -- "$mycur") ) fi else # Completing a partial 'usernam<TAB>'. @@ -1247,7 +1254,7 @@ _usergroup() _allowed_users "$cur" else local IFS=$'\n' - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) fi fi } @@ -1256,11 +1263,11 @@ _allowed_users() { if _complete_as_root; then local IFS=$'\n' - COMPREPLY=( $( compgen -u -- "${1:-$cur}" ) ) + COMPREPLY=( $(compgen -u -- "${1:-$cur}") ) else local IFS=$'\n ' - COMPREPLY=( $( compgen -W \ - "$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" ) ) + COMPREPLY=( $(compgen -W \ + "$(id -un 2>/dev/null || whoami 2>/dev/null)" -- "${1:-$cur}") ) fi } @@ -1268,11 +1275,11 @@ _allowed_groups() { if _complete_as_root; then local IFS=$'\n' - COMPREPLY=( $( compgen -g -- "$1" ) ) + COMPREPLY=( $(compgen -g -- "$1") ) else local IFS=$'\n ' - COMPREPLY=( $( compgen -W \ - "$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" ) ) + COMPREPLY=( $(compgen -W \ + "$(id -Gn 2>/dev/null || groups 2>/dev/null)" -- "$1") ) fi } @@ -1283,7 +1290,7 @@ _shells() local shell rest while read -r shell rest; do [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=( $shell ) - done 2>/dev/null < /etc/shells + done 2>/dev/null </etc/shells } # This function completes on valid filesystem types @@ -1294,18 +1301,18 @@ _fstypes() if [[ -e /proc/filesystems ]]; then # Linux - fss="$( cut -d$'\t' -f2 /proc/filesystems ) - $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )" + fss="$(cut -d$'\t' -f2 /proc/filesystems) + $(awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null)" else # Generic - fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null ) - $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) - $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) - $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) - $( [[ -d /etc/fs ]] && command ls /etc/fs )" + fss="$(awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null) + $(awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null) + $(awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null) + $(awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null) + $([[ -d /etc/fs ]] && command ls /etc/fs)" fi - [[ -n $fss ]] && COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) ) + [[ -n $fss ]] && COMPREPLY+=( $(compgen -W "$fss" -- "$cur") ) } # Get real command. @@ -1315,12 +1322,12 @@ _fstypes() # - return: True (0) if command found, False (> 0) if not. _realcommand() { - type -P "$1" > /dev/null && { - if type -p realpath > /dev/null; then + type -P "$1" >/dev/null && { + if type -p realpath >/dev/null; then realpath "$(type -P "$1")" - elif type -p greadlink > /dev/null; then + elif type -p greadlink >/dev/null; then greadlink -f "$(type -P "$1")" - elif type -p readlink > /dev/null; then + elif type -p readlink >/dev/null; then readlink -f "$(type -P "$1")" else type -P "$1" @@ -1348,14 +1355,19 @@ _get_first_arg() # This function counts the number of args, excluding options # @param $1 chars Characters out of $COMP_WORDBREAKS which should # NOT be considered word breaks. See __reassemble_comp_words_by_ref. +# @param $2 glob Options whose following argument should not be counted +# @param $3 glob Options that should be counted as args _count_args() { local i cword words __reassemble_comp_words_by_ref "$1" words cword args=1 - for i in "${words[@]:1:cword-1}"; do - [[ "$i" != -* ]] && args=$(($args+1)) + for (( i=1; i < cword; i++ )); do + if [[ ${words[i]} != -* && ${words[i-1]} != $2 || + ${words[i]} == $3 ]]; then + (( args++ )) + fi done } @@ -1363,38 +1375,38 @@ _count_args() # _pci_ids() { - COMPREPLY+=( $( compgen -W \ - "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur") ) } # This function completes on USB IDs # _usb_ids() { - COMPREPLY+=( $( compgen -W \ - "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(PATH="$PATH:/sbin" lsusb | awk '{print $6}')" -- "$cur") ) } # CD device names _cd_devices() { - COMPREPLY+=( $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) ) + COMPREPLY+=( $(compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}") ) } # DVD device names _dvd_devices() { - COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) ) + COMPREPLY+=( $(compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}") ) } # TERM environment variable values _terms() { - COMPREPLY+=( $( compgen -W \ - "$( command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ - 2>/dev/null )" -- "$cur" ) ) - COMPREPLY+=( $( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } \ - | awk '{ print $1 }' | sort -u )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ + 2>/dev/null)" -- "$cur") ) + COMPREPLY+=( $(compgen -W "$({ toe -a 2>/dev/null || toe 2>/dev/null; } \ + | awk '{ print $1 }' | sort -u)" -- "$cur") ) } # a little help for FreeBSD ports users @@ -1412,7 +1424,7 @@ _user_at_host() if [[ $cur == *@* ]]; then _known_hosts_real "$cur" else - COMPREPLY=( $( compgen -u -S @ -- "$cur" ) ) + COMPREPLY=( $(compgen -u -S @ -- "$cur") ) compopt -o nospace fi } @@ -1434,15 +1446,16 @@ _known_hosts() } # _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 +# This function looks for the "Include" keyword in ssh config files and +# includes them recursively, adding each result to the config variable. _included_ssh_config_files() { - [[ $# -lt 1 ]] && echo "error: $FUNCNAME: missing mandatory argument CONFIG" + [[ $# -lt 1 ]] && \ + echo "bash_completion: $FUNCNAME: missing mandatory argument CONFIG" >&2 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 + 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 @@ -1482,9 +1495,9 @@ _included_ssh_config_files() # Return: Completions, starting with CWORD, are added to COMPREPLY[] _known_hosts_real() { - local configfile flag prefix - local cur curd awkcur user suffix aliases i host ipv4 ipv6 - local -a kh khd config + local configfile flag prefix OIFS=$IFS + local cur user suffix aliases i host ipv4 ipv6 + local -a kh tmpkh khd config # TODO remove trailing %foo from entries @@ -1499,10 +1512,12 @@ _known_hosts_real() 6) ipv6=1 ;; esac done - [[ $# -lt $OPTIND ]] && echo "error: $FUNCNAME: missing mandatory argument CWORD" - cur=${!OPTIND}; let "OPTIND += 1" - [[ $# -ge $OPTIND ]] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\ - $(while [[ $# -ge $OPTIND ]]; do printf '%s\n' ${!OPTIND}; shift; done) + [[ $# -lt $OPTIND ]] && \ + echo "bash_completion: $FUNCNAME: missing mandatory argument CWORD" >&2 + cur=${!OPTIND}; (( OPTIND += 1 )) + [[ $# -ge $OPTIND ]] && \ + echo "bash_completion: $FUNCNAME($*): unprocessed arguments:" \ + $(while [[ $# -ge $OPTIND ]]; do printf '%s\n' ${!OPTIND}; shift; done) >&2 [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@} kh=() @@ -1523,13 +1538,12 @@ _known_hosts_real() # Known hosts files from configs if [[ ${#config[@]} -gt 0 ]]; then - local OIFS=$IFS IFS=$'\n' j - local -a tmpkh + local IFS=$'\n' j # expand paths (if present) to global and user known hosts files # TODO(?): try to make known hosts files with more than one consecutive # spaces in their name work (watch out for ~ expansion # breakage! Alioth#311595) - tmpkh=( $( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u ) ) + tmpkh=( $(awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u) ) IFS=$OIFS for i in "${tmpkh[@]}"; do # First deal with quoted entries... @@ -1561,35 +1575,31 @@ _known_hosts_real() # If we have known_hosts files to use if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then - # Escape slashes and dots in paths for awk - awkcur=${cur//\//\\\/} - awkcur=${awkcur//\./\\\.} - curd=$awkcur - - if [[ "$awkcur" == [0-9]*[.:]* ]]; then - # Digits followed by a dot or a colon - just search for that - awkcur="^$awkcur[.:]*" - elif [[ "$awkcur" == [0-9]* ]]; then - # Digits followed by no dot or colon - search for digits followed - # by a dot or a colon - awkcur="^$awkcur.*[.:]" - elif [[ -z $awkcur ]]; then - # A blank - search for a dot, a colon, or an alpha character - awkcur="[a-z.:]" - else - awkcur="^$awkcur" - fi - if [[ ${#kh[@]} -gt 0 ]]; then - # FS needs to look for a comma separated list - COMPREPLY+=( $( awk 'BEGIN {FS=","} - /^\s*[^|\#]/ { - sub("^@[^ ]+ +", ""); \ - sub(" .*$", ""); \ - for (i=1; i<=NF; ++i) { \ - sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ - if ($i !~ /[*?]/ && $i ~ /'"$awkcur"'/) {print $i} \ - }}' "${kh[@]}" 2>/dev/null ) ) + # https://man.openbsd.org/sshd.8#SSH_KNOWN_HOSTS_FILE_FORMAT + for i in "${kh[@]}"; do + while read -ra tmpkh; do + set -- "${tmpkh[@]}" + # Skip entries starting with | (hashed) and # (comment) + [[ $1 == [\|\#]* ]] && continue + # Ignore leading @foo (markers) + [[ $1 == @* ]] && shift + # Split entry on commas + local IFS=, + for host in $1; do + # Skip hosts containing wildcards + [[ $host == *[*?]* ]] && continue + # Remove leading [ + host="${host#[}" + # Remove trailing ] + optional :port + host="${host%]?(:+([0-9]))}" + # Add host to candidates + COMPREPLY+=( $host ) + done + IFS=$OIFS + done <"$i" + done + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) fi if [[ ${#khd[@]} -gt 0 ]]; then # Needs to look for files called @@ -1597,7 +1607,7 @@ _known_hosts_real() # dont fork any processes, because in a cluster environment, # there can be hundreds of hostkeys for i in "${khd[@]}" ; do - if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then + if [[ "$i" == *key_22_$cur*.pub && -r "$i" ]]; then host=${i/#*key_22_/} host=${host/%.pub/} COMPREPLY+=( $host ) @@ -1613,9 +1623,9 @@ _known_hosts_real() # append any available aliases from ssh config files if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then - local hosts=$( command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" ) - COMPREPLY+=( $( compgen -P "$prefix$user" \ - -S "$suffix" -W "$hosts" -- "$cur" ) ) + local hosts=$(command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}") + COMPREPLY+=( $(compgen -P "$prefix$user" \ + -S "$suffix" -W "$hosts" -- "$cur") ) fi # Add hosts reported by avahi-browse, if desired and it's available. @@ -1626,21 +1636,21 @@ _known_hosts_real() # if it contains ";", it may mistify the result. But on Gentoo (at # least), -k wasn't available (even if mentioned in the manpage) some # time ago, so... - COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \ - "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \ - awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -P "$prefix$user" -S "$suffix" -W \ + "$(avahi-browse -cpr _workstation._tcp 2>/dev/null | \ + awk -F';' '/^=/ { print $7 }' | sort -u)" -- "$cur") ) fi # Add hosts reported by ruptime. - COMPREPLY+=( $( compgen -W \ - "$( ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }' )" \ - -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }')" \ + -- "$cur") ) # Add results of normal hostname completion, unless # `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value. if [[ -n ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then COMPREPLY+=( - $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) ) + $(compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur") ) fi if [[ $ipv4 ]]; then @@ -1650,7 +1660,7 @@ _known_hosts_real() COMPREPLY=( "${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}" ) fi if [[ $ipv4 || $ipv6 ]]; then - for i in ${!COMPREPLY[@]}; do + for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} ]] || unset -v COMPREPLY[i] done fi @@ -1658,7 +1668,7 @@ _known_hosts_real() __ltrim_colon_completions "$prefix$user$cur" } # _known_hosts_real() -complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \ +complete -F _known_hosts traceroute traceroute6 \ fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount # This meta-cd function observes the CDPATH variable, so that cd additionally @@ -1687,7 +1697,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 @@ -1766,21 +1776,21 @@ _command_offset() if [[ $COMP_CWORD -eq 0 ]]; then local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + COMPREPLY=( $(compgen -d -c -- "$cur") ) else local cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]} - local cspec=$( complete -p $cmd 2>/dev/null ) + local cspec=$(complete -p $cmd 2>/dev/null) # If we have no completion for $cmd yet, see if we have for basename if [[ ! $cspec && $cmd == */* ]]; then - cspec=$( complete -p ${cmd##*/} 2>/dev/null ) + cspec=$(complete -p ${cmd##*/} 2>/dev/null) [[ $cspec ]] && compcmd=${cmd##*/} fi # If still nothing, just load it for the basename if [[ ! $cspec ]]; then compcmd=${cmd##*/} _completion_loader $compcmd - cspec=$( complete -p $compcmd 2>/dev/null ) + cspec=$(complete -p $compcmd 2>/dev/null) fi if [[ -n $cspec ]]; then @@ -1809,7 +1819,7 @@ _command_offset() else cspec=${cspec#complete} cspec=${cspec%%$compcmd} - COMPREPLY=( $( eval compgen "$cspec" -- '$cur' ) ) + COMPREPLY=( $(eval compgen "$cspec" -- '$cur') ) fi elif [[ ${#COMPREPLY[@]} -eq 0 ]]; then # XXX will probably never happen as long as completion loader loads @@ -1818,8 +1828,8 @@ _command_offset() fi fi } -complete -F _command aoss command do else eval exec ltrace nice nohup padsp \ - then time tsocks vsound xargs +complete -F _command aoss command "do" else eval exec ltrace nice nohup padsp \ + "then" time tsocks vsound xargs _root_command() { @@ -1844,17 +1854,17 @@ _longopt() --help|--usage|--version) return ;; - --*dir*) + --!(no-*)dir*) _filedir -d return ;; - --*file*|--*path*) + --!(no-*)@(file|path)*) _filedir return ;; --+([-a-z0-9_])) - local argtype=$( LC_ALL=C $1 --help 2>&1 | command sed -ne \ - "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" ) + 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 @@ -1871,14 +1881,16 @@ _longopt() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \ - command sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(LC_ALL=C $1 --help 2>&1 | \ + while read -r line; do \ + [[ $line =~ --[-A-Za-z0-9]+=? ]] && \ + printf '%s\n' ${BASH_REMATCH[0]} + done)" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace - elif [[ "$1" == @(rmdir|chroot) ]]; then + elif [[ "$1" == *@(rmdir|chroot) ]]; then _filedir -d else - [[ "$1" == mkdir ]] && compopt -o nospace + [[ "$1" == *mkdir ]] && compopt -o nospace _filedir fi } @@ -1890,7 +1902,12 @@ complete -F _longopt a2ps awk base64 bash bc bison cat chroot colordiff cp \ sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \ texindex touch tr uname unexpand uniq units vdir wc who -declare -A _xspecs +# declare only knows -g in bash >= 4.2. +if [[ ${BASH_VERSINFO[0]} -gt 4 || ${BASH_VERSINFO[1]} -ge 2 ]]; then + declare -Ag _xspecs +else + declare -A _xspecs +fi _filedir_xspec() { local cur prev words cword @@ -1927,6 +1944,13 @@ _filedir_xspec() } )) + # Try without filter if it failed to produce anything and configured to + [[ -n ${COMP_FILEDIR_FALLBACK:-} && ${#toks[@]} -lt 1 ]] && { + local reset=$(shopt -po noglob); set -o noglob + toks+=( $(compgen -f -- "$(quote_readline "$cur")") ) + IFS=' '; $reset; IFS=$'\n' + } + if [[ ${#toks[@]} -ne 0 ]]; then compopt -o filenames COMPREPLY=( "${toks[@]}" ) @@ -1937,13 +1961,13 @@ _install_xspec() { local xspec=$1 cmd shift - for cmd in $@; do + for cmd in "$@"; do _xspecs[$cmd]=$xspec done } # 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|[egjsw]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 '!*.@(zip|[egjswx]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|whl)' 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 @@ -1961,15 +1985,15 @@ _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 '!*.@(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|xz|XZ)))' okular _install_xspec '!*.pdf' epdfview pdfunite _install_xspec '!*.@(cb[rz7t]|djv?(u)|?(e)ps|pdf)' zathura _install_xspec '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr _install_xspec '!*.texi*' makeinfo texi2html _install_xspec '!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi xetex xelatex luatex lualatex _install_xspec '!*.mp3' mpg123 mpg321 madplay -_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|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[agmv]|OG[AGMV]|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 '!*@(.@(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[agmv]|OG[AGMV]|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))?(.@(crdownload|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[agmv]|OG[AGMV]|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))?(.@(crdownload|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 @@ -1983,7 +2007,6 @@ _install_xspec '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|as _install_xspec '!*.@(zip|z|gz|tgz)' bzme # konqueror not here on purpose, it's more than a web/html browser _install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx galeon dillo elinks amaya epiphany -_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL])|[pP][dD][fF])' firefox mozilla-firefox iceweasel google-chrome chromium-browser _install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)' oowriter lowriter _install_xspec '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)' ooimpress loimpress _install_xspec '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)' oocalc localc @@ -2018,6 +2041,7 @@ __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 + [[ -n $cmd ]] || return 1 for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do dirs+=( $dir/bash-completion/completions ) done @@ -2030,6 +2054,7 @@ __load_completion() fi for dir in "${dirs[@]}"; do + [[ -d "$dir" ]] || continue for compfile in "$cmd" "$cmd.bash" "_$cmd"; do compfile="$dir/$compfile" # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 diff --git a/bash_completion.sh.in b/bash_completion.sh.in index 4e410d4a..a28e1a62 100644 --- a/bash_completion.sh.in +++ b/bash_completion.sh.in @@ -1,5 +1,5 @@ # Check for interactive bash and that we haven't already been sourced. -if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then +if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then # Check for recent enough version of bash. if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ diff --git a/completions/.gitignore b/completions/.gitignore index c0b4c044..06f8d013 100644 --- a/completions/.gitignore +++ b/completions/.gitignore @@ -1,5 +1,5 @@ 7za -aclocal-1.1[012345] +aclocal-1.1[0123456] alpine alternatives animate @@ -8,7 +8,7 @@ aptitude-curses arm-koji asciidoc.py autoheader -automake-1.1[012345] +automake-1.1[0123456] autossh autoupdate bsdtar @@ -17,6 +17,8 @@ btdownloadgui.py c++ cc cdrecord +chrome +chromium ci ciptool civclient @@ -41,34 +43,49 @@ dpkg-reconfigure dropdb dropuser edquota +etherwake f77 f95 filebucket +freeciv-gtk2 +freeciv-gtk3 freeciv-sdl freeciv-xaw g++ +g++-[5678] g4 g77 g95 +gcc-[5678] +gccgo +gccgo-[5678] gcj geoiplookup6 gfortran +gfortran-[5678] gkrellm2 gmake gmplayer gnumake +google-chrome +google-chrome-stable gpc +gpgv2 hciattach hciconfig hd host hping hping3 +iceweasel identify ifdown +ifquery ifstatus import +inotifywatch insmod.static +iperf3 javac javadoc kplayer @@ -81,6 +98,7 @@ ldapmodify ldapmodrdn ldappasswd ldapwhoami +links2 lintian-info lusermod lvchange @@ -102,6 +120,7 @@ micropython mkisofs mogrify montage +mozilla-firefox mplayer2 msgsnarf muttng @@ -137,14 +156,16 @@ pvremove pvs pvscan pxz +py.test py.test-[23] pydoc3 pylint-[23] +pytest-[23] python2 python3 pypy pypy3 -pyvenv-3.[45] +pyvenv-3.[45678] qemu-kvm qemu-system-i386 qemu-system-x86_64 diff --git a/completions/2to3 b/completions/2to3 index 4dd29bf4..049ba65b 100644 --- a/completions/2to3 +++ b/completions/2to3 @@ -10,12 +10,12 @@ _2to3() return ;; -f|--fix|-x|--nofix) - COMPREPLY=( $( compgen -W \ - "$( $1 --list-fixes 2>/dev/null | command sed -e 1d )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + "$($1 --list-fixes 2>/dev/null | command sed -e 1d)" -- "$cur") ) return ;; -j|--processes) - COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) return ;; -o|--output-dir) @@ -27,7 +27,7 @@ _2to3() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/7z b/completions/7z index 5599b708..96a64f1f 100644 --- a/completions/7z +++ b/completions/7z @@ -6,7 +6,7 @@ _7z() _init_completion -n = || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'a b d e l t u x' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'a b d e l t u x' -- "$cur") ) return fi @@ -15,7 +15,7 @@ _7z() case $cur in -ao*) - COMPREPLY=( $( compgen -P${cur:0:3} -W 'a s t u' -- "${cur:3}" ) ) + COMPREPLY=( $(compgen -P${cur:0:3} -W 'a s t u' -- "${cur:3}") ) return ;; -?(a)[ix]*) @@ -26,58 +26,54 @@ _7z() opt=${cur:0:2} cur=${cur:2} fi if [[ $cur != *[@\!]* ]]; then - COMPREPLY=( $( compgen -P$opt -W '@ ! r@ r-@ r0@ r! r-! r0!' \ - -- "$cur" ) ) + 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" + local IFS=$' \t\n' reset=$(shopt -po noglob); set -o noglob + COMPREPLY=( $(compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}") ) + $reset compopt -o filenames fi return ;; -mhe=*|-mhc=*|-ms=*|-mt=*) - COMPREPLY=( $( compgen -W 'on off' -- "${cur#*=}" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "${cur#*=}") ) return ;; -mx=*) - COMPREPLY=( $( compgen -W '0 1 3 5 7 9' -- "${cur#*=}" ) ) + 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" + local IFS=$' \t\n' reset=$(shopt -po noglob); set -o noglob + COMPREPLY=( $(compgen -P${cur:0:2} -S/ -d -- "${cur:2}") ) + $reset compopt -o nospace -o filenames return ;; -r?*) - COMPREPLY=( $( compgen -P${cur:0:2} -W '- 0' -- "${cur:2}" ) ) + 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}" ) ) + COMPREPLY=( $(compgen -P${cur:0:4} -W 'UTF-8 WIN DOS' \ + -- "${cur:4}") ) return ;; -ssc?*) - COMPREPLY=( $( compgen -P${cur:0:4} -W '-' -- "${cur:4}" ) ) + 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}" ) ) + 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 + 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}" ) ) + -- "${cur:2}") ) fi return ;; @@ -87,9 +83,9 @@ _7z() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-ai -an -ao -ax -bd -i -m{x,s,f,he,hc,mt}= + 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" ) ) + -- "$cur") ) [[ $COMPREPLY == -@(an|bd|sfx|si|slt|so|ssc|[rwy]) ]] || compopt -o nospace return @@ -99,15 +95,23 @@ _7z() _count_args = if [[ $args -eq 2 ]]; then _filedir_xspec unzip + # TODO: parsing 7z i output? + # - how to figure out if the format is input or output? + # - find string Formats:, read until next empty line + # - extensions start from column 26 + # - ignore everything in parens + # - terminate on two spaces + # - terminate on token containing anything [^a-z0-9] + # (assumption: extensions are all lowercase) [[ $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)' + _filedir '@(7z|arj|bz2|cab|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|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]} \ + 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" ) ) + 2>/dev/null | tail -n+2))" -- "$cur") ) compopt -o filenames else _filedir diff --git a/completions/Makefile.am b/completions/Makefile.am index e442a9e6..94cca466 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -5,7 +5,7 @@ bashcomp_DATA = 2to3 \ abook \ aclocal \ acpi \ - adb \ + _adb \ add_members \ alias \ ant \ @@ -16,6 +16,7 @@ bashcomp_DATA = 2to3 \ apt-get \ aptitude \ arch \ + arp \ arping \ arpspoof \ asciidoc \ @@ -48,8 +49,10 @@ bashcomp_DATA = 2to3 \ _chfn \ chgrp \ chkconfig \ + chmod \ chown \ chpasswd \ + chromium-browser \ chronyc \ chrpath \ _chsh \ @@ -76,6 +79,7 @@ bashcomp_DATA = 2to3 \ dhclient \ dict \ _dmesg \ + dnssec-keygen \ dnsspoof \ dot \ dpkg \ @@ -87,6 +91,7 @@ bashcomp_DATA = 2to3 \ e2freefrag \ e2label \ ebtables \ + ecryptfs-migrate-home \ _eject \ eog \ ether-wake \ @@ -103,9 +108,11 @@ bashcomp_DATA = 2to3 \ filesnarf \ find \ find_member \ + fio \ + firefox \ flake8 \ freebsd-update \ - freeciv-gtk2 \ + freeciv \ freeciv-server \ function \ fusermount \ @@ -123,9 +130,11 @@ bashcomp_DATA = 2to3 \ gnatmake \ gnokii \ gnome-mplayer \ + gnome-screenshot \ gpasswd \ gpg \ gpg2 \ + gpgv \ gphoto2 \ gprof \ groupadd \ @@ -143,14 +152,17 @@ bashcomp_DATA = 2to3 \ hping2 \ htop \ htpasswd \ + hunspell \ _hwclock \ iconv \ id \ idn \ + ifstat \ iftop \ ifup \ info \ inject \ + inotifywait \ insmod \ installpkg \ interdiff \ @@ -163,6 +175,7 @@ bashcomp_DATA = 2to3 \ iptables \ ipv6calc \ iscsiadm \ + isort \ isql \ iwconfig \ iwlist \ @@ -172,9 +185,12 @@ bashcomp_DATA = 2to3 \ jarsigner \ java \ javaws \ + jq \ jpegoptim \ jps \ jshint \ + json_xs \ + jsonschema \ k3b \ kcov \ kill \ @@ -198,6 +214,7 @@ bashcomp_DATA = 2to3 \ list_members \ list_owners \ _look \ + locale-gen \ lpq \ lpr \ lrzip \ @@ -234,8 +251,8 @@ bashcomp_DATA = 2to3 \ modprobe \ _modules \ monodevelop \ - mount \ - mount.linux \ + _mount \ + _mount.linux \ mplayer \ mr \ msynctool \ @@ -246,6 +263,7 @@ bashcomp_DATA = 2to3 \ munin-update \ mussh \ mutt \ + mypy \ mysql \ mysqladmin \ nc \ @@ -259,8 +277,10 @@ bashcomp_DATA = 2to3 \ _nmcli \ nproc \ nslookup \ + nsupdate \ ntpdate \ oggdec \ + op \ openssl \ opera \ optipng \ @@ -270,6 +290,7 @@ bashcomp_DATA = 2to3 \ patch \ pdftotext \ perl \ + perlcritic \ perltidy \ pgrep \ pidof \ @@ -305,11 +326,12 @@ bashcomp_DATA = 2to3 \ pwd \ pwdx \ pwgen \ - py.test \ pycodestyle \ pydoc \ + pydocstyle \ pyflakes \ pylint \ + pytest \ python \ pyvenv \ qdbus \ @@ -343,7 +365,9 @@ bashcomp_DATA = 2to3 \ sbcl \ sbopkg \ screen \ + scrub \ sh \ + shellcheck \ sitecopy \ slackpkg \ slapt-get \ @@ -384,8 +408,9 @@ bashcomp_DATA = 2to3 \ tshark \ tune2fs \ _udevadm \ - umount \ - umount.linux \ + ulimit \ + _umount \ + _umount.linux \ unace \ unpack200 \ unrar \ @@ -418,7 +443,7 @@ bashcomp_DATA = 2to3 \ xfreerdp \ xgamma \ xhost \ - xm \ + _xm \ xmllint \ xmlwf \ xmms \ @@ -445,6 +470,7 @@ CLEANFILES = \ aclocal-1.13 \ aclocal-1.14 \ aclocal-1.15 \ + aclocal-1.16 \ alpine \ alternatives \ animate \ @@ -459,6 +485,7 @@ CLEANFILES = \ automake-1.13 \ automake-1.14 \ automake-1.15 \ + automake-1.16 \ autossh \ autoupdate \ bsdtar \ @@ -467,6 +494,8 @@ CLEANFILES = \ c++ \ cc \ cdrecord \ + chrome \ + chromium \ ci \ ciptool \ civclient \ @@ -491,34 +520,61 @@ CLEANFILES = \ dropdb \ dropuser \ edquota \ + etherwake \ f77 \ f95 \ filebucket \ + freeciv-gtk2 \ + freeciv-gtk3 \ freeciv-sdl \ freeciv-xaw \ g++ \ + g++-5 \ + g++-6 \ + g++-7 \ + g++-8 \ g4 \ g77 \ g95 \ + gcc-5 \ + gcc-6 \ + gcc-7 \ + gcc-8 \ + gccgo \ + gccgo-5 \ + gccgo-6 \ + gccgo-7 \ + gccgo-8 \ gcj \ geoiplookup6 \ gfortran \ + gfortran-5 \ + gfortran-6 \ + gfortran-7 \ + gfortran-8 \ gkrellm2 \ gmake \ gmplayer \ gnumake \ + google-chrome \ + google-chrome-stable \ gpc \ + gpgv2 \ hciattach \ hciconfig \ hd \ host \ hping \ hping3 \ + iceweasel \ identify \ ifdown \ + ifquery \ ifstatus \ import \ + inotifywatch \ insmod.static \ + iperf3 \ javac \ javadoc \ kplayer \ @@ -531,6 +587,7 @@ CLEANFILES = \ ldapmodrdn \ ldappasswd \ ldapwhoami \ + links2 \ lintian-info \ lusermod \ lvchange \ @@ -552,6 +609,7 @@ CLEANFILES = \ mkisofs \ mogrify \ montage \ + mozilla-firefox \ mplayer2 \ msgsnarf \ muttng \ @@ -587,6 +645,7 @@ CLEANFILES = \ pvs \ pvscan \ pxz \ + py.test \ py.test-2 \ py.test-3 \ pydoc3 \ @@ -594,10 +653,15 @@ CLEANFILES = \ pylint-3 \ pypy \ pypy3 \ + pytest-2 \ + pytest-3 \ python2 \ python3 \ pyvenv-3.4 \ pyvenv-3.5 \ + pyvenv-3.6 \ + pyvenv-3.7 \ + pyvenv-3.8 \ qemu-kvm \ qemu-system-i386 \ qemu-system-x86_64 \ @@ -666,7 +730,7 @@ symlinks: $(targetdir) $(DATA) $(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 \ + aclocal-1.14 aclocal-1.15 aclocal-1.16 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) aclocal $(targetdir)/$$file ; \ done @@ -683,7 +747,7 @@ symlinks: $(targetdir) $(DATA) $(LN_S) asciidoc $(targetdir)/$$file ; \ done for file in automake-1.10 automake-1.11 automake-1.12 automake-1.13 \ - automake-1.14 automake-1.15 ; do \ + automake-1.14 automake-1.15 automake-1.16 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) automake $(targetdir)/$$file ; \ done @@ -711,6 +775,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) cardctl $(targetdir)/$$file ; \ done + for file in google-chrome google-chrome-stable chromium chrome; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) chromium-browser $(targetdir)/$$file ; \ + done for file in compgen ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) complete $(targetdir)/$$file ; \ @@ -732,13 +800,22 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) dpkg $(targetdir)/$$file ; \ done + for file in etherwake ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ether-wake $(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 \ + for file in iceweasel mozilla-firefox ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) freeciv-gtk2 $(targetdir)/$$file ; \ + $(LN_S) firefox $(targetdir)/$$file ; \ + done + for file in civclient freeciv-gtk2 freeciv-gtk3 freeciv-sdl \ + freeciv-xaw ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv $(targetdir)/$$file ; \ done for file in civserver ; do \ rm -f $(targetdir)/$$file && \ @@ -748,7 +825,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) function $(targetdir)/$$file ; \ done - for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \ + for file in cc c++ g++ g++-5 g++-6 g++-7 g++-8 gfortran gfortran-5 \ + gfortran-6 gfortran-7 gfortran-8 f77 g77 f95 g95 gcj gpc \ + gccgo gccgo-5 gccgo-6 gccgo-7 gccgo-8 gcc-5 gcc-6 gcc-7 \ + gcc-8 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) gcc $(targetdir)/$$file ; \ done @@ -764,6 +844,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) gkrellm $(targetdir)/$$file ; \ done + for file in gpgv2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gpgv $(targetdir)/$$file ; \ + done for file in pigz ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) gzip $(targetdir)/$$file ; \ @@ -781,7 +865,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) hping2 $(targetdir)/$$file ; \ done - for file in ifdown ifstatus ; do \ + for file in ifdown ifquery ifstatus ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) ifup $(targetdir)/$$file ; \ done @@ -789,10 +873,18 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) info $(targetdir)/$$file ; \ done + for file in inotifywatch ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) inotifywait $(targetdir)/$$file ; \ + done for file in insmod.static ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) insmod $(targetdir)/$$file ; \ done + for file in iperf3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) iperf $(targetdir)/$$file ; \ + done for file in javac javadoc ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) java $(targetdir)/$$file ; \ @@ -806,6 +898,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) ldapsearch $(targetdir)/$$file ; \ done + for file in links2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) links $(targetdir)/$$file ; \ + done for file in lintian-info ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) lintian $(targetdir)/$$file ; \ @@ -900,9 +996,9 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) puppet $(targetdir)/$$file ; \ done - for file in py.test-2 py.test-3 ; do \ + for file in pytest-2 pytest-3 py.test py.test-2 py.test-3 ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) py.test $(targetdir)/$$file ; \ + $(LN_S) pytest $(targetdir)/$$file ; \ done for file in pydoc3 ; do \ rm -f $(targetdir)/$$file && \ @@ -916,7 +1012,8 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) python $(targetdir)/$$file ; \ done - for file in pyvenv-3.4 pyvenv-3.5 ; do \ + for file in pyvenv-3.4 pyvenv-3.5 pyvenv-3.6 pyvenv-3.7 \ + pyvenv-3.8 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) pyvenv $(targetdir)/$$file ; \ done @@ -993,13 +1090,13 @@ symlinks: $(targetdir) $(DATA) all-local: targetdir = . all-local: symlinks -install-data-local: targetdir = $(DESTDIR)$(bashcompdir) -install-data-local: symlinks +install-data-hook: targetdir = $(DESTDIR)$(bashcompdir) +install-data-hook: symlinks check-local: ret=0 for file in $(bashcomp_DATA) ; do \ $${bashcomp_bash:-$${BASH:-bash}} \ - -O extglob -n $$file || ret=$$? ; \ + -O extglob -n $(srcdir)/$$file || ret=$$? ; \ done ; \ exit $$ret diff --git a/completions/_adb b/completions/_adb new file mode 100644 index 00000000..52b2cb96 --- /dev/null +++ b/completions/_adb @@ -0,0 +1,69 @@ +# adb completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# the Android SDK, use that instead. + +_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/_cal b/completions/_cal index dfe49903..9aefa704 100644 --- a/completions/_cal +++ b/completions/_cal @@ -11,7 +11,7 @@ _cal() case $prev in -m) if [[ $OSTYPE == *bsd* ]]; then - COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..12}' -- "$cur") ) return fi ;; @@ -24,13 +24,13 @@ _cal() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi local args _count_args - [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) + [[ $args -eq 1 ]] && COMPREPLY=( $(compgen -W '{1..12}' -- "$cur") ) } && complete -F _cal cal ncal diff --git a/completions/_chsh b/completions/_chsh index 88e8522e..48473fe8 100644 --- a/completions/_chsh +++ b/completions/_chsh @@ -19,7 +19,7 @@ _chsh() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _allowed_users fi diff --git a/completions/_dmesg b/completions/_dmesg index 2ca7fdf1..1dff7db2 100644 --- a/completions/_dmesg +++ b/completions/_dmesg @@ -15,19 +15,18 @@ _dmesg() return ;; -f|--facility) - COMPREPLY=( $( compgen -W 'kern user mail daemon auth syslog lpr - news' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'kern user mail daemon auth syslog lpr + news' -- "$cur") ) return ;; -l|--level|-n|--console-level) - COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..8}' -- "$cur") ) return ;; esac - local opts=$( _parse_help "$1" ) - [[ $opts ]] || opts=$( _parse_usage "$1" ) - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) } && complete -F _dmesg dmesg diff --git a/completions/_eject b/completions/_eject index 8f800f15..3c5838dc 100644 --- a/completions/_eject +++ b/completions/_eject @@ -13,13 +13,13 @@ _eject() return ;; -a|--auto|-i|--manualeject) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return elif [[ $prev == @(-d|--default) ]]; then return diff --git a/completions/_hexdump b/completions/_hexdump index ed5cb08b..a3c2a839 100644 --- a/completions/_hexdump +++ b/completions/_hexdump @@ -19,9 +19,8 @@ _hexdump() esac if [[ $cur == -* ]]; then - local opts="$( _parse_help "$1" )" - [[ $opts ]] || opts="$( _parse_usage "$1" )" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts="$(_parse_help "$1")" + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) return fi diff --git a/completions/_hwclock b/completions/_hwclock index 2d190283..86a29346 100644 --- a/completions/_hwclock +++ b/completions/_hwclock @@ -19,7 +19,7 @@ _hwclock() esac COMPREPLY=( - $( PATH="$PATH:/sbin" compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + $(PATH="$PATH:/sbin" compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _hwclock hwclock diff --git a/completions/_ionice b/completions/_ionice index 9b378ee8..1aa51f2a 100644 --- a/completions/_ionice +++ b/completions/_ionice @@ -37,11 +37,11 @@ _ionice() case $prev in -c) - COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..3}' -- "$cur") ) return ;; -n) - COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..7}' -- "$cur") ) return ;; -p) @@ -51,7 +51,7 @@ _ionice() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi } && diff --git a/completions/_look b/completions/_look index 6ea41cce..074e924a 100644 --- a/completions/_look +++ b/completions/_look @@ -9,7 +9,7 @@ _look() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur") ) fi } && complete -F _look -o default look diff --git a/completions/_mock b/completions/_mock index 9649d306..e596a4c4 100644 --- a/completions/_mock +++ b/completions/_mock @@ -13,12 +13,12 @@ _mock() for i in "${words[@]}" ; do [[ $count -eq $cword ]] && break - if [[ "$i" == --configdir ]] ; then + if [[ "$i" == --configdir ]]; then cfgdir="${words[((count+1))]}" - elif [[ "$i" == --configdir=* ]] ; then + elif [[ "$i" == --configdir=* ]]; then cfgdir=${i/*=/} fi - count=$((++count)) + (( count++ )) done case $prev in @@ -27,7 +27,7 @@ _mock() return ;; -r|--root) - COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command ls $cfgdir)" -- "$cur") ) COMPREPLY=( ${COMPREPLY[@]/%.cfg/} ) return ;; @@ -44,21 +44,21 @@ _mock() # (e.g. ix86 chroot builds in x86_64 mock host) # This would actually depend on what the target root # can be used to build for... - COMPREPLY=( $( compgen -W "$( command rpm --showrc | \ - command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command rpm --showrc | \ + command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p')" \ + -- "$cur") ) return ;; --enable-plugin|--disable-plugin) - COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$plugins" -- "$cur") ) return ;; esac $split && return - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir '@(?(no)src.r|s)pm' diff --git a/completions/_modules b/completions/_modules index 9e48589b..36fffdf6 100644 --- a/completions/_modules +++ b/completions/_modules @@ -23,22 +23,22 @@ _module_list () { - local modules="$( command sed 's/:/ /g' <<<$LOADEDMODULES | sort )" + local modules="$(command sed 's/:/ /g' <<<$LOADEDMODULES | sort)" compgen -W "$modules" -- $1 } _module_path () { - local modules="$( command sed 's/:/ /g' <<<$MODULEPATH | sort )" + local modules="$(command sed 's/:/ /g' <<<$MODULEPATH | sort)" compgen -W "$modules" -- $1 } _module_avail () { - local modules="$( \ + local modules="$(\ module avail 2>&1 | \ command grep -E -v '^(-|$)' | \ - xargs printf '%s\n' | command sed -e 's/(default)//g' | sort )" + xargs printf '%s\n' | command sed -e 's/(default)//g' | sort)" compgen -W "$modules" -- $1 } @@ -53,8 +53,8 @@ _module () # First parameter on line -- we expect it to be a mode selection local options - options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \ - awk '{print $2}' | command sed -e 's/|/ /g' | sort )" + options="$(module help 2>&1 | command grep -E '^[[:space:]]*\+' | \ + awk '{print $2}' | command sed -e 's/|/ /g' | sort)" COMPREPLY=( $(compgen -W "$options" -- "$cur") ) diff --git a/completions/_mount b/completions/_mount new file mode 100644 index 00000000..494f97ba --- /dev/null +++ b/completions/_mount @@ -0,0 +1,65 @@ +# mount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +if [[ $OSTYPE == *linux* ]]; then + . "$BASH_SOURCE.linux" + return +fi + +# This will pull a list of possible mounts out of +# /etc/{,v}fstab, unless the word being completed contains a ':', which +# would indicate the specification of an NFS server. In that case, we +# query the server for a list of all available exports and complete on +# that instead. +# +_mount() +{ + local cur prev words cword + _init_completion -n : || return + + local sm host + + case $prev in + -t|--types) + _fstypes + return + ;; + esac + + [[ "$cur" == \\ ]] && cur="/" + + if [[ "$cur" == *:* ]]; then + for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do + [[ -x $sm ]] || continue + COMPREPLY=( $(compgen -W "$("$sm" -e ${cur%%:*} | \ + awk 'NR>1 {print $1}')" -- "${cur#*:}") ) + return + done + fi + + if [[ "$cur" == //* ]]; then + host=${cur#//} + host=${host%%/*} + if [[ -n $host ]]; then + COMPREPLY=( $(compgen -P "//$host" -W \ + "$(smbclient -d 0 -NL $host 2>/dev/null | + 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 + # Solaris + COMPREPLY=( $(compgen -W "$(awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab)" -- "$cur") ) + elif [[ ! -e /etc/fstab ]]; then + # probably Cygwin + 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") ) + fi +} && +complete -F _mount -o default -o dirnames mount + +# ex: filetype=sh diff --git a/completions/_mount.linux b/completions/_mount.linux new file mode 100644 index 00000000..c74aaec6 --- /dev/null +++ b/completions/_mount.linux @@ -0,0 +1,248 @@ +# mount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +_mount() +{ + local cur prev words cword + _init_completion -n =: || return + + local split=false + case "$prev" in + -t|--types) + # find /lib/modules/$(uname -r)/ -type f -path '*/fs/*.ko' -printf '%f\n' | cut -d. -f1 + # FIXME: no<fstype> + if [[ "$cur" == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=( $(compgen -W 'auto adfs affs autofs btrfs cifs coda + cramfs davfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus + hpfs iso9660 jffs2 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g + proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs + udf ufs umsdos usbfs vfat xfs' -- "$cur") ) + _fstypes + $split && COMPREPLY=( ${COMPREPLY[@]/#/$prev,} ) + return + ;; + --bind|-B|--rbind|-R) + _filedir -d + return + ;; + -p|--pass-fd) + COMPREPLY=( $(compgen -W '{0..9}') ) + compopt -o nospace + return + ;; + -L) + COMPREPLY=( $(cd "/dev/disk/by-label/" 2>/dev/null || return; \ + compgen -f -- "$cur") ) + return + ;; + -U) + COMPREPLY=( $(cd "/dev/disk/by-uuid/" 2>/dev/null || return; \ + compgen -f -- "$cur") ) + return + ;; + -O|--test-opts) + # argument required but no completions available + return + ;; + -o|--options) + local fstype=auto # default fstype + for (( i=${#words[@]}-1; i>0; i-- )); do + if [[ "${words[i]}" == -@(t|-types)* ]]; then + if [[ "${words[i]}" == *=* ]]; then + [[ "${words[i]}" == ?*,* ]] && break + fstype="${words[i]#-*=}" + else + [[ "${words[i+1]}" == ?*,* ]] && break + fstype="${words[i+1]}" + fi + break + fi + done + # no<fstype> is not a real fstype, reset to "auto" + [[ "$fstype" == no?* ]] && fstype=auto + # split options list + if [[ "$cur" == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + # no completion if $cur is opt=smth + [[ "$cur" == *=* ]] && return + # mount options + COMPREPLY=( $(compgen -W 'loop {,a}sync {,no}atime {,no}auto + {,fs,def,root}context= defaults {,no}dev {,no}diratime dirsync + {,no}exec group {,no}iversion {,no}mand _netdev nofail + {,no}relatime {,no}strictatime {,no}suid owner remount ro rw + {,no}user users' -- "$cur") ) + case "$fstype" in + adfs|auto) + COMPREPLY+=( $(compgen -W '{u,g}id= {own,oth}mask=' -- "$cur") ) + ;;& + affs|auto) + COMPREPLY+=( $(compgen -W '{u,g}id= set{u,g}id= mode= protect + usemp verbose prefix= volume= reserved= root= bs= + {,no,usr,grp}quota' -- "$cur") ) + ;;& + btrfs|auto) + COMPREPLY+=( $(compgen -W 'degraded subvol= subvolid= device= + nodatasum nodatacow nobarrier max_inline= alloc_start= + thread_pool= compress= compress-force= ssd noacl notreelog + flushoncommit metadata_ratio= {,no}space_cache clear_cache + user_subvol_rm_allowed autodefrag inode_cache' -- "$cur") ) + ;;& + cifs|auto) + COMPREPLY+=( $(compgen -W 'user= password= credentials= {u,g}id= + force{u,g}id port= servern= netbiosname= {file,dir}_mode= + ip= domain= guest iocharset {,no}setuids {,no,dyn}perm + directio {,no}mapchars {,no}intr hard soft noacl nocase sec= + nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size= + rwpidforward backup{u,g}id cache=' -- "$cur") ) + ;;& + davfs|auto) + COMPREPLY+=( $(compgen -W 'conf= {file,dir}_mode= {u,g}id= + username=' -- "$cur") ) + ;;& + ext[2-4]|auto) + COMPREPLY+=( $(compgen -W '{,no}acl bsddf minixdf check= debug + errors= {,no}grpid {bsd,sysv}groups {,no,usr,grp}quota + nobh nouid32 oldalloc orlov res{u,g}id= sb= + {,no}user_xattr' -- "$cur") ) + ;;& + ext[34]|auto) + COMPREPLY+=( $(compgen -W 'journal= journal_dev= norecovery + noload data= barrier= commit=' -- "$cur") ) + ;;& + ext4|auto) + COMPREPLY+=( $(compgen -W 'journal_checksum journal_async_commit + nobarrier inode_readahead= stripe= {,no}delalloc abort + {max,min}_batch_time= journal_ioprio= {,no}auto_da_alloc + {,no}discard nouid32 resize {,no}block_validity + dioread_{,no}lock max_dir_size_kb= i_version' -- "$cur") ) + ;;& + msdos|umsdos|vfat|auto) + COMPREPLY+=( $(compgen -W 'blocksize= {u,g}id= {u,d,f}mask= + allow_utime= check= codepage= conv= cvf_format= cvf_option= + debug fat= iocharset= tz= quiet showexec sys_immutable flush + usefree {,no}dots dotsOK=' -- "$cur") ) + ;;& + vfat|auto) + COMPREPLY+=( $(compgen -W 'uni_xlate posix nonumtail utf8 + shortname=' -- "$cur") ) + ;;& + iso9660|auto) + COMPREPLY+=( $(compgen -W 'norock nojoliet check= {u,g}id= map= + mode= unhide block= conv= cruft session= sbsector= + iocharset= utf8' -- "$cur") ) + ;;& + jffs2|auto) + COMPREPLY+=( $(compgen -W 'compr= rp_size=' -- "$cur") ) + ;;& + jfs|auto) + COMPREPLY+=( $(compgen -W 'iocharset= resize= {,no}integrity + errors= {,no,usr,grp}quota' -- "$cur") ) + ;;& + nfs|nfs4|auto) + COMPREPLY+=( $(compgen -W 'soft hard timeo= retrans= {r,w}size= + {,no}ac acreg{min,max}= acdir{min,max}= actimeo= bg fg + retry= sec= {,no}sharecache {,no}resvport lookupcache= + proto= port= {,no}intr {,no}cto {,nfs}vers= ' -- "$cur") ) + ;;& + nfs|auto) + COMPREPLY+=( $(compgen -W 'udp tcp rdma mount{port,proto,host}= + mountvers= namlen={,no}lock {,no}acl {,no}rdirplus + {,no}fsc' -- "$cur") ) + ;;& + nfs4|auto) + COMPREPLY+=( $(compgen -W 'clientaddr= {,no}migration' \ + -- "$cur") ) + ;;& + ntfs-3g) + COMPREPLY+=( $(compgen -W '{u,g}id= {u,f,d}mask= usermapping= + permissions inherit locale= force {,no}recover + ignore_case remove_hiberfile show_sys_files + hide_{hid,dot}_files windows_names allow_other max_read= + silent no_def_opts streams_interface= user_xattr efs_raw + {,no}compression debug no_detach' -- "$cur") ) + ;;& + proc|auto) + COMPREPLY+=( $(compgen -W '{u,g}id=' -- "$cur") ) + ;;& + reiserfs|auto) + COMPREPLY+=( $(compgen -W 'conv hash= {,no_un}hashed_relocation + noborder nolog notail replayonly resize= user_xattr acl + barrier=' -- "$cur") ) + ;;& + tmpfs|auto) + COMPREPLY+=( $(compgen -W 'size= nr_blocks= nr_inodes= mode= + {u,g}id= mpol=' -- "$cur") ) + ;;& + udf|auto) + COMPREPLY+=( $(compgen -W '{u,g}id= umask= unhide undelete + nostrict iocharset bs= novrs session= anchor= volume= + partition= lastblock= fileset= rootdir=' -- "$cur") ) + ;;& + usbfs|auto) + COMPREPLY+=( $(compgen -W 'dev{u,g}id= devmode= bus{u,g}id= + busmode= list{u,g}id= listmode=' -- "$cur") ) + ;;& + xfs|auto) + COMPREPLY+=( $(compgen -W 'allocsize= {,no}attr2 barrier dmapi + {,no}grpid {bsd,sysv}groups ihashsize= {,no}ikeep + inode{32,64} {,no}largeio logbufs= logbsize= logdev= + rtdev= mtpt= noalign norecovery nouuid osyncisosync + {u,g,p}qnoenforce {,u,usr,g,grp,p,prj}quota sunit= swidth= + swalloc' -- "$cur") ) + ;;& + esac + # COMP_WORDBREAKS is a real pain in the ass + prev="${prev##*[$COMP_WORDBREAKS]}" + $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '--version --help --verbose --all --fork + --fake --internal-only -l --no-mtab --no-canonicalize --pass-fd -s + --read-only --rw -L -U --types --test-opts --options --bind --rbind + --move' -- "$cur") ) + [[ $COMPREPLY ]] && return + fi + + [[ "$cur" == \\ ]] && cur="/" + + local sm host + + if [[ "$cur" == *:* ]]; then + for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do + [[ -x $sm ]] || continue + COMPREPLY=( $(compgen -W "$("$sm" -e ${cur%%:*} | \ + awk 'NR>1 {print $1}')" -- "${cur#*:}") ) + return + done + fi + + if [[ "$cur" == //* ]]; then + host=${cur#//} + host=${host%%/*} + if [[ -n $host ]]; then + COMPREPLY=( $(compgen -P "//$host" -W \ + "$(smbclient -d 0 -NL $host 2>/dev/null | + command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | + command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \ + -- "${cur#//$host}") ) + fi + fi + + _filedir +} && +complete -F _mount mount + +# ex: filetype=sh diff --git a/completions/_nmcli b/completions/_nmcli index f77f0505..780a477f 100644 --- a/completions/_nmcli +++ b/completions/_nmcli @@ -5,33 +5,33 @@ _nmcli_list() { - COMPREPLY=( $( compgen -W '$1' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$1' -- "$cur") ) } _nmcli_con_id() { local IFS=$'\n' - COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ - tail -n +2 | awk -F ' {2,}' '{print $1 }')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1 }')" -- "$cur") ) } _nmcli_con_uuid() { - COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ - tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur") ) } _nmcli_ap_ssid() { local IFS=$'\n' - COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ - tail -n +2 | awk -F ' {2,}' '{print $1}')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1}')" -- "$cur") ) } _nmcli_ab_bssid() { - COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ - tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur") ) } _nmcli() @@ -41,11 +41,11 @@ _nmcli() case $prev in -m|--mode) - COMPREPLY=( $( compgen -W 'tabular multiline' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'tabular multiline' -- "$cur") ) return ;; -f|--fields) - COMPREPLY=( $( compgen -W 'all common' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all common' -- "$cur") ) return ;; -e|--escape) @@ -74,12 +74,12 @@ _nmcli() ;; esac - if [[ $cword -eq 1 ]] ; then + if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--terse --pretty --mode --fields - --escape --version --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--terse --pretty --mode --fields + --escape --version --help' -- "$cur") ) else - COMPREPLY=( $( compgen -W "nm con dev" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "nm con dev" -- "$cur") ) fi else local object=${words[1]} @@ -110,50 +110,50 @@ _nmcli() ;; esac - COMPREPLY=( $( compgen -W 'status permissions enable sleep - wifi wwan wimax' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'status permissions enable sleep + wifi wwan wimax' -- "$cur") ) ;; con) case $command in list) - COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'id uuid' -- "$cur") ) return ;; up) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--nowait --timeout' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--nowait --timeout' \ + -- "$cur") ) else - COMPREPLY=( $( compgen -W 'id uuid iface ap nsp' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'id uuid iface ap nsp' \ + -- "$cur") ) fi return ;; down) - COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'id uuid' -- "$cur") ) return ;; delete) - COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'id uuid' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W 'list status up down delete' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'list status up down delete' \ + -- "$cur") ) ;; dev) case $command in list) - COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'iface' -- "$cur") ) return ;; disconnect) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--nowait --timeout' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--nowait --timeout' \ + -- "$cur") ) else - COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'iface' -- "$cur") ) fi return ;; @@ -162,34 +162,34 @@ _nmcli() case $subcommand in list) - COMPREPLY=( $( compgen -W 'iface bssid' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'iface bssid' \ + -- "$cur") ) return ;; connect) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--private - --nowait --timeout' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--private + --nowait --timeout' -- "$cur") ) else if [[ "$prev" == "connect" ]]; then _nmcli_ap_ssid else - COMPREPLY=( $( compgen -W 'password + COMPREPLY=( $(compgen -W 'password wep-key-type iface bssid name' \ - -- "$cur" ) ) + -- "$cur") ) fi fi return ;; esac - COMPREPLY=( $( compgen -W 'list connect' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'list connect' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W 'status list disconnect wifi' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'status list disconnect wifi' \ + -- "$cur") ) ;; esac diff --git a/completions/_renice b/completions/_renice index 1f1a6102..2598533d 100644 --- a/completions/_renice +++ b/completions/_renice @@ -24,7 +24,7 @@ _renice() _pids ;; esac - i=$(( ++i )) + (( i++ )) done } && complete -F _renice renice diff --git a/completions/_repomanage b/completions/_repomanage index c1072e79..ea27f07e 100644 --- a/completions/_repomanage +++ b/completions/_repomanage @@ -12,8 +12,8 @@ _repomanage() $split && return - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir -d diff --git a/completions/_reptyr b/completions/_reptyr index 4a087b49..00cccddd 100644 --- a/completions/_reptyr +++ b/completions/_reptyr @@ -15,7 +15,7 @@ _reptyr() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/_rfkill b/completions/_rfkill index e807d976..a14a3eaf 100644 --- a/completions/_rfkill +++ b/completions/_rfkill @@ -9,18 +9,18 @@ _rfkill() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--version' -- "$cur") ) else case $cword in 1) - COMPREPLY=( $( compgen -W "help event list block unblock" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "help event list block unblock" \ + -- "$cur") ) ;; 2) if [[ $prev == block || $prev == unblock ]]; then - COMPREPLY=( $( compgen -W "$($1 list | awk -F: \ + COMPREPLY=( $(compgen -W "$($1 list | awk -F: \ '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ - wwan gps" -- "$cur" ) ) + wwan gps" -- "$cur") ) fi ;; esac diff --git a/completions/_rtcwake b/completions/_rtcwake index b03c1244..43d264c9 100644 --- a/completions/_rtcwake +++ b/completions/_rtcwake @@ -13,19 +13,19 @@ _rtcwake() return ;; --mode|-m) - COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'standby mem disk on no off' -- "$cur") ) return ;; --device|-d) - COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) ) + COMPREPLY=( $(command ls -d /dev/rtc?* 2>/dev/null) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur") ) return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _rtcwake rtcwake diff --git a/completions/_su b/completions/_su index 2b069498..9c0f59c1 100644 --- a/completions/_su +++ b/completions/_su @@ -21,7 +21,7 @@ _su() # linux-specific completion -c|--command|--session-command) local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + COMPREPLY=( $(compgen -d -c -- "$cur") ) return ;; esac @@ -29,12 +29,12 @@ _su() # linux-specific completion $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _su su diff --git a/completions/_svn b/completions/_svn index 37b6b2b4..42e2dbe7 100644 --- a/completions/_svn +++ b/completions/_svn @@ -16,11 +16,11 @@ _svn() proplist plist pl propset pset ps resolved revert \ status stat st switch sw unlock update up' - if [[ $cword -eq 1 ]] ; then + if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--version' -- "$cur") ) else - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) fi else @@ -34,8 +34,7 @@ _svn() return ;; --encoding) - COMPREPLY=( $( compgen -W '$( iconv --list | \ - command sed -e "s@//@@;" )' -- "$cur" ) ) + _xfunc iconv _iconv_charsets return ;; --editor-cmd|--diff-cmd|--diff3-cmd) @@ -196,10 +195,10 @@ _svn() esac options+=" --help --config-dir" - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else if [[ "$command" == @(help|[h?]) ]]; then - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) else _filedir fi diff --git a/completions/_svnadmin b/completions/_svnadmin index 395ae119..7a86c43e 100644 --- a/completions/_svnadmin +++ b/completions/_svnadmin @@ -12,11 +12,11 @@ _svnadmin() 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 [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--version' -- "$cur") ) else - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) fi else case $prev in @@ -25,7 +25,7 @@ _svnadmin() return ;; --fs-type) - COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'fsfs bdb' -- "$cur") ) return ;; esac @@ -62,10 +62,10 @@ _svnadmin() esac options+=" --help" - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else if [[ "$command" == @(help|[h?]) ]]; then - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) else _filedir fi diff --git a/completions/_svnlook b/completions/_svnlook index a4f34243..2cbd134b 100644 --- a/completions/_svnlook +++ b/completions/_svnlook @@ -12,11 +12,11 @@ _svnlook() 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 [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--version' -- "$cur") ) else - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) fi else local command=${words[1]} @@ -47,10 +47,10 @@ _svnlook() esac options+=" --help" - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else if [[ "$command" == @(help|[h?]) ]]; then - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) else _filedir fi diff --git a/completions/_udevadm b/completions/_udevadm index 80424dca..ce43f1ad 100644 --- a/completions/_udevadm +++ b/completions/_udevadm @@ -24,12 +24,12 @@ _udevadm() return ;; --log-priority) - COMPREPLY=( $( compgen -W 'err info debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'err info debug' -- "$cur") ) return ;; --query) - COMPREPLY=( $( compgen -W 'name symlink path property all' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'name symlink path property all' \ + -- "$cur") ) return ;; --name) @@ -42,11 +42,11 @@ _udevadm() return ;; --action) - COMPREPLY=( $( compgen -W 'add change remove' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'add change remove' -- "$cur") ) return ;; --type) - COMPREPLY=( $( compgen -W 'devices subsystems failed' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'devices subsystems failed' -- "$cur") ) return ;; esac @@ -56,21 +56,19 @@ _udevadm() if [[ -z $udevcmd ]]; then case $cur in -*) - COMPREPLY=( $( compgen -W '--help --version --debug' -- \ - "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version --debug' -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W "$( "$1" --help 2>/dev/null | - awk '/^[ \t]/ { print $1 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$("$1" --help 2>/dev/null | + awk '/^[ \t]/ { print $1 }')" -- "$cur") ) ;; esac return fi if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( "$1" $udevcmd --help 2>/dev/null | _parse_help - )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" $udevcmd --help 2>/dev/null | _parse_help -)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/_umount b/completions/_umount new file mode 100644 index 00000000..a5d338bc --- /dev/null +++ b/completions/_umount @@ -0,0 +1,24 @@ +# umount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +if [[ $OSTYPE == *linux* ]]; then + . "$BASH_SOURCE.linux" + return +fi + +# umount(8) completion. This relies on the mount point being the third +# space-delimited field in the output of mount(8) +# +_umount() +{ + local cur prev words cword + _init_completion || return + + local IFS=$'\n' + COMPREPLY=( $(compgen -W '$(mount | cut -d" " -f 3)' -- "$cur") ) +} && +complete -F _umount -o dirnames umount + +# ex: filetype=sh diff --git a/completions/_umount.linux b/completions/_umount.linux new file mode 100644 index 00000000..59727b4b --- /dev/null +++ b/completions/_umount.linux @@ -0,0 +1,143 @@ +# umount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better! +# +# This will correctly escape special characters in COMPREPLY. +_reply_compgen_array() +{ + # Create the argument for compgen -W by escaping twice. + # + # One round of escape is because we want to reply with escaped arguments. A + # second round is required because compgen -W will helpfully expand it's + # argument. + local i wlist + for i in ${!COMPREPLY[*]}; do + local q=$(quote "$(printf %q "${COMPREPLY[$i]}")") + wlist+=$q$'\n' + done + + # We also have to add another round of escaping to $cur. + local ecur="$cur" + ecur=${ecur//\\/\\\\} + ecur=${ecur//\'/\\\'} + + # Actually generate completions. + local oldifs=$IFS + IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)' + IFS=$oldifs +} + +# Unescape strings in the linux fstab(5) format (with octal escapes). +__linux_fstab_unescape() { + eval $1="'${!1//\'/\\047}'" + eval $1="'${!1/%\\/\\\\}'" + eval "$1=$'${!1}'" +} + +# Complete linux fstab entries. +# +# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab +# and /proc/mounts. +_linux_fstab() +{ + COMPREPLY=() + + # Read and unescape values into COMPREPLY + 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 [[ $1 == -L ]]; then + local fs_label=${fs_spec/#LABEL=} + if [[ $fs_label != "$fs_spec" ]]; then + __linux_fstab_unescape fs_label + IFS=$'\0' + COMPREPLY+=("$fs_label") + IFS=$oldifs + fi + else + __linux_fstab_unescape fs_spec + __linux_fstab_unescape fs_file + IFS=$'\0' + [[ $fs_spec == */* ]] && COMPREPLY+=("$fs_spec") + [[ $fs_file == */* ]] && COMPREPLY+=("$fs_file") + IFS=$oldifs + fi + done + + # Add relative paths to COMPREPLY + if [[ $cur && $cur != /* ]]; then + local realcur + [[ $cur == */ ]] && # don't let readlink drop last / from path + realcur="$(readlink -f "$cur." 2>/dev/null)/" || + realcur=$(readlink -f "$cur" 2>/dev/null) + if [[ $realcur ]]; then + local dirrealcur="" dircur="" basecur + if [[ $cur == */* ]]; then + dirrealcur="${realcur%/*}/" + dircur="${cur%/*}/" + fi + basecur=${cur#"$dircur"} + local i n=${#COMPREPLY[@]} + for (( i=0; i < $n; i++ )); do + [[ "${COMPREPLY[i]}" == "$realcur"* ]] && + COMPREPLY+=( $(cd "$dircur" 2>/dev/null && + compgen -f -d -P "$dircur" \ + -X "!${COMPREPLY[i]##"$dirrealcur"}" -- "$basecur") ) + done + fi + fi + + _reply_compgen_array +} + +_umount() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -t) + # FIXME: no<fstype> + local split=false + if [[ "$cur" == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=( $(compgen -W 'adfs affs autofs btrfs cifs coda + cramfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs + iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 + ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs + umsdos usbfs vfat xfs' -- "$cur") ) + _fstypes + $split && COMPREPLY=( ${COMPREPLY[@]/#/$prev,} ) + return + ;; + -O) + # argument required but no completions available + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '-V -h -v -n -r -d -i -a -t -O -f -l + --no-canonicalize --fake' -- "$cur") ) + [[ $COMPREPLY ]] && return + fi + + if [[ -r /proc/mounts ]]; then + # Linux /proc/mounts is properly quoted. This is important when + # unmounting usb devices with pretty names. + _linux_fstab </proc/mounts + else + local IFS=$'\n' + COMPREPLY=( $(compgen -W '$(mount | cut -d" " -f 3)' -- "$cur") ) + fi +} && +complete -F _umount -o dirnames umount + +# ex: filetype=sh diff --git a/completions/_xm b/completions/_xm new file mode 100644 index 00000000..d7b74b89 --- /dev/null +++ b/completions/_xm @@ -0,0 +1,224 @@ +# bash completion for xm -*- shell-script -*- + +# Use of this file is deprecated. The 'xm' command itself is no longer +# provided by upstream. It has been replaced with the 'xl' command, for +# which upstream provides completion, use that instead. + +_xen_domain_names() +{ + COMPREPLY=( $(compgen -W "$(xm list 2>/dev/null | \ + awk '!/Name|Domain-0/ { print $1 }')" -- "$cur") ) +} + +_xen_domain_ids() +{ + COMPREPLY=( $(compgen -W "$(xm list 2>/dev/null | \ + awk '!/Name|Domain-0/ { print $2 }')" -- "$cur") ) +} + +_xm() +{ + local cur prev words cword + _init_completion || return + + # TODO: _split_longopt + + local args command commands options + + commands='console vncviewer create new delete destroy domid domname + dump-core list mem-max mem-set migrate pause reboot rename reset + restore resume save shutdown start suspend sysrq trigger top unpause + uptime usb-add usb-del vcpu-list vcpu-pin vcpu-set debug-keys dmesg + info log serve sched-credit sched-sedf block-attach block-detach + block-list block-configure network-attach network-detach network-list + vtpm-list pci-attach pci-detach pci-list pci-list-assignable-devices + scsi-attach scsi-detach scsi-list vnet-list vnet-create vnet-delete + labels addlabel rmlabel getlabel dry-run resources dumppolicy setpolicy + resetpolicy getpolicy shell help' + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) + else + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + fi + + command=${words[1]} + if [[ "$cur" == -* ]]; then + # possible options for the command + case $command in + create) + options='-c' + ;; + dmesg) + options='--clear' + ;; + list) + options='--long' + ;; + reboot) + options='-w -a' + ;; + shutdown) + options='-w -a -R -H' + ;; + sched-credit) + options='-d -w -c' + ;; + block-list|network-list|vtpm-list|vnet-list) + options='-l --long' + ;; + getpolicy) + options='--dumpxml' + ;; + new) + options='-h --help --help_config -q --quiet --path= -f= + --defconfig= -F= --config= -b --dryrun -x --xmldryrun + -s --skipdtd -p --paused -c --console_autoconnect' + ;; + esac + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) + else + case $command in + console|destroy|domname|domid|list|mem-set|mem-max| \ + pause|reboot|rename|shutdown|unpause|vcpu-list|vcpu-pin| \ + vcpu-set|block-list|network-list|vtpm-list) + _count_args + case $args in + 2) + _xen_domain_names + ;; + esac + ;; + migrate) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + _known_hosts_real -- "$cur" + ;; + esac + ;; + restore|dry-run|vnet-create) + _filedir + ;; + save) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + _filedir + ;; + esac + ;; + sysrq) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=( $(compgen -W "r s e i u b" -- "$cur") ) + ;; + esac + ;; + block-attach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=( $(compgen -W "phy: file:" -- "$cur") ) + ;; + 5) + COMPREPLY=( $(compgen -W "w r" -- "$cur") ) + ;; + 6) + _xen_domain_names + ;; + esac + ;; + block-detach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=( $(compgen -W "$(xm block-list $prev \ + 2>/dev/null | awk '!/Vdev/ { print $1 }')" \ + -- "$cur") ) + ;; + esac + ;; + network-attach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + *) + COMPREPLY=( $(compgen -W "script= ip= mac= bridge= + backend=" -- "$cur") ) + ;; + esac + ;; + network-detach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=( $(compgen -W "$(xm network-list $prev \ + 2>/dev/null | awk '!/Idx/ { print $1 }')" \ + -- "$cur") ) + ;; + esac + ;; + sched-credit) + case $prev in + -d) + _xen_domain_names + return + ;; + esac + ;; + create) + _filedir + COMPREPLY+=( \ + $(compgen -W '$(command ls /etc/xen 2>/dev/null)' \ + -- "$cur") ) + ;; + new) + case $prev in + -f|-F|--defconfig|--config) + _filedir + return + ;; + --path) + _filedir -d + return + ;; + esac + + _count_args + case $args in + 2) + _xen_domain_names + ;; + esac + ;; + esac + fi + fi +} && +complete -F _xm xm + +# ex: filetype=sh diff --git a/completions/_yum b/completions/_yum index f3a104bd..d5e06eca 100644 --- a/completions/_yum +++ b/completions/_yum @@ -5,16 +5,16 @@ _yum_list() { - if [[ "$1" == all ]] ; then + if [[ "$1" == all ]]; then # Try to strip in between headings like "Available Packages" # This will obviously only work for English :P - COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + COMPREPLY=( $(yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ command sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ - -e 's/[[:space:]].*//p' ) ) + -e 's/[[:space:]].*//p') ) else # Drop first line (e.g. "Updated Packages") - COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ - command sed -ne 1d -e 's/[[:space:]].*//p' ) ) + COMPREPLY=( $(yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + command sed -ne 1d -e 's/[[:space:]].*//p') ) fi } @@ -75,22 +75,22 @@ _yum() case $prev in list) - COMPREPLY=( $( compgen -W 'all available updates installed extras - obsoletes recent' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all available updates installed extras + obsoletes recent' -- "$cur") ) ;; clean) - COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache - all' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'packages headers metadata cache dbcache + all' -- "$cur") ) ;; repolist) - COMPREPLY=( $( compgen -W 'all enabled disabled' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all enabled disabled' -- "$cur") ) ;; localinstall|localupdate) # TODO: should not match *src.rpm _filedir rpm ;; -d|-e) - COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..10}' -- "$cur") ) ;; -c) _filedir @@ -99,21 +99,20 @@ _yum() _filedir -d ;; --enablerepo) - COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_yum_repolist disabled)' -- "$cur") ) ;; --disablerepo) - COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_yum_repolist enabled)' -- "$cur") ) ;; --disableexcludes) - COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_yum_repolist all) all main' \ + -- "$cur") ) ;; --enableplugin|--disableplugin) - COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_yum_plugins)' -- "$cur") ) ;; --color) - COMPREPLY=( $( compgen -W 'always auto never' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'always auto never' -- "$cur") ) ;; -R|-x|--exclude) # argument required but no completions available @@ -124,18 +123,18 @@ _yum() return ;; *) - COMPREPLY=( $( compgen -W 'install update check-update upgrade + COMPREPLY=( $(compgen -W 'install update check-update upgrade remove erase list info provides whatprovides clean makecache groupinstall groupupdate grouplist groupremove groupinfo search shell resolvedep localinstall localupdate deplist - repolist help' -- "$cur" ) ) + repolist help' -- "$cur") ) ;; esac $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/a2x b/completions/a2x index 06c7c3a4..cf9f9516 100644 --- a/completions/a2x +++ b/completions/a2x @@ -6,15 +6,15 @@ _a2x() _init_completion -s || return case $prev in - -a|--attribute|--asciidoc-opts|--dblatex-opts|--fop-opts|-h|--help|\ - --version|--xsltproc-opts) + --attribute|--asciidoc-opts|--dblatex-opts|--fop-opts|--help|\ + --version|--xsltproc-opts|-!(-*)[ah]) return ;; - -D|--destination-dir|--icons-dir) + --destination-dir|--icons-dir|-!(-*)D) _filedir -d return ;; - --doctype|-d) + --doctype|-!(-*)d) _xfunc asciidoc _asciidoc_doctype return ;; @@ -27,8 +27,7 @@ _a2x() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/abook b/completions/abook index 4bb0e8e3..29d326b9 100644 --- a/completions/abook +++ b/completions/abook @@ -22,21 +22,21 @@ _abook() case $prev in --informat) - COMPREPLY=( $( compgen -W "$($1 --formats | \ + COMPREPLY=( $(compgen -W "$($1 --formats | \ command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ - -- "$cur" ) ) + -- "$cur") ) ;; --outformat) - COMPREPLY=( $( compgen -W "$($1 --formats | \ + COMPREPLY=( $(compgen -W "$($1 --formats | \ command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ - -- "$cur" ) ) + -- "$cur") ) ;; --infile) - COMPREPLY=( $( compgen -W stdin -- "$cur" ) ) + COMPREPLY=( $(compgen -W stdin -- "$cur") ) _filedir ;; --outfile) - COMPREPLY=( $( compgen -W stdout -- "$cur" ) ) + COMPREPLY=( $(compgen -W stdout -- "$cur") ) _filedir ;; --config|--datafile) diff --git a/completions/aclocal b/completions/aclocal index 7a3d6467..f0cc6114 100644 --- a/completions/aclocal +++ b/completions/aclocal @@ -19,17 +19,17 @@ _aclocal() ;; --warnings|-W) local cats=( syntax unsupported ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur") ) return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && -complete -F _aclocal aclocal aclocal-1.1{0..5} +complete -F _aclocal aclocal aclocal-1.1{0..6} # ex: filetype=sh diff --git a/completions/acpi b/completions/acpi index b748cbde..745b8f78 100644 --- a/completions/acpi +++ b/completions/acpi @@ -6,16 +6,16 @@ _acpi() _init_completion || return case $prev in - -h|--help|-v|--version) + --help|--version|-!(-*)[hv]) return ;; - -d|--directory) + --directory|-!(-*)d) _filedir -d return ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _acpi acpi diff --git a/completions/adb b/completions/adb deleted file mode 100644 index d069b425..00000000 --- a/completions/adb +++ /dev/null @@ -1,66 +0,0 @@ -# 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 d582d94b..75ae417c 100644 --- a/completions/add_members +++ b/completions/add_members @@ -11,7 +11,7 @@ _add_members() return ;; -w|-a|--welcome-msg|--admin-notify) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac @@ -19,8 +19,8 @@ _add_members() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--regular-members-file --digest-members-file - --welcome-msg --admin-notify --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--regular-members-file --digest-members-file + --welcome-msg --admin-notify --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/alias b/completions/alias index e90dff60..af39302a 100644 --- a/completions/alias +++ b/completions/alias @@ -7,11 +7,11 @@ _alias() case ${words[@]} in *[^=]) - COMPREPLY=( $( compgen -A alias -- "$cur" ) ) + COMPREPLY=( $(compgen -A alias -- "$cur") ) ;; *=) - COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | command sed \ - -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) + COMPREPLY=( "$(alias ${cur%=} 2>/dev/null | command sed \ + -e 's|^alias '"$cur"'\(.*\)$|\1|')" ) ;; esac } && diff --git a/completions/ant b/completions/ant index 639cde97..ba141965 100644 --- a/completions/ant +++ b/completions/ant @@ -11,7 +11,7 @@ _ant_parse_targets() if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then targets+=" ${BASH_REMATCH[2]}" fi - done < $1 + done <$1 # parse imports while read -rd '>' line; do @@ -22,7 +22,7 @@ _ant_parse_targets() _ant_parse_targets $imported_buildfile fi fi - done < $1 + done <$1 } _ant() @@ -39,7 +39,7 @@ _ant() return ;; -logfile|-l) - _filedir + [[ $1 != *phing || $prev != -l ]] && _filedir return ;; -propertyfile) @@ -47,7 +47,7 @@ _ant() return ;; -nice) - COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..10}' -- "$cur") ) return ;; -lib) @@ -62,7 +62,10 @@ _ant() if [[ $cur == -D* ]]; then return elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + # The </dev/null prevents "phing -" weirdness/getting just a literal + # tab displayed on complete on CentOS 6 with phing 2.6.1. + COMPREPLY=( + $(compgen -W '$(_parse_help "$1" -h </dev/null)' -- "$cur") ) else # available targets completion # find which buildfile to use @@ -89,7 +92,7 @@ _ant() # fill targets _ant_parse_targets $buildfile - COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$targets' -- "$cur") ) fi } && complete -F _ant ant phing diff --git a/completions/apache2ctl b/completions/apache2ctl index 74789744..fe2a2d7b 100644 --- a/completions/apache2ctl +++ b/completions/apache2ctl @@ -9,7 +9,7 @@ _apache2ctl() APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ tr "|" " ") - COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$APWORDS" -- "$cur") ) } && complete -F _apache2ctl apache2ctl diff --git a/completions/appdata-validate b/completions/appdata-validate index 3285a3b3..e6c6ddd6 100644 --- a/completions/appdata-validate +++ b/completions/appdata-validate @@ -10,9 +10,9 @@ _appdata_validate() return ;; --output-format) - COMPREPLY=( $( compgen -W "$( $1 --help | - command sed -ne 's/--output-format.*\[\(.*\)\]/\1/' -e 's/|/ /gp' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 --help | + command sed -ne 's/--output-format.*\[\(.*\)\]/\1/' -e 's/|/ /gp')" \ + -- "$cur") ) return ;; esac @@ -20,7 +20,7 @@ _appdata_validate() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/apt-build b/completions/apt-build index 0723bcc4..b6cf8eff 100644 --- a/completions/apt-build +++ b/completions/apt-build @@ -15,11 +15,11 @@ _apt_build() if [[ -n $special ]]; then case $special in install|source|info) - COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) ) + COMPREPLY=( $(apt-cache pkgnames "$cur" 2>/dev/null) ) ;; remove) COMPREPLY=( \ - $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) + $(_xfunc dpkg _comp_dpkg_installed_packages "$cur") ) ;; esac return @@ -36,15 +36,15 @@ _apt_build() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir + COMPREPLY=( $(compgen -W '--help --show-upgraded -u --build-dir --repository-dir --build-only --build-command --reinstall --rebuild --remove-builddep --no-wrapper --purge --patch --patch-strip -p - --yes -y --version -v --no-source' -- "$cur" ) ) + --yes -y --version -v --no-source' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'update upgrade install remove source + COMPREPLY=( $(compgen -W 'update upgrade install remove source dist-upgrade world clean info clean-build update-repository' \ - -- "$cur" ) ) + -- "$cur") ) fi } && diff --git a/completions/apt-cache b/completions/apt-cache index bedae4e9..5bd85e90 100644 --- a/completions/apt-cache +++ b/completions/apt-cache @@ -2,17 +2,18 @@ # List APT binary packages _apt_cache_packages() { - apt-cache --no-generate pkgnames "$cur" 2> /dev/null + 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 + compgen -W "$(apt-cache dumpavail | \ + awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$1" } # List APT source packages _apt_cache_src_packages() { - compgen -W '$( _apt_cache_sources "$cur" )' -- "$cur" + compgen -W '$(_apt_cache_sources "$cur")' -- "$cur" } _apt_cache() @@ -37,11 +38,11 @@ _apt_cache() ;; showsrc) - COMPREPLY=( $( _apt_cache_sources "$cur" ) ) + COMPREPLY=( $(_apt_cache_sources "$cur") ) ;; *) - COMPREPLY=( $( _apt_cache_packages ) ) + COMPREPLY=( $(_apt_cache_packages) ) ;; esac @@ -50,7 +51,7 @@ _apt_cache() case $prev in - -c|-p|-s|--config-file|--pkg-cache|--src-cache) + --config-file|--pkg-cache|--src-cache|-!(-*)[cps]) _filedir return ;; @@ -63,16 +64,16 @@ _apt_cache() if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help + COMPREPLY=( $(compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help --version --pkg-cache --src-cache --quiet --important --full --all-versions --no-all-versions --generate --no-generate --names-only --all-names --recurse --config-file --option - --installed' -- "$cur" ) ) + --installed' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc stats + COMPREPLY=( $(compgen -W 'add gencaches show showpkg showsrc stats dump dumpavail unmet search search depends rdepends pkgnames - dotty xvcg policy madison' -- "$cur" ) ) + dotty xvcg policy madison' -- "$cur") ) fi diff --git a/completions/apt-get b/completions/apt-get index 32c4bcf8..3b00c56a 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -3,7 +3,7 @@ _apt_get() { local cur prev words cword - _init_completion || return + _init_completion -n = || return local special i for (( i=0; i < ${#words[@]}-1; i++ )); do @@ -17,57 +17,75 @@ _apt_get() remove|autoremove|purge) if [[ -f /etc/debian_version ]]; then # Debian system - COMPREPLY=( $( \ - _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) + COMPREPLY=( $(\ + _xfunc dpkg _comp_dpkg_installed_packages $cur) ) else # assume RPM based _xfunc rpm _rpm_installed_packages fi ;; source) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ - 2> /dev/null ) $( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + COMPREPLY=( $(apt-cache --no-generate pkgnames "$cur" \ + 2>/dev/null) $(compgen -W "$(apt-cache dumpavail | + awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$cur") ) ;; - *) - if [[ $special == install && $cur == */* ]]; then + install) + if [[ $cur == */* ]]; then _filedir deb - else - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ - 2>/dev/null ) ) + return + elif [[ $cur == *=* ]]; then + COMPREPLY=( $(compgen -W "$(\ + apt-cache --no-generate show "${cur%%=*}" 2>/dev/null | + command sed -ne \ + 's/^Version:[[:space:]]*\([^[:space:]]\)/\1/p')" \ + -- "${cur#*=}") ) + return fi + ;;& + *) + COMPREPLY=( $(apt-cache --no-generate pkgnames "$cur" \ + 2>/dev/null) ) ;; esac return fi case $prev in - -c|--config-file) + --help|--version|--option|-!(-*)[hvo]) + return + ;; + --config-file|-!(-*)c) _filedir return ;; - -t|--target-release|--default-release) - COMPREPLY=( $( apt-cache policy | \ - command grep "release.o=Debian,a=$cur" | \ - command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) + --target-release|--default-release|-!(-*)t) + COMPREPLY=( $(compgen -W "$(apt-cache policy | command sed -ne \ + 's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \ + -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o - --download-only --fix-broken --help --version --ignore-missing - --fix-missing --no-download --quiet --simulate --just-print - --dry-run --recon --no-act --yes --assume-yes --show-upgraded - --only-source --compile --build --ignore-hold --target-release - --no-upgrade --force-yes --print-uris --purge --reinstall - --list-cleanup --default-release --trivial-only --no-remove - --diff-only --no-install-recommends --tar-only --config-file - --option --auto-remove' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--no-install-recommends --install-suggests + --download-only --fix-broken --ignore-missing --fix-missing + --no-download --quiet --simulate --just-print --dry-run --recon + --no-act --yes --assume-yes --assume-no --no-show-upgraded + --verbose-versions --host-architecture --build-profiles --compile + --build --ignore-hold --with-new-pkgs --no-upgrade --only-upgrade + --allow-downgrades --allow-remove-essential + --allow-change-held-packages --force-yes --print-uris --purge + --reinstall --list-cleanup --target-release --default-release + --trivial-only --no-remove --auto-remove --autoremove --only-source + --diff-only --dsc-only --tar-only --arch-only --indep-only + --allow-unauthenticated --no-allow-insecure-repositories + --allow-releaseinfo-change --show-progress --with-source --help + --version --config-file --option' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade - dist-upgrade install remove purge source build-dep download - changelog check clean autoclean autoremove' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'update upgrade dist-upgrade + dselect-upgrade install remove purge source build-dep check + download clean autoclean autoremove changelog indextargets' \ + -- "$cur") ) fi } && diff --git a/completions/aptitude b/completions/aptitude index a8b88737..3f4e5500 100644 --- a/completions/aptitude +++ b/completions/aptitude @@ -39,16 +39,16 @@ _aptitude() 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 ) ) + COMPREPLY=( $(_xfunc apt-cache _apt_cache_packages) ) return ;; purge|remove|reinstall|forbid-version) COMPREPLY=( \ - $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) + $(_xfunc dpkg _comp_dpkg_installed_packages "$cur") ) return ;; unhold) - COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) + COMPREPLY=( $(_comp_dpkg_hold_packages "$cur") ) return ;; esac @@ -59,26 +59,26 @@ _aptitude() autoclean|clean|forget-new|search|upgrade|update|keep-all) return ;; - -S) + -!(-*)S) _filedir return ;; - -t|--target-release|--default-release) - COMPREPLY=( $( apt-cache policy | \ + --target-release|--default-release|-!(-*)t) + COMPREPLY=( $(apt-cache policy | \ command grep "release.o=Debian,a=$cur" | \ - command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2>/dev/null) ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$dashoptions" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$dashoptions" -- "$cur") ) else - COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new + COMPREPLY=( $(compgen -W 'update upgrade safe-upgrade forget-new clean autoclean install reinstall remove hold unhold purge markauto unmarkauto why why-not dist-upgrade full-upgrade download search show forbid-version changelog keep keep-all build-dep add-user-tag - remove-user-tag versions' -- "$cur" ) ) + remove-user-tag versions' -- "$cur") ) fi } && diff --git a/completions/arch b/completions/arch index cd33b4f0..e275577b 100644 --- a/completions/arch +++ b/completions/arch @@ -10,7 +10,7 @@ _arch() case $prev in -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; -d|--file) @@ -22,12 +22,12 @@ _arch() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else local args=$cword for (( i=1; i < cword; i++ )); do if [[ "${words[i]}" == -* ]]; then - args=$(($args-1)) + (( args-- )) fi done case $args in diff --git a/completions/arp b/completions/arp new file mode 100644 index 00000000..e83f05d3 --- /dev/null +++ b/completions/arp @@ -0,0 +1,59 @@ +# arp(8) completion -*- shell-script -*- + +_arp() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --device|-!(-*)i) + _available_interfaces -a + return + ;; + --protocol|-!(-*)[Ap]) + # TODO protocol/address family + return + ;; + --file|-!(-*)f) + _filedir + return + ;; + --hw-type|-!(-*)[Ht]) + # TODO: parse from --help output? + COMPREPLY=( $(compgen -W 'ash ether ax25 netrom rose arcnet \ + dlci fddi hippi irda x25 eui64' -- "$cur") ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + local args + _count_args "" "@(--device|--protocol|--file|--hw-type|-!(-*)[iApfHt])" + case $args in + 1) + local ips=$("$1" -an | command sed -ne \ + 's/.*(\([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}\)).*/\1/p') + COMPREPLY=( $(compgen -W '$ips' -- "$cur") ) + ;; + 2) + # TODO if -d mode: "pub"; if not -f mode: hw_addr + # TODO hw_addr is a configured interface with --use-device/-*D* + ;; + 3) + # TODO netmask|pub|temp if -s mode + ;; + 4) + # TODO netmask value if previous was "netmask" + ;; + 5) + # TODO "pub" if 3rd was "netmask" + ;; + esac +} && +complete -F _arp arp + +# ex: filetype=sh diff --git a/completions/arping b/completions/arping index 2f544353..6adcde7c 100644 --- a/completions/arping +++ b/completions/arping @@ -6,21 +6,21 @@ _arping() _init_completion || return case $prev in - -c|-w) + -*c|-*w) return ;; - -I) + -*I) _available_interfaces -a return ;; - -s) + -*s) _ip_addresses return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi diff --git a/completions/arpspoof b/completions/arpspoof index e31288fc..6275a667 100644 --- a/completions/arpspoof +++ b/completions/arpspoof @@ -17,7 +17,7 @@ _arpspoof() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/asciidoc b/completions/asciidoc index fb29fad4..2ddcdfe9 100644 --- a/completions/asciidoc +++ b/completions/asciidoc @@ -2,7 +2,7 @@ _asciidoc_doctype() { - COMPREPLY+=( $( compgen -W 'article book manpage' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'article book manpage' -- "$cur") ) } _asciidoc() @@ -11,26 +11,26 @@ _asciidoc() _init_completion -s || return case $prev in - --attribute|-a) + --attribute|-!(-*)a) return ;; - --backend|-b) - COMPREPLY=( $( compgen -W 'docbook html4 xhtml11' -- "$cur" ) ) + --backend|-!(-*)b) + COMPREPLY=( $(compgen -W 'docbook html4 xhtml11' -- "$cur") ) return ;; - --conf-file|-f) + --conf-file|-!(-*)f) _filedir conf return ;; - --doctype|-d) + --doctype|-!(-*)d) _asciidoc_doctype return ;; - --help|-h) - COMPREPLY=( $( compgen -W 'manpage syntax topics' -- "$cur" ) ) + --help|-!(-*)h) + COMPREPLY=( $(compgen -W 'manpage syntax topics' -- "$cur") ) return ;; - --out-file|-o) + --out-file|-!(-*)o) _filedir return ;; @@ -39,8 +39,8 @@ _asciidoc() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help manpage" )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" "--help manpage")' \ + -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/aspell b/completions/aspell index 9457a5fa..040853cb 100644 --- a/completions/aspell +++ b/completions/aspell @@ -3,14 +3,14 @@ _aspell_dictionary() { local datadir aspell=${1:-aspell} - datadir=$( $aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) + datadir=$($aspell config data-dir 2>/dev/null || echo /usr/lib/aspell) # First, get aliases (dicts dump does not list them) - COMPREPLY=( $( printf '%s\n' $datadir/*.alias ) ) + COMPREPLY=( $(printf '%s\n' $datadir/*.alias) ) COMPREPLY=( "${COMPREPLY[@]%.alias}" ) COMPREPLY=( "${COMPREPLY[@]#$datadir/}" ) # Then, add the canonical dicts - COMPREPLY+=( $( $aspell dicts 2>/dev/null ) ) - COMPREPLY=( $( compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY+=( $($aspell dicts 2>/dev/null) ) + COMPREPLY=( $(compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur") ) } _aspell() @@ -28,21 +28,21 @@ _aspell() return ;; dump|create|merge) - COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'master personal repl' -- "$cur") ) return ;; --mode) - COMPREPLY=( $( compgen -W "$( $1 modes 2>/dev/null | \ - awk '{ print $1 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 modes 2>/dev/null | \ + awk '{ print $1 }')" -- "$cur") ) return ;; --sug-mode) - COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ultra fast normal bad-speller' \ + -- "$cur") ) return ;; --keymapping) - COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'aspell ispell' -- "$cur") ) return ;; -d|--master) @@ -50,8 +50,8 @@ _aspell() return ;; --add-filter|--rem-filter) - COMPREPLY=( $( compgen -W "$( $1 filters 2>/dev/null | \ - awk '{ print $1 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 filters 2>/dev/null | \ + awk '{ print $1 }')" -- "$cur") ) return ;; esac @@ -59,7 +59,7 @@ _aspell() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= + COMPREPLY=( $(compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= --encoding= --add-filter= --rem-filter= --mode= --add-extra-dicts= --rem-extra-dicts= --home-dir= --ignore= --ignore-accents --dont-ignore-accents --ignore-case --dont-ignore-case @@ -76,11 +76,11 @@ _aspell() --add-tex-command= --rem-tex-command= --tex-check-comments --dont-tex-check-comments --add-tex-extension --rem-tex-extension --add-sgml-check= --rem-sgml-check= --add-sgml-extension - --rem-sgml-extension' -- "$cur" ) ) + --rem-sgml-extension' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W 'usage help check pipe list config soundslike - filter version dump create merge' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'usage help check pipe list config soundslike + filter version dump create merge' -- "$cur") ) fi } && complete -F _aspell aspell diff --git a/completions/autoconf b/completions/autoconf index c67f1bdb..94a014ff 100644 --- a/completions/autoconf +++ b/completions/autoconf @@ -15,8 +15,8 @@ _autoconf() ;; --warnings|-W) local cats=( cross obsolete syntax ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur") ) return ;; --prepend-include|-B|--include|-I) @@ -28,7 +28,7 @@ _autoconf() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/automake b/completions/automake index c5fe1a10..ff3d4523 100644 --- a/completions/automake +++ b/completions/automake @@ -11,8 +11,8 @@ _automake() ;; --warnings|-W) local cats=( gnu obsolete override portability syntax unsupported ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur") ) return ;; --libdir) @@ -24,13 +24,13 @@ _automake() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi _filedir } && -complete -F _automake automake automake-1.1{0..5} +complete -F _automake automake automake-1.1{0..6} # ex: filetype=sh diff --git a/completions/autoreconf b/completions/autoreconf index c067cec1..cf983312 100644 --- a/completions/autoreconf +++ b/completions/autoreconf @@ -12,8 +12,8 @@ _autoreconf() --warnings|-W) local cats=( cross gnu obsolete override portability syntax \ unsupported ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur") ) return ;; --prepend-include|-B|--include|-I) @@ -25,12 +25,12 @@ _autoreconf() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - if [[ $1 == autoheader ]] ; then + if [[ $1 == *autoheader ]]; then _filedir '@(ac|in)' else _filedir -d diff --git a/completions/autorpm b/completions/autorpm index 8c6e299a..7a0bbe18 100644 --- a/completions/autorpm +++ b/completions/autorpm @@ -5,8 +5,8 @@ _autorpm() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add - fullinfo info help install list remove set' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--notty --debug --help --version auto add + fullinfo info help install list remove set' -- "$cur") ) } && complete -F _autorpm autorpm diff --git a/completions/autoscan b/completions/autoscan index 054a58af..5f70a508 100644 --- a/completions/autoscan +++ b/completions/autoscan @@ -6,10 +6,10 @@ _autoscan() _init_completion -s || return case "$prev" in - --help|-h|--version|-V) + --help|--version|-!(-*)[hV]) return ;; - --prepend-include|-B|--include|-I) + --prepend-include|--include|-!(-*)[BI]) _filedir -d return ;; @@ -18,12 +18,12 @@ _autoscan() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - if [[ $1 == autoupdate ]] ; then + if [[ $1 == *autoupdate ]]; then _filedir '@(ac|in)' else _filedir -d diff --git a/completions/avctrl b/completions/avctrl index acd9aeb7..2ef499f3 100644 --- a/completions/avctrl +++ b/completions/avctrl @@ -6,12 +6,12 @@ _avctrl() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --quiet' -- "$cur") ) else local args _count_args if [[ $args -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'discover switch' -- "$cur") ) fi fi } && diff --git a/completions/badblocks b/completions/badblocks index d70affe2..a366338c 100644 --- a/completions/badblocks +++ b/completions/badblocks @@ -6,19 +6,19 @@ _badblocks() _init_completion || return case $prev in - -b|-c|-e|-d|-p|-t) + -*[bcedpt]) return ;; - -i|-o) + -*[io]) _filedir return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) # Filter out -w (dangerous) and -X (internal use) - for i in ${!COMPREPLY[@]}; do + for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]' done return diff --git a/completions/bind b/completions/bind index ec5d0b81..c06654b1 100644 --- a/completions/bind +++ b/completions/bind @@ -6,30 +6,30 @@ _bind() _init_completion || return case $prev in - -l|-p|-P|-s|-S|-v|-V|-r|-x|-X) + -*[lpPsSvVrxX]) return ;; - -m) - COMPREPLY=( $( compgen -W "emacs emacs-standard emacs-meta - emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur" ) ) + -*m) + COMPREPLY=( $(compgen -W "emacs emacs-standard emacs-meta + emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur") ) return ;; - -f) + -*f) _filedir return ;; - -q|-u) - COMPREPLY=( $( compgen -W '$( "$1" -l )' -- "$cur" ) ) + -*[qu]) + COMPREPLY=( $(compgen -W '$("$1" -l)' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -A binding -- "$cur" ) ) + COMPREPLY=( $(compgen -A binding -- "$cur") ) } && complete -F _bind bind diff --git a/completions/bk b/completions/bk index 334e25b4..73b5bb1c 100644 --- a/completions/bk +++ b/completions/bk @@ -6,10 +6,10 @@ _bk() local cur prev words cword _init_completion || return - local BKCMDS="$( bk help topics 2>/dev/null | \ - awk '/^ bk/ { print $2 }' | xargs printf '%s ' )" + local BKCMDS="$(bk help topics 2>/dev/null | \ + awk '/^ bk/ { print $2 }' | xargs printf '%s ')" - COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$BKCMDS" -- "$cur") ) _filedir } && diff --git a/completions/brctl b/completions/brctl index 01370654..755812d3 100644 --- a/completions/brctl +++ b/completions/brctl @@ -9,17 +9,17 @@ _brctl() case $cword in 1) - COMPREPLY=( $( compgen -W "addbr delbr addif delif setageing + COMPREPLY=( $(compgen -W "addbr delbr addif delif setageing setbridgeprio setfd sethello setmaxage setpathcost setportprio - show showmacs showstp stp" -- "$cur" ) ) + show showmacs showstp stp" -- "$cur") ) ;; 2) case $command in show) ;; *) - COMPREPLY=( $( compgen -W "$($1 show | \ - awk 'NR>1 {print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 show | \ + awk 'NR>1 {print $1}' )" -- "$cur") ) esac ;; 3) @@ -28,7 +28,7 @@ _brctl() _configured_interfaces ;; stp) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) ;; esac ;; diff --git a/completions/btdownloadheadless.py b/completions/btdownloadheadless.py index f0b74615..c15de1a4 100644 --- a/completions/btdownloadheadless.py +++ b/completions/btdownloadheadless.py @@ -13,7 +13,7 @@ _btdownload() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval + COMPREPLY=( $(compgen -W '--max_uploads --keepalive_interval --download_slice_size --request_backlog --max_message_length --ip --minport --maxport --responsefile --url --saveas --timeout --timeout_check_interval --max_slice_length --max_rate_period @@ -21,7 +21,7 @@ _btdownload() --min_peers --http_timeout --max_initiate --max_allow_in --check_hashes --max_upload_rate --snub_time --spew --rarest_first_cutoff --min_uploads --report_hash_failures' \ - -- "$cur" ) ) + -- "$cur") ) else _filedir fi diff --git a/completions/bts b/completions/bts index ba33fd66..c87b51e1 100644 --- a/completions/bts +++ b/completions/bts @@ -3,14 +3,14 @@ # 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" \ + 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" )' \ + compgen -P "src:" -W '$(_xfunc apt-cache _apt_cache_sources "$ppn")' \ -- "$ppn" } @@ -22,58 +22,58 @@ _bts() case $prev in show|bugs) - COMPREPLY=( $( compgen -W 'release-critical RC from: tag: - usertag:' -- "$cur" ) $( _cached_bugs ) - $( _src_packages_with_prefix ) ) + 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: + COMPREPLY=( $(compgen -W 'package: source: maintainer: submitter: severity: status: tag: owner: correspondent: affects: bugs: - users: archive:' -- "$cur" ) ) + users: archive:' -- "$cur") ) return ;; status) - COMPREPLY=( $( compgen -W 'file: fields: verbose' -- "$cur" ) - $( _cached_bugs ) ) + COMPREPLY=( $(compgen -W 'file: fields: verbose' -- "$cur") + $(_cached_bugs) ) return ;; block|unblock) - COMPREPLY=( $( compgen -W 'by with' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'by with' -- "$cur") ) return ;; severity) - COMPREPLY=( $( compgen -W 'wishlist minor normal important serious - grave critical' -- "$cur" ) ) + 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" ) ) + 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\ + 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 ) ) + COMPREPLY=( $(_cached_bugs) ) return ;; package) - COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) ) + 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" ) ) + 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" ) ) + COMPREPLY=( $(_xfunc apt-cache _apt_cache_packages) + $(_src_packages_with_prefix) + $(compgen -W 'from: tag: usertag: ALL' -- "$cur") ) return ;; user) @@ -86,7 +86,7 @@ _bts() # 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 ) ) + COMPREPLY=( $(_xfunc apt-cache _apt_cache_src_packages) ) return fi ;; @@ -94,7 +94,7 @@ _bts() $split && return - COMPREPLY=( $( compgen -W '--offline --online --no-offline + 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 @@ -107,7 +107,7 @@ _bts() 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" ) ) + help' -- "$cur") ) } && complete -F _bts bts diff --git a/completions/bzip2 b/completions/bzip2 index f45e29f2..8bd72cc9 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -6,23 +6,23 @@ _bzip2() _init_completion || return case $prev in - -b|-h|--help|-p) + --help|-!(-*)[bhp]) return ;; - -n) - COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + -!(-*)n) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - local helpopts=$( _parse_help "$1" ) - COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ - -- "$cur" ) ) + local helpopts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ + -- "$cur") ) return fi - local IFS=$'\n' xspec="*.bz2" + local IFS=$'\n' xspec="*.?(t)bz2" if [[ "$prev" == --* ]]; then [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec @@ -35,8 +35,7 @@ _bzip2() _tilde "$cur" || return compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _bzip2 bzip2 pbzip2 lbzip2 diff --git a/completions/cancel b/completions/cancel index 2722d2a8..b903517b 100644 --- a/completions/cancel +++ b/completions/cancel @@ -5,7 +5,22 @@ _cancel() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W "$( lpstat 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) + case $prev in + -h) + _known_hosts_real -- "$cur" + return + ;; + -U) + return + ;; + -u) + COMPREPLY=( $(compgen -u -- "$cur") ) + return + ;; + esac + + COMPREPLY=( $(compgen -W \ + "$(lpstat 2>/dev/null | cut -d' ' -f1)" -- "$cur") ) } && complete -F _cancel cancel diff --git a/completions/cardctl b/completions/cardctl index 273d1a90..588ea467 100644 --- a/completions/cardctl +++ b/completions/cardctl @@ -6,8 +6,8 @@ _cardctl() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'status config ident suspend resume reset - eject insert scheme' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'status config ident suspend resume reset + eject insert scheme' -- "$cur") ) fi } && complete -F _cardctl cardctl pccardctl diff --git a/completions/ccache b/completions/ccache index 7184d74e..7dbec9fe 100644 --- a/completions/ccache +++ b/completions/ccache @@ -11,17 +11,17 @@ _ccache() _command_offset $i return fi - [[ ${COMP_WORDS[i]} == -[oFM] ]] && ((i++)) + [[ ${COMP_WORDS[i]} == -*[oFM] ]] && ((i++)) done case $prev in - -h|--help|-V|--version|-F|--max-files|-M|--max-size) + --help|--version|--max-files|--max-size|-!(-*)[hVFM]) return ;; - -o|--set-config) + --set-config|-!(-*)o) if [[ $cur != *=* ]]; then - COMPREPLY=( $( compgen -S = -W "$( $1 -p 2>/dev/null | \ - awk '$3 = "=" { print $2 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -S = -W "$($1 -p 2>/dev/null | \ + awk '$3 = "=" { print $2 }')" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi return @@ -30,7 +30,7 @@ _ccache() $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _ccache ccache diff --git a/completions/ccze b/completions/ccze index c803408b..7c17f364 100644 --- a/completions/ccze +++ b/completions/ccze @@ -9,33 +9,33 @@ _ccze() -'?'|--help|--usage|-V|--version) return ;; - -a|--argument|-c|--color) + --argument|--color|-!(-*)[ac]) # TODO? return ;; - -F|--rcfile) + --rcfile|-!(-*)F) _filedir return ;; - -m|--mode) - COMPREPLY=( $( compgen -W "curses ansi html" -- "$cur" ) ) + --mode|-!(-*)m) + COMPREPLY=( $(compgen -W "curses ansi html" -- "$cur") ) return ;; - -o|--option) + --option|-!(-*)o) local -a opts=(scroll wordcolor lookups transparent cssfile) - COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]/#/no}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${opts[@]} ${opts[@]/#/no}' -- "$cur") ) return ;; - -p|--plugin) - COMPREPLY=( $( compgen -W '$( "$1" --list-plugins | - sed -ne "s/^\([a-z0-9]\{1,\}\)[[:space:]]\{1,\}|.*/\1/p" )' \ - -- "$cur" ) ) + --plugin|-!(-*)p) + COMPREPLY=( $(compgen -W '$("$1" --list-plugins | command \ + sed -ne "s/^\([a-z0-9]\{1,\}\)[[:space:]]\{1,\}|.*/\1/p")' \ + -- "$cur") ) return esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _ccze ccze diff --git a/completions/cfagent b/completions/cfagent index fbf364ed..14987723 100644 --- a/completions/cfagent +++ b/completions/cfagent @@ -13,7 +13,7 @@ _cfagent() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _cfagent cfagent diff --git a/completions/cfrun b/completions/cfrun index f4d1f265..0a7d0542 100644 --- a/completions/cfrun +++ b/completions/cfrun @@ -8,7 +8,7 @@ _cfrun() local i section=1 for (( i=1; i < cword; i++ )); do if [[ "${words[i]}" == -- ]]; then - section=$((section + 1)) + (( section++ )) fi done @@ -22,7 +22,7 @@ _cfrun() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-f -h -d -S -T -v' -- "$cur") ) else hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts for (( i=1; i < cword; i++ )); do @@ -33,12 +33,12 @@ _cfrun() done [[ ! -f $hostfile ]] && return - COMPREPLY=( $(compgen -W "$( command grep -v \ - -E '(=|^$|^#)' $hostfile )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command grep -v \ + -E '(=|^$|^#)' $hostfile )" -- "$cur") ) fi ;; 2) - COMPREPLY=( $( compgen -W '$( _parse_help cfagent )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help cfagent)' -- "$cur") ) ;; esac } && diff --git a/completions/chage b/completions/chage index 9b11f169..cb9d8fcf 100644 --- a/completions/chage +++ b/completions/chage @@ -6,8 +6,12 @@ _chage() _init_completion -s || return case $prev in - -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ - -M|--maxdays|-W|--warndays) + --lastday|--expiredate|--help|--inactive|--mindays|--maxdays|\ + --warndays|-!(-*)[dEhImMW]) + return + ;; + --root|-!(-*)R) + _filedir -d return ;; esac @@ -15,11 +19,11 @@ _chage() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _chage chage diff --git a/completions/change_pw b/completions/change_pw index b0f2061f..61c45768 100644 --- a/completions/change_pw +++ b/completions/change_pw @@ -15,8 +15,8 @@ _change_pw() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --domain --listname --password --quiet - --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--all --domain --listname --password --quiet + --help' -- "$cur") ) fi } && diff --git a/completions/check_db b/completions/check_db index 6f666173..ade03a5a 100644 --- a/completions/check_db +++ b/completions/check_db @@ -6,7 +6,7 @@ _check_db() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--all --verbose --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/check_perms b/completions/check_perms index 0fb05b11..d53b22a6 100644 --- a/completions/check_perms +++ b/completions/check_perms @@ -6,7 +6,7 @@ _check_perms() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-f -v -h' -- "$cur") ) fi } && diff --git a/completions/checksec b/completions/checksec index 4e9fb601..e07d07d0 100644 --- a/completions/checksec +++ b/completions/checksec @@ -28,7 +28,7 @@ _checksec() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi } && diff --git a/completions/chgrp b/completions/chgrp index 986a77a6..0e39739c 100644 --- a/completions/chgrp +++ b/completions/chgrp @@ -20,9 +20,9 @@ _chgrp() for w in "${words[@]}" ; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break done - COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference + COMPREPLY=( $(compgen -W '-c -h -f -R -v --changes --dereference --no-dereference --silent --quiet --reference --recursive --verbose - --help --version $opts' -- "$cur" ) ) + --help --version $opts' -- "$cur") ) return fi diff --git a/completions/chkconfig b/completions/chkconfig index 8766b3a2..f1ee8704 100644 --- a/completions/chkconfig +++ b/completions/chkconfig @@ -12,7 +12,7 @@ _chkconfig() return ;; --level) - COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..6}' -- "$cur") ) return ;; esac @@ -20,12 +20,12 @@ _chkconfig() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--list --add --del --override --level' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--list --add --del --override --level' \ + -- "$cur") ) else if [[ $cword -eq 2 || $cword -eq 4 ]]; then - COMPREPLY=( $( compgen -W 'on off reset resetpriorities' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off reset resetpriorities' \ + -- "$cur") ) else _services _xinetd_services diff --git a/completions/chmod b/completions/chmod new file mode 100644 index 00000000..849da851 --- /dev/null +++ b/completions/chmod @@ -0,0 +1,40 @@ +# chmod(1) completion -*- shell-script -*- + +_chmod() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version) + return + ;; + --reference) + _filedir + return + ;; + esac + + $split && return + + # Adapted from coreutils 8.28 chmod man page + local modearg="-@(@(+([rwxXst])|[ugo])|+([0-7]))" + + if [[ $cur == -* && $cur != $modearg ]]; then + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + local args + _count_args "" "" "$modearg" + + case $args in + 1) ;; # mode + *) _filedir ;; + esac +} && +complete -F _chmod chmod + +# ex: filetype=sh diff --git a/completions/chown b/completions/chown index c4479dd2..6bfa264a 100644 --- a/completions/chown +++ b/completions/chown @@ -25,9 +25,9 @@ _chown() for w in "${words[@]}" ; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break done - COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference + COMPREPLY=( $(compgen -W '-c -h -f -R -v --changes --dereference --no-dereference --from --silent --quiet --reference --recursive - --verbose --help --version $opts' -- "$cur" ) ) + --verbose --help --version $opts' -- "$cur") ) else local args diff --git a/completions/chpasswd b/completions/chpasswd index 93e74f8c..8c5a4dfd 100644 --- a/completions/chpasswd +++ b/completions/chpasswd @@ -6,19 +6,23 @@ _chpasswd() _init_completion -s || return case $prev in - -c|--crypt) - COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ - -- "$cur" ) ) + --crypt|-!(-*)c) + COMPREPLY=( $(compgen -W 'DES MD5 NONE SHA256 SHA512' \ + -- "$cur") ) return ;; - -s|--sha-rounds) + --sha-rounds|-!(-*)s) + return + ;; + --root|-!(-*)R) + _filedir -d return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _chpasswd chpasswd diff --git a/completions/chromium-browser b/completions/chromium-browser new file mode 100644 index 00000000..f8bebd97 --- /dev/null +++ b/completions/chromium-browser @@ -0,0 +1,35 @@ +# chromium-browser completion -*- shell-script -*- + +_chromium_browser() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--app|--proxy-server|--proxy-pac-url|-h) + return + ;; + --user-data-dir) + _filedir -d + return + ;; + --password-store) + COMPREPLY=( $(compgen -W 'basic gnome kwallet' -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir "@(?([xs])htm?(l)|pdf)" +} && +complete -F _chromium_browser chromium-browser google-chrome \ + google-chrome-stable chromium chrome + +# ex: filetype=sh diff --git a/completions/chronyc b/completions/chronyc index fae9d2e4..a59746aa 100644 --- a/completions/chronyc +++ b/completions/chronyc @@ -2,12 +2,12 @@ _chronyc_command_args() { - local -a args=( $( compgen -W "$( $1 help 2>/dev/null | \ - awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }' )" ) ) + 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" ) ) ;; + *) COMPREPLY+=( $(compgen -W '${args[@]}' -- "$cur") ) ;; esac } @@ -17,17 +17,17 @@ _chronyc() _init_completion || return case $prev in - --help|-p) + --help|-*p) return ;; - -h) + -*h) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -6' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1") -6' -- "$cur") ) return fi @@ -38,15 +38,15 @@ _chronyc() case $args in 0) - COMPREPLY=( $( compgen -W "$( $1 help 2>/dev/null | \ - awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 help 2>/dev/null | \ + awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" \ + -- "$cur") ) ;; 1) _chronyc_command_args "$1" if [[ ! $COMPREPLY && $prev == sources?(tats) ]]; then # [-v] not handled by _chronyc_command_args yet - COMPREPLY=( $( compgen -W '-v' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-v' -- "$cur") ) fi ;; 2) diff --git a/completions/chrpath b/completions/chrpath index 13e43ad0..bcd0f91d 100644 --- a/completions/chrpath +++ b/completions/chrpath @@ -6,17 +6,17 @@ _chrpath() _init_completion || return case $prev in - -v|--version|-h|--help) + --version|--help|-!(-*)[vh]) return ;; - -r|--replace) + --replace|-!(-*)r) _filedir -d return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/cksfv b/completions/cksfv index dd90816e..89ccc7b7 100644 --- a/completions/cksfv +++ b/completions/cksfv @@ -6,16 +6,16 @@ _cksfv() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi case "$prev" in - -C|-g) + -*C|-*g) _filedir -d return ;; - -f) + -*f) _filedir 'sfv' return ;; diff --git a/completions/cleanarch b/completions/cleanarch index edac34f8..5e57e5be 100644 --- a/completions/cleanarch +++ b/completions/cleanarch @@ -6,8 +6,8 @@ _cleanarch() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--status --dry-run --quiet --help' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--status --dry-run --quiet --help' \ + -- "$cur") ) fi } && diff --git a/completions/clisp b/completions/clisp index 23b04f04..f9ccfbb8 100644 --- a/completions/clisp +++ b/completions/clisp @@ -9,9 +9,9 @@ _clisp() # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-h --help --version --license -B -K -M -m -L + COMPREPLY=( $(compgen -W '-h --help --version --license -B -K -M -m -L -N -E -q --quiet --silent -w -I -ansi -traditional -p -C -norc -i - -c -l -o -x ' -- "$cur" ) ) + -c -l -o -x ' -- "$cur") ) else _filedir fi diff --git a/completions/clone_member b/completions/clone_member index fe45e494..5a0797fe 100644 --- a/completions/clone_member +++ b/completions/clone_member @@ -15,8 +15,8 @@ _clone_member() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --remove --admin --quiet - --nomodify --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--listname --remove --admin --quiet + --nomodify --help' -- "$cur") ) fi } && diff --git a/completions/complete b/completions/complete index 5de2d168..0519744d 100644 --- a/completions/complete +++ b/completions/complete @@ -6,43 +6,42 @@ _complete() _init_completion || return case $prev in - -o) - COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames - nospace plusdirs' -- "$cur" ) ) + -*o) + COMPREPLY=( $(compgen -W 'bashdefault default dirnames filenames + nospace plusdirs' -- "$cur") ) return ;; - -A) - COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command + -*A) + COMPREPLY=( $(compgen -W 'alias arrayvar binding builtin command directory disabled enabled export file function group helptopic hostname job keyword running service setopt shopt signal - stopped user variable' -- "$cur" ) ) + stopped user variable' -- "$cur") ) return ;; - -C) - COMPREPLY=( $( compgen -A command -- "$cur" ) ) + -*C) + COMPREPLY=( $(compgen -A command -- "$cur") ) return ;; - -F) - COMPREPLY=( $( compgen -A function -- "$cur" ) ) + -*F) + COMPREPLY=( $(compgen -A function -- "$cur") ) return ;; - -p|-r) - COMPREPLY=( $( complete -p | command sed -e 's|.* ||' ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + -*p|-*r) + COMPREPLY=( $(complete -p | command sed -e 's|.* ||') ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) return ;; - esac if [[ "$cur" == -* ]]; then # relevant options completion local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X" [[ $1 != compgen ]] && opts+=" -F -C" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) else - COMPREPLY=( $( compgen -A command -- "$cur" ) ) + COMPREPLY=( $(compgen -A command -- "$cur") ) fi } && complete -F _complete compgen complete diff --git a/completions/config_list b/completions/config_list index 653c628a..f86263d7 100644 --- a/completions/config_list +++ b/completions/config_list @@ -15,8 +15,8 @@ _config_list() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--inputfile --outputfile --checkonly - --verbose --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--inputfile --outputfile --checkonly + --verbose --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/configure b/completions/configure index 0e37726b..726c7bda 100644 --- a/completions/configure +++ b/completions/configure @@ -27,13 +27,13 @@ _configure() [[ "$cur" != -* ]] && return if [[ -n $COMP_CONFIGURE_HINTS ]]; then - COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ + COMPREPLY=( $(compgen -W "$($1 --help 2>&1 | \ awk '/^ --[A-Za-z]/ { print $1; \ - if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g' )" \ - -- "$cur" ) ) + if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g')" \ + -- "$cur") ) [[ $COMPREPLY == *=* ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/convert b/completions/convert index 59647d59..3ebfc5e9 100644 --- a/completions/convert +++ b/completions/convert @@ -4,97 +4,97 @@ _ImageMagick() { case $prev in -channel) - COMPREPLY=( $( compgen -W 'Red Green Blue Opacity Matte Cyan - Magenta Yellow Black' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Red Green Blue Opacity Matte Cyan + Magenta Yellow Black' -- "$cur") ) return ;; -colormap) - COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'shared private' -- "$cur") ) return ;; -colorspace) - COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ - YPbPr YUV CMYK' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ + YPbPr YUV CMYK' -- "$cur") ) return ;; -compose) - COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus Minus Add + COMPREPLY=( $(compgen -W 'Over In Out Atop Xor Plus Minus Add Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen - CopyBlue CopyOpacity' -- "$cur" ) ) + CopyBlue CopyOpacity' -- "$cur") ) return ;; -compress) - COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG Lossless LZW - RLE Zip' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'None BZip Fax Group4 JPEG Lossless LZW + RLE Zip' -- "$cur") ) return ;; -dispose) - COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Undefined None Background Previous' \ + -- "$cur") ) return ;; -encoding) - COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert AdobeStandard + COMPREPLY=( $(compgen -W 'AdobeCustom AdobeExpert AdobeStandard AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode - Wansung' -- "$cur" ) ) + Wansung' -- "$cur") ) return ;; -endian) - COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'MSB LSB' -- "$cur") ) return ;; -filter) - COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite Hanning + COMPREPLY=( $(compgen -W 'Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell - Lanczos Bessel Sinc' -- "$cur" ) ) + Lanczos Bessel Sinc' -- "$cur") ) return ;; -format) - COMPREPLY=( $( compgen -W "$( convert -list format | awk \ - '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(convert -list format | awk \ + '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }')" \ + -- "$cur") ) return ;; -gravity) - COMPREPLY=( $( compgen -W 'Northwest North NorthEast West Center - East SouthWest South SouthEast' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Northwest North NorthEast West Center + East SouthWest South SouthEast' -- "$cur") ) return ;; -intent) - COMPREPLY=( $( compgen -W 'Absolute Perceptual Relative - Saturation' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Absolute Perceptual Relative + Saturation' -- "$cur") ) return ;; -interlace) - COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'None Line Plane Partition' -- "$cur") ) return ;; -limit) - COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Disk File Map Memory' -- "$cur") ) return ;; -list) - COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource - Type' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Delegate Format Magic Module Resource + Type' -- "$cur") ) return ;; -map) - COMPREPLY=( $( compgen -W 'best default gray red green blue' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'best default gray red green blue' \ + -- "$cur") ) _filedir return ;; -noise) - COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative - Impulse Laplacian Poisson' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Uniform Gaussian Multiplicative + Impulse Laplacian Poisson' -- "$cur") ) return ;; -preview) - COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue Saturation + COMPREPLY=( $(compgen -W 'Rotate Shear Roll Hue Saturation Brightness Gamma Spiff Dull Grayscale Quantize Despeckle ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint - CharcoalDrawing JPEG' -- "$cur" ) ) + CharcoalDrawing JPEG' -- "$cur") ) return ;; -mask|-profile|-texture|-tile|-write) @@ -102,24 +102,24 @@ _ImageMagick() return ;; -type) - COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte + COMPREPLY=( $(compgen -W 'Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte - Optimize' -- "$cur" ) ) + Optimize' -- "$cur") ) return ;; -units) - COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch - PixelsPerCentimeter' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Undefined PixelsPerInch + PixelsPerCentimeter' -- "$cur") ) return ;; -virtual-pixel) - COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'Constant Edge mirror tile' -- "$cur") ) return ;; -visual) - COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor + COMPREPLY=( $(compgen -W 'StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor defaut visualid' \ - -- "$cur" ) ) + -- "$cur") ) return ;; esac @@ -135,11 +135,11 @@ _convert() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+adjoin +append +compress +contrast +debug + COMPREPLY=( $(compgen -W '+adjoin +append +compress +contrast +debug +dither +endian +gamma +label +map +mask +matte +negate +noise - +page +raise +render +write' -- "$cur" ) ) + +page +raise +render +write' -- "$cur") ) else _filedir fi @@ -154,10 +154,10 @@ _mogrify() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither +endian - +gamma +label +map +mask +matte +negate +page +raise' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +mask +matte +negate +page +raise' -- "$cur") ) else _filedir fi @@ -172,10 +172,10 @@ _display() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither +endian - +gamma +label +map +matte +negate +page +raise +write' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +matte +negate +page +raise +write' -- "$cur") ) else _filedir fi @@ -190,10 +190,10 @@ _animate() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug +dither +gamma +map +matte' \ + -- "$cur") ) else _filedir fi @@ -208,9 +208,9 @@ _identify() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug' -- "$cur") ) else _filedir fi @@ -225,10 +225,10 @@ _montage() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither +endian - +gamma +label +matte +page' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+adjoin +compress +debug +dither +endian + +gamma +label +matte +page' -- "$cur") ) else _filedir fi @@ -243,10 +243,10 @@ _composite() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label - +matte +negate +page +write' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+compress +debug +dither +endian +label + +matte +negate +page +write' -- "$cur") ) else _filedir fi @@ -261,9 +261,9 @@ _compare() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug' -- "$cur") ) else _filedir fi @@ -278,9 +278,9 @@ _conjure() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug' -- "$cur") ) else _filedir fi @@ -295,9 +295,9 @@ _import() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug' -- "$cur") ) else _filedir fi @@ -312,9 +312,9 @@ _stream() _ImageMagick && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '+debug' -- "$cur") ) else _filedir fi diff --git a/completions/cowsay b/completions/cowsay index 4f4411ac..c6cbf813 100644 --- a/completions/cowsay +++ b/completions/cowsay @@ -7,15 +7,15 @@ _cowsay() case $prev in -f) - COMPREPLY=( $( compgen -W \ - '$( cowsay -l 2>/dev/null | tail -n +2 )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(cowsay -l 2>/dev/null | tail -n +2)' -- "$cur") ) return ;; esac # relevant options completion - COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \ + -- "$cur") ) } && complete -F _cowsay -o default cowsay cowthink diff --git a/completions/cpan2dist b/completions/cpan2dist index 9704782d..b24e068c 100644 --- a/completions/cpan2dist +++ b/completions/cpan2dist @@ -8,9 +8,9 @@ _cpan2dist() case $prev in --format) # should remove ":" from COMP_WORDBREAKS, but doesn't work (?) - COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \ + COMPREPLY=( $(compgen -W '$(perl -MCPANPLUS::Dist -e \ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ - -- "$cur" ) ) + -- "$cur") ) return ;; --banlist|--ignorelist|--modulelist|--logfile) @@ -20,16 +20,16 @@ _cpan2dist() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" ) local packagelist - for dir in ${cpandirs[@]}; do + for dir in "${cpandirs[@]}"; do [[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && \ packagelist="$dir/02packages.details.txt.gz" done - [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \ - $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g' ) ) + [[ $packagelist ]] && COMPREPLY=( $(zgrep "^${cur//-/::}" \ + $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g') ) fi } && complete -F _cpan2dist -o default cpan2dist diff --git a/completions/cpio b/completions/cpio index 36e3fe90..bbb1ecf9 100644 --- a/completions/cpio +++ b/completions/cpio @@ -7,22 +7,22 @@ _cpio() # --name value style option case $prev in - -H|--format) - COMPREPLY=( $( compgen -W \ - 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) + --format|-!(-*)H) + COMPREPLY=( $(compgen -W \ + 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur") ) return ;; - -E|-F|-I|--file|--pattern-file) + --file|--pattern-file|-!(-*)[EFI]) _filedir return ;; - -R|--owner) + --owner|-!(-*)R) _usergroup return ;; --rsh-command) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; esac @@ -30,23 +30,23 @@ _cpio() $split && return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through - -? --help --license --usage --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-o --create -i --extract -p --pass-through + -? --help --license --usage --version' -- "$cur") ) else case ${words[1]} in -o|--create) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B -L -V -C -H -M + COMPREPLY=( $(compgen -W '-0 -a -c -v -A -B -L -V -C -H -M -O -F --file --format --message --null --reset-access-time --verbose --dot --append --block-size --dereference --io-size --quiet --force-local --rsh-command --help --version' \ - -- "$cur" ) ) + -- "$cur") ) fi ;; -i|--extract) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r -t -s -u -v + COMPREPLY=( $(compgen -W '-b -c -d -f -m -n -r -t -s -u -v -B -S -V -C -E -H -M -R -I -F --file --make-directories --nonmatching --preserve-modification-time --numeric-uid-gid --rename --list --swap-bytes --swap @@ -55,17 +55,17 @@ _cpio() --owner --no-preserve-owner --message --force-local --no-absolute-filenames --sparse --only-verify-crc --quiet --rsh-command --help --to-stdout --version' \ - -- "$cur" ) ) + -- "$cur") ) fi ;; -p*|--pass-through) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v -L -V -R + COMPREPLY=( $(compgen -W '-0 -a -d -l -m -u -v -L -V -R --null --reset-access-time --make-directories --link --quiet --preserve-modification-time --unconditional --verbose --dot --dereference --owner --no-preserve-owner --sparse --help --version' \ - -- "$cur" ) ) + -- "$cur") ) else _filedir -d fi diff --git a/completions/cppcheck b/completions/cppcheck index 86990dd5..2e487f81 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -23,14 +23,14 @@ _cppcheck() cur="${cur##*,}" split=true fi - COMPREPLY=( $( compgen -W 'all warning style performance + COMPREPLY=( $(compgen -W 'all warning style performance portability information unusedFunction missingInclude' \ - -- "$cur" ) ) + -- "$cur") ) $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) return ;; --error-exitcode) - COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..255}' -- "$cur") ) return ;; --file-list) @@ -43,22 +43,22 @@ _cppcheck() return ;; -j) - COMPREPLY=( $( compgen -W "{2..$(_ncpus)}" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "{2..$(_ncpus)}" -- "$cur") ) return ;; --language|-x) - COMPREPLY=( $( compgen -W 'c c++' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'c c++' -- "$cur") ) return ;; --std) - COMPREPLY=( $( compgen -W 'c89 c99 c11 c++03 c++11 posix' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'c89 c99 c11 c++03 c++11 posix' \ + -- "$cur") ) return ;; --platform) _filedir - COMPREPLY+=( $( compgen -W 'unix32 unix64 win32A win32W win64 - native' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'unix32 unix64 win32A win32W win64 + native' -- "$cur") ) return ;; -rp|--relative-paths) @@ -72,7 +72,7 @@ _cppcheck() return ;; --xml-version) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; esac @@ -80,7 +80,7 @@ _cppcheck() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' diff --git a/completions/crontab b/completions/crontab index bb8d0e24..a5e5cc58 100644 --- a/completions/crontab +++ b/completions/crontab @@ -6,7 +6,7 @@ _crontab() _init_completion || return case $prev in - -u) + -*u) _allowed_users return ;; @@ -36,12 +36,12 @@ _crontab() done if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '${!opts[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${!opts[@]}' -- "$cur") ) return fi # do filenames only if we did not have -l, -r, or -e - [[ "${words[@]}" == *\ -[lre]* ]] || _filedir + [[ "${words[*]}" == *\ -[lre]* ]] || _filedir } && complete -F _crontab crontab diff --git a/completions/cryptsetup b/completions/cryptsetup index 570b27ef..f8be116f 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -2,8 +2,7 @@ _cryptsetup_name() { - COMPREPLY=( $( compgen -X control -W '$( command ls /dev/mapper )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -X control -W '$(command ls /dev/mapper)' -- "$cur") ) } _cryptsetup_device() @@ -18,10 +17,18 @@ _cryptsetup() _init_completion -s || return case $prev in - --key-file|--master-key-file|--header-backup-file|-d) + --help|--version|--cipher|--hash|--*-size|--key-slot|--size|--offset|\ + --skip|--iter-time|--timeout|--tries|-!(-*)[chslSbopitT]) + return + ;; + --key-file|--master-key-file|--header-backup-file|-!(-*)d) _filedir return ;; + --type|-!(-*)M) + COMPREPLY=( $(compgen -W "luks plain loopaes tcrypt" -- "$cur") ) + return + ;; esac $split && return @@ -30,17 +37,16 @@ _cryptsetup() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W 'open close resize status benchmark + COMPREPLY=( $(compgen -W 'open close resize status benchmark repair erase luksFormat luksAddKey luksRemoveKey luksChangeKey luksKillSlot luksUUID isLuks luksDump tcryptDump luksSuspend - luksResume luksHeaderBackup luksHeaderRestore' -- "$cur" ) ) + luksResume luksHeaderBackup luksHeaderRestore' -- "$cur") ) fi else - local args - _count_args + local args; _count_args "" "-!(-*)[chslSbopitTdM]" case $arg in open|create|luksOpen|loopaesOpen|tcryptOpen) case $args in diff --git a/completions/curl b/completions/curl index c28a8ccd..2fe06272 100644 --- a/completions/curl +++ b/completions/curl @@ -6,24 +6,24 @@ _curl() _init_completion || return case $prev in - --ciphers|--connect-timeout|-C|--continue-at|-F|--form|--form-string|\ - --ftp-account|--ftp-alternative-to-user|-P|--ftp-port|-H|--header|-h|\ - --help|--hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\ - --mail-from|--mail-rcpt|--max-filesize|--max-redirs|-m|--max-time|\ - --pass|--proto|--proto-redir|--proxy-user|--proxy1.0|-Q|--quote|-r|\ - --range|-X|--request|--retry|--retry-delay|--retry-max-time|\ - --socks5-gssapi-service|-t|--telnet-option|--tftp-blksize|-z|\ - --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|\ - --write-out|--resolve|--tlsuser|--tlspassword) - return - ;; - -K|--config|-b|--cookie|-c|--cookie-jar|-D|--dump-header|--egd-file|\ - --key|--libcurl|-o|--output|--random-file|-T|--upload-file|--trace|\ - --trace-ascii|--netrc-file) + --ciphers|--connect-timeout|--continue-at|--form|--form-string|\ + --ftp-account|--ftp-alternative-to-user|--ftp-port|--header|--help|\ + --hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\ + --mail-from|--mail-rcpt|--max-filesize|--max-redirs|--max-time|--pass|\ + --proto|--proto-redir|--proxy-user|--proxy1.0|--quote|--range|\ + --request|--retry|--retry-delay|--retry-max-time|\ + --socks5-gssapi-service|--telnet-option|--tftp-blksize|--time-cond|\ + --url|--user|--user-agent|--version|--write-out|--resolve|--tlsuser|\ + --tlspassword|-!(-*)[CFPHhmQrXtzuAVw]) + return + ;; + --config|--cookie|--cookie-jar|--dump-header|--egd-file|\ + --key|--libcurl|--output|--random-file|--upload-file|--trace|\ + --trace-ascii|--netrc-file|-!(-*)[KbcDoT]) _filedir return ;; - --cacert|-E|--cert) + --cacert|--cert|-!(-*)E) _filedir '@(c?(e)rt|cer|pem|der)' return ;; @@ -32,14 +32,14 @@ _curl() return ;; --cert-type|--key-type) - COMPREPLY=( $( compgen -W 'DER PEM ENG' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'DER PEM ENG' -- "$cur") ) return ;; --crlfile) _filedir crl return ;; - -d|--data|--data-ascii|--data-binary|--data-urlencode) + --data|--data-ascii|--data-binary|--data-urlencode|-!(-*)d) if [[ $cur == \@* ]]; then cur=${cur:1} _filedir @@ -48,26 +48,26 @@ _curl() return ;; --delegation) - COMPREPLY=( $( compgen -W 'none policy always' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'none policy always' -- "$cur") ) return ;; --engine) - COMPREPLY=( $( compgen -W 'list' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'list' -- "$cur") ) return ;; --ftp-method) - COMPREPLY=( $( compgen -W 'multicwd nocwd singlecwd' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'multicwd nocwd singlecwd' -- "$cur") ) return ;; --ftp-ssl-ccc-mode) - COMPREPLY=( $( compgen -W 'active passive' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'active passive' -- "$cur") ) return ;; --interface) _available_interfaces -a return ;; - -x|--proxy|--socks4|--socks4a|--socks5|--socks5-hostname) + --proxy|--socks4|--socks4a|--socks5|--socks5-hostname|-!(-*)x) _known_hosts_real -- "$cur" return ;; @@ -76,18 +76,18 @@ _curl() return ;; --stderr) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-' -- "$cur") ) _filedir return ;; --tlsauthtype) - COMPREPLY=( $( compgen -W 'SRP' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'SRP' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _curl curl diff --git a/completions/cvs b/completions/cvs index fee256f2..0fb49f9c 100644 --- a/completions/cvs +++ b/completions/cvs @@ -4,7 +4,7 @@ _cvs_entries() { local prefix=${cur%/*}/ IFS=$'\n' [[ -e ${prefix:-}CVS/Entries ]] || prefix="" - entries=( $( cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null ) ) + entries=( $(cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null) ) if [[ $entries ]]; then entries=( "${entries[@]/#/${prefix:-}}" ) compopt -o filenames @@ -14,9 +14,9 @@ _cvs_entries() _cvs_modules() { if [[ -n $prefix ]]; then - COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) ) + COMPREPLY=( $(command ls -d ${cvsroot}/${prefix}/!(CVSROOT)) ) else - COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) ) + COMPREPLY=( $(command ls -d ${cvsroot}/!(CVSROOT)) ) fi } @@ -27,21 +27,21 @@ _cvs_commands() _cvs_command_options() { - COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $2" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" "--help $2")' -- "$cur") ) } _cvs_kflags() { - COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'kv kvl k o b v' -- "$cur") ) } _cvs_roots() { local -a cvsroots cvsroots=( $CVSROOT ) - [[ -r ~/.cvspass ]] && cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) ) - [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root - COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) ) + [[ -r ~/.cvspass ]] && cvsroots+=( $(awk '{ print $2 }' ~/.cvspass) ) + [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots <CVS/Root + COMPREPLY=( $(compgen -W '${cvsroots[@]}' -- "$cur") ) __ltrim_colon_completions "$cur" } @@ -62,11 +62,11 @@ _cvs() fi if [[ -z $mode ]]; then case $i in - -H|--help) - COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) ) + --help|-!(-*)H) + COMPREPLY=( $(compgen -W "$(_cvs_commands)" -- "$cur") ) return ;; - -d) + -!(-*)d) mode=cvsroot cvsroot=${words[((count+1))]} ;; @@ -134,16 +134,17 @@ _cvs() elif [[ "$i" == -* ]]; then flags+=( $i ) fi - count=$((++count)) + (( count++ )) done case $mode in add) case $prev in - -m) + --*) ;; + -*m) return ;; - -k) + -*k) _cvs_kflags return ;; @@ -152,9 +153,9 @@ _cvs() if [[ "$cur" != -* ]]; then _cvs_entries [[ -z $cur ]] && files=( !(CVS) ) || \ - files=( $( command ls -d ${cur}* 2>/dev/null ) ) + files=( $(command ls -d ${cur}* 2>/dev/null) ) local f - for i in ${!files[@]}; do + for i in "${!files[@]}"; do if [[ ${files[i]} == ?(*/)CVS ]]; then unset 'files[i]' else @@ -166,22 +167,23 @@ _cvs() done fi done - COMPREPLY=( $( compgen -X "$_backup_glob" -W '${files[@]}' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -X "$_backup_glob" -W '${files[@]}' \ + -- "$cur") ) else _cvs_command_options "$1" $mode fi ;; admin) case $prev in - -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u) + --*) ;; + -*@([aAbcelmnNosu]|t-)) return ;; - -t) + -*t) _filedir return ;; - -k) + -*k) _cvs_kflags return ;; @@ -191,7 +193,7 @@ _cvs() _cvs_command_options "$1" $mode else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") ) fi ;; annotate) @@ -201,19 +203,20 @@ _cvs() _cvs_command_options "$1" $mode else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") ) fi ;; checkout) case $prev in - -r|-D|-j) + --*) ;; + -*[rDj]) return ;; - -d) + -*d) _filedir -d return ;; - -k) + -*k) _cvs_kflags return ;; @@ -221,19 +224,20 @@ _cvs() if [[ "$cur" != -* ]]; then [[ -z $cvsroot ]] && cvsroot=$CVSROOT - COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \ - awk '{print $1}' ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(cvs -d "$cvsroot" co -c 2>/dev/null | \ + awk '{print $1}') ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) else _cvs_command_options "$1" $mode fi ;; commit) case $prev in - -m|-r) + --*) ;; + -*[mr]) return ;; - -F) + -*F) _filedir return ;; @@ -247,15 +251,15 @@ _cvs() # this is the least computationally intensive way found so # far, but other changes (something other than # changed/removed/new) may be missing - changed=( $( cvs -q diff --brief 2>&1 | \ - command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) - newremoved=( $( cvs -q diff --brief 2>&1 | \ - command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) - COMPREPLY=( $( compgen -W '${changed[@]:-} \ - ${newremoved[@]:-}' -- "$cur" ) ) + changed=( $(cvs -q diff --brief 2>&1 | \ + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p') ) + newremoved=( $(cvs -q diff --brief 2>&1 | \ + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p') ) + COMPREPLY=( $(compgen -W '${changed[@]:-} \ + ${newremoved[@]:-}' -- "$cur") ) else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") ) fi else _cvs_command_options "$1" $mode @@ -264,13 +268,13 @@ _cvs() cvsroot) _cvs_roots ;; - diff) + diff|log) if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode [[ $COMPREPLY == *= ]] && compopt -o nospace else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]:-}' -- "$cur") ) fi ;; editors|watchers) @@ -278,19 +282,20 @@ _cvs() _cvs_command_options "$1" $mode else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") ) fi ;; export) case $prev in - -r|-D) + --*) ;; + -*[rD]) return ;; - -d) + -*d) _filedir -d return ;; - -k) + -*k) _cvs_kflags return ;; @@ -298,18 +303,19 @@ _cvs() if [[ "$cur" != -* ]]; then [[ -z $cvsroot ]] && cvsroot=$CVSROOT - COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(cvs -d "$cvsroot" co -c | awk '{print $1}') ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) else _cvs_command_options "$1" $mode fi ;; import) case $prev in - -I|-b|-m|-W) + --*) ;; + -*[IbmW]) return ;; - -k) + -*k) _cvs_kflags return ;; @@ -324,9 +330,9 @@ _cvs() COMPREPLY=( ${COMPREPLY[@]#$cvsroot} ) COMPREPLY=( ${COMPREPLY[@]#\/} ) fi - pwd=$( pwd ) + pwd=$(pwd) pwd=${pwd##*/} - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} $pwd' -- "$cur") ) else _cvs_command_options "$1" $mode fi @@ -336,21 +342,22 @@ _cvs() _cvs_entries if [[ "$prev" != -f ]]; then # find out what files are missing - for i in ${!entries[@]}; do + for i in "${!entries[@]}"; do [[ -r "${entries[i]}" ]] && unset 'entries[i]' done fi - COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]:-}' -- "$cur") ) else _cvs_command_options "$1" $mode fi ;; update) case $prev in - -r|-D|-j|-I|-W) + --*) ;; + -*[rDjIW]) return ;; - -k) + -*k) _cvs_kflags return ;; @@ -360,27 +367,28 @@ _cvs() _cvs_command_options "$1" $mode else _cvs_entries - COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") ) fi ;; "") case $prev in - -T) + --*) ;; + -*T) _filedir -d return ;; - -e|-s) + -*[es]) return ;; - -z) - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + -*z) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W '$( _cvs_commands ) - $( _parse_help "$1" --help-options ) --help --help-commands - --help-options --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_cvs_commands) + $(_parse_help "$1" --help-options) --help --help-commands + --help-options --version' -- "$cur") ) ;; esac diff --git a/completions/cvsps b/completions/cvsps index 64dab54f..721a5b73 100644 --- a/completions/cvsps +++ b/completions/cvsps @@ -10,23 +10,23 @@ _cvsps() return ;; -s) - COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | - awk '/^PatchSet:?[ \t]/ { print $2 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 2>/dev/null | + awk '/^PatchSet:?[ \t]/ { print $2 }')" -- "$cur") ) return ;; -a) - COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | - awk '/^Author:[ \t]/ { print $2 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 2>/dev/null | + awk '/^Author:[ \t]/ { print $2 }')" -- "$cur") ) return ;; -b) - COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | - awk '/^Branch:[ \t]/ { print $2 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 2>/dev/null | + awk '/^Branch:[ \t]/ { print $2 }')" -- "$cur") ) return ;; -r) - COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | - awk '/^Tag:[ \t]+[^(]/ { print $2 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 2>/dev/null | + awk '/^Tag:[ \t]+[^(]/ { print $2 }')" -- "$cur") ) return ;; -p) @@ -38,7 +38,7 @@ _cvsps() return ;; -Z) - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) return ;; --root) @@ -47,8 +47,8 @@ _cvsps() ;; esac - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) else _xfunc cvs _cvs_roots fi diff --git a/completions/dd b/completions/dd index b2647bca..5384dd5e 100644 --- a/completions/dd +++ b/completions/dd @@ -13,28 +13,28 @@ _dd() ;; conv=*) cur=${cur#*=} - COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase + COMPREPLY=( $(compgen -W 'ascii ebcdic ibm block unblock lcase ucase sparse swab sync excl nocreat notrunc noerror fdatasync - fsync' -- "$cur" ) ) + fsync' -- "$cur") ) return ;; iflag=*|oflag=*) cur=${cur#*=} - COMPREPLY=( $( compgen -W 'append direct directory dsync sync + COMPREPLY=( $(compgen -W 'append direct directory dsync sync fullblock nonblock noatime nocache noctty nofollow count_bytes - skip_bytes seek_bytes' -- "$cur" ) ) + skip_bytes seek_bytes' -- "$cur") ) return ;; status=*) cur=${cur#*=} - COMPREPLY=( $( compgen -W 'none noxfer progress' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'none noxfer progress' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \ - $( compgen -W 'bs cbs conv count ibs if iflag obs of oflag - seek skip status' -S '=' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") \ + $(compgen -W 'bs cbs conv count ibs if iflag obs of oflag + seek skip status' -S '=' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _dd dd diff --git a/completions/deja-dup b/completions/deja-dup index a508bb1e..ad3baeb8 100644 --- a/completions/deja-dup +++ b/completions/deja-dup @@ -22,8 +22,7 @@ _deja_dup() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/desktop-file-validate b/completions/desktop-file-validate index 93f21061..7d9f05b2 100644 --- a/completions/desktop-file-validate +++ b/completions/desktop-file-validate @@ -12,7 +12,7 @@ _desktop_file_validate() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/dhclient b/completions/dhclient index 24270c7e..b097bbac 100644 --- a/completions/dhclient +++ b/completions/dhclient @@ -6,7 +6,14 @@ _dhclient() _init_completion || return case $prev in - -cf|-lf|-pf|-sf) + -p|-e) + return + ;; + -D) + COMPREPLY=( $(compgen -W 'LL LLT' -- "$cur") ) + return + ;; + -*f) _filedir return ;; @@ -17,8 +24,7 @@ _dhclient() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf -cf -sf -s -g -n -nw - -w' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _available_interfaces fi diff --git a/completions/dict b/completions/dict index ac7df3fc..c3ea9906 100644 --- a/completions/dict +++ b/completions/dict @@ -15,36 +15,33 @@ _dict() for (( i=1; i < cword; i++ )); do case ${words[i]} in - -h|--host) - host=${words[i+1]} + --host|-!(-*)h) + host=${words[++i]} [[ -n $host ]] && host="-h $host" - i=$((++i)) ;; - -p|--port) - port=${words[i+1]} + --port|-!(-*)p) + port=${words[++i]} [[ -n $port ]] && port="-p $port" - i=$((++i)) ;; - -d|--database) - db=${words[i+1]} + --database|-!(-*)d) + db=${words[++i]} [[ -n $db ]] && host="-d $db" - i=$((++i)) ;; esac done if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi case $prev in - -d|--database|-i|-info) - COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) + --database|-info|-!(-*)[di]) + COMPREPLY=( $(compgen -W '$(_dictdata -D)' -- "$cur") ) return ;; - -s|--strategy) - COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) + --strategy|-!(-*)s) + COMPREPLY=( $(compgen -W '$(_dictdata -S)' -- "$cur") ) return ;; esac @@ -55,10 +52,10 @@ _dict() # it down with grep if $cur looks like something that's safe to embed # in a pattern instead. if [[ $cur == +([-A-Za-z0-9/.]) ]]; then - COMPREPLY=( $( compgen -W \ - '$( command grep "^${cur//./\\.}" $dictfile )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(command grep "^${cur//./\\.}" $dictfile)' -- "$cur") ) else - COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(cat $dictfile)' -- "$cur") ) fi fi } && diff --git a/completions/dnssec-keygen b/completions/dnssec-keygen new file mode 100644 index 00000000..2ecfcdc5 --- /dev/null +++ b/completions/dnssec-keygen @@ -0,0 +1,48 @@ +# bash completion for dnssec-keygen(8) -*- shell-script -*- + +_dnssec_keygen_optarg() +{ + local args=$("$1" -h 2>&1 | \ + command sed -e 's/|/ /g' -e 's/(.*//' \ + -ne '/^[[:space:]]*'$2'/,/^[[:space:]]*[(-]/p' | \ + command sed -e 's/^[[:space:]]*'$2'.*://' -e '/^[[:space:]]*-/d') + COMPREPLY+=( $(compgen -W '$args' -- "$cur") ) +} + +_dnssec_keygen() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -[hbEgLpsPARIDSi]) + return + ;; + -K) + _filedir -d + return + ;; + -[ancdfTtm]) + _dnssec_keygen_optarg "$1" $prev + return + ;; + -r) + cur=${cur:=/dev/} + _filedir + return + ;; + -v) + COMPREPLY=( $(compgen -W '{0..10}' -- "$cur") ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1" | \ + command sed -e "s/:\$//")' -- "$cur") ) + return + fi +} && +complete -F _dnssec_keygen dnssec-keygen + +# ex: filetype=sh diff --git a/completions/dnsspoof b/completions/dnsspoof index d6b7872b..e45d48d6 100644 --- a/completions/dnsspoof +++ b/completions/dnsspoof @@ -17,7 +17,7 @@ _dnsspoof() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/dot b/completions/dot index bc3531bb..bad82f2c 100644 --- a/completions/dot +++ b/completions/dot @@ -12,28 +12,28 @@ _dot() return ;; -T*) - local langs=( $( "$1" -TNON_EXISTENT 2>&1 | \ - command sed -ne 's/.*one of://p' ) ) - COMPREPLY=( $( compgen -P -T -W '${langs[@]}' -- "${cur#-T}" ) ) + local langs=( $("$1" -TNON_EXISTENT 2>&1 | \ + command sed -ne 's/.*one of://p') ) + COMPREPLY=( $(compgen -P -T -W '${langs[@]}' -- "${cur#-T}") ) return ;; -K*) - local layouts=( $( "$1" -KNON_EXISTENT 2>&1 | \ - command sed -ne 's/.*one of://p' ) ) - COMPREPLY=( $( compgen -P -K -W '${layouts[@]}' -- "${cur#-K}" ) ) + local layouts=( $("$1" -KNON_EXISTENT 2>&1 | \ + command sed -ne 's/.*one of://p') ) + COMPREPLY=( $(compgen -P -K -W '${layouts[@]}' -- "${cur#-K}") ) return ;; -o*) cur=${cur#-o} _filedir - COMPREPLY=( $( compgen -P -o -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -P -o -W '${COMPREPLY[@]}' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n - -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n + -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur") ) [[ $COMPREPLY == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace return fi diff --git a/completions/dpkg b/completions/dpkg index 76dd5b01..827d9cad 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -3,7 +3,7 @@ _have grep-status && { _comp_dpkg_installed_packages() { - grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package + grep-status -P -e "^$1" -a -FStatus 'ok installed' -n -s Package } } || { _comp_dpkg_installed_packages() @@ -19,7 +19,7 @@ _comp_dpkg_installed_packages() _have grep-status && { _comp_dpkg_purgeable_packages() { - grep-status -P -e "^$1" -a -FStatus 'install ok installed' -o -FStatus 'deinstall ok config-files' -n -s Package + grep-status -P -e "^$1" -a -FStatus 'ok installed' -o -FStatus 'ok config-files' -n -s Package } } || { _comp_dpkg_purgeable_packages() @@ -44,43 +44,41 @@ _dpkg() # find the last option flag if [[ $cur != -* ]]; then while [[ $prev != -* && $i -ne 1 ]]; do - i=$((i-1)) - prev=${words[i-1]} + prev=${words[--i - 1]} done fi case $prev in - -c|-i|-A|-I|-f|-e|-x|-W|--install|--unpack|--record-avail| \ - --contents|--info|--fsys-tarfile|--field|--control|--extract| \ - --vextract) + --install|--unpack|--record-avail|--contents|--info|--fsys-tarfile|\ + --field|--control|--extract|--vextract|-!(-*)[ciAIfexW]) _filedir '?(u|d)deb' return ;; - -b|--build) + --build|-!(-*)b) _filedir -d return ;; - -s|-p|-l|-W|--status|--print-avail|--list|--show) - COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) + --status|--print-avail|--list|--show|-!(-*)[splW]) + COMPREPLY=( $(apt-cache pkgnames "$cur" 2>/dev/null) ) return ;; - -S|--search) + --search|-!(-*)S) _filedir return ;; - -r|-V|--remove|--verify) - COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) + --remove|--verify|-!(-*)[rV]) + COMPREPLY=( $(_comp_dpkg_installed_packages "$cur") ) return ;; - -L|-P|--listfiles|--purge) - COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) ) + --listfiles|--purge|-!(-*)[LP]) + COMPREPLY=( $(_comp_dpkg_purgeable_packages "$cur") ) return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _dpkg dpkg dpkg-deb dpkg-query @@ -95,15 +93,15 @@ _dpkg_reconfigure() local opt case $prev in - -f|--frontend) - opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) ) + --frontend|-!(-*)f) + opt=( $(printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/*) ) opt=( ${opt[@]##*/} ) opt=( ${opt[@]%.pm} ) - COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${opt[@]}' -- "$cur") ) return ;; - -p|--priority) - COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) ) + --priority|-!(-*)p) + COMPREPLY=( $(compgen -W 'low medium high critical' -- "$cur") ) return ;; esac @@ -112,7 +110,7 @@ _dpkg_reconfigure() COMPREPLY=( $(compgen -W '--frontend --priority --all --unseen-only --help --showold --force --terse' -- "$cur" ) ) else - COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) + COMPREPLY=( $(_comp_dpkg_installed_packages "$cur") ) fi } && complete -F _dpkg_reconfigure -o default dpkg-reconfigure diff --git a/completions/dpkg-source b/completions/dpkg-source index 54403851..ffc34c41 100644 --- a/completions/dpkg-source +++ b/completions/dpkg-source @@ -10,7 +10,7 @@ _dpkg_source() packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ -sU -sR" unpackopts="-sp -sn -su" - options="-x -b $packopts $unpackopts" + options="-x -b --print-format --before-build --after-build --commit $packopts $unpackopts" fields="Format Source Version Binary Maintainer Uploader Architecture \ Standards-Version Build-Depends Files" @@ -33,7 +33,7 @@ _dpkg_source() _filedir 'dsc' ;; *) - COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$unpackopts" -- "$cur") ) _filedir -d _filedir ;; @@ -57,7 +57,7 @@ _dpkg_source() ;; -F) # -F: force change log format - COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) + COMPREPLY=( $(command ls /usr/lib/dpkg/parsechangelog) ) ;; -V|-D) # -V: set a substitution variable @@ -72,23 +72,23 @@ _dpkg_source() # $cur contains a "=" COMPREPLY=() else - COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$fields" -- "$cur") ) fi ;; -U) # -U: remove a field # Suggest possible fieldnames - COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$fields" -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W "$packopts $unpackopts" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$packopts $unpackopts" \ + -- "$cur") ) ;; esac return ;; *) - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) return ;; esac diff --git a/completions/dselect b/completions/dselect index e5f148cb..6ad38842 100644 --- a/completions/dselect +++ b/completions/dselect @@ -17,11 +17,10 @@ _dselect() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--admindir --help --version --licence - --expert --debug' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'access update select install config remove - quit' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'access update select install config remove + quit' -- "$cur") ) fi } && diff --git a/completions/dsniff b/completions/dsniff index 165ab74b..e8e5bf37 100644 --- a/completions/dsniff +++ b/completions/dsniff @@ -17,7 +17,7 @@ _dsniff() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -r -w -p' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1") -r -w -p' -- "$cur") ) fi } && diff --git a/completions/dumpdb b/completions/dumpdb index ced754f5..981211bb 100644 --- a/completions/dumpdb +++ b/completions/dumpdb @@ -6,8 +6,8 @@ _dumpdb() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--marshal --pickle --noprint --help' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--marshal --pickle --noprint --help' \ + -- "$cur") ) else _filedir fi diff --git a/completions/dumpe2fs b/completions/dumpe2fs index 90f84791..f44ecc32 100644 --- a/completions/dumpe2fs +++ b/completions/dumpe2fs @@ -6,17 +6,17 @@ _dumpe2fs() _init_completion || return case $prev in - -o|-V) + -*[oV]) return ;; - -i) + -*i) _filedir return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/e2freefrag b/completions/e2freefrag index bee4a169..355ebb94 100644 --- a/completions/e2freefrag +++ b/completions/e2freefrag @@ -12,7 +12,7 @@ _e2freefrag() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" -h)' -- "$cur") ) return fi diff --git a/completions/ebtables b/completions/ebtables index 05af7e39..325962b5 100644 --- a/completions/ebtables +++ b/completions/ebtables @@ -8,45 +8,40 @@ _ebtables() local table chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \ targets='ACCEPT DROP CONTINUE RETURN' - if [[ ${words[@]} == *-t\ *filter* ]]; then - table="-t filter" - elif [[ ${words[@]} == *-t\ *nat* ]]; then - table="-t nat" - elif [[ ${words[@]} == *-t\ *mangle* ]]; then - table="-t mangle" - fi + [[ "${words[*]}" =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] \ + && table="-t ${BASH_REMATCH[2]}" case $prev in - -*[AIDPFXLZ]) - COMPREPLY=( $( compgen -W '`"$1" $table -L 2>/dev/null | \ - command sed -ne "$chain"`' -- "$cur" ) ) + -!(-*)[AIDPFXLZ]) + COMPREPLY=( $(compgen -W '`"$1" $table -L 2>/dev/null | \ + command sed -ne "$chain"`' -- "$cur") ) ;; - -*t) - COMPREPLY=( $( compgen -W 'nat filter broute' -- "$cur" ) ) + -!(-*)t) + COMPREPLY=( $(compgen -W 'nat filter broute' -- "$cur") ) ;; - -j) + -!(-*)j) if [[ "$table" == "-t filter" || -z "$table" ]]; then - COMPREPLY=( $( compgen -W '$targets + COMPREPLY=( $(compgen -W '$targets $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \ -e "$chain")' \ - -- "$cur" ) ) + -- "$cur") ) elif [[ $table == "-t nat" ]]; then - COMPREPLY=( $( compgen -W '$targets + COMPREPLY=( $(compgen -W '$targets $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \ -e "$chain")' \ - -- "$cur" ) ) + -- "$cur") ) elif [[ $table == "-t broute" ]]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP + COMPREPLY=( $(compgen -W 'ACCEPT DROP $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/BROUTING//" -e "$chain")' \ - -- "$cur" ) ) + -- "$cur") ) fi ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--802_3-sap --802_3-type --among-dst + COMPREPLY=( $(compgen -W '--802_3-sap --802_3-type --among-dst --among-dst-file --among-src --among-src-file --append --arp-gratuitous --arp-htype --arp-ip-dst --arp-ip-src --arp-mac-dst --arp-mac-src --arp-opcode --arp-ptype --arpreply-mac @@ -72,7 +67,7 @@ _ebtables() --stp-sender-prio --stp-type --table --to-destination --to-dst --to-source --to-src --ulog --ulog-cprange --ulog-nlgroup --ulog-prefix --ulog-qthreshold --version --vlan-encap --vlan-id - --vlan-prio --zero' -- "$cur" ) ) + --vlan-prio --zero' -- "$cur") ) fi ;; esac diff --git a/completions/ecryptfs-migrate-home b/completions/ecryptfs-migrate-home new file mode 100644 index 00000000..bad0962e --- /dev/null +++ b/completions/ecryptfs-migrate-home @@ -0,0 +1,22 @@ +# ecryptfs-migrate-home(8) completion -*- shell-script -*- + +_ecryptfs_migrate_home() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help) + return + ;; + --user|-u) + COMPREPLY=( $(compgen -u -- "$cur") ) + return + ;; + esac + + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) +} && +complete -F _ecryptfs_migrate_home ecryptfs-migrate-home + +# ex: filetype=sh diff --git a/completions/eog b/completions/eog index d5621119..d10cbbae 100644 --- a/completions/eog +++ b/completions/eog @@ -14,8 +14,7 @@ _eog() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/ether-wake b/completions/ether-wake index 387b2d64..a3e3e406 100644 --- a/completions/ether-wake +++ b/completions/ether-wake @@ -16,12 +16,12 @@ _ether_wake() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -u) -V' -- "$cur") ) return fi _mac_addresses } && -complete -F _ether_wake ether-wake +complete -F _ether_wake ether-wake etherwake # ex: filetype=sh diff --git a/completions/evince b/completions/evince index eb6c7305..d50f23c3 100644 --- a/completions/evince +++ b/completions/evince @@ -6,9 +6,9 @@ _evince() _init_completion -s || return case $prev in - --help*|-h|--sm-client-id|--class|--name|--screen|--gdk-debug|\ - --gdk-no-debug|--gtk-module|--gtk-debug|--gtk-no-debug|\ - -p|--page-label|-i|--page-index|-l|--find|--display) + --help*|--sm-client-id|--class|--name|--screen|--gdk-debug|\ + --gdk-no-debug|--gtk-module|--gtk-debug|--gtk-no-debug|--page-label|\ + --page-index|--find|--display|-!(-*)[hpil]) return ;; --sm-client-state-file) @@ -20,8 +20,7 @@ _evince() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/export b/completions/export index 31715f9a..816182f6 100644 --- a/completions/export +++ b/completions/export @@ -33,7 +33,7 @@ _export() case $cur in *=) - local pval=$( quote "$( eval printf %s \"\$${cur%=}\" )" ) + local pval=$(quote "$(eval printf %s \"\$${cur%=}\")") # Complete previous value if it's not empty. if [[ $pval != \'\' ]]; then COMPREPLY=( "$pval" ) @@ -48,8 +48,7 @@ _export() ;; *) if [[ $cword -eq 1 && $cur == -* ]]; then - COMPREPLY=( $( compgen -W \ - '-p $( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-p $(_parse_usage "$1")' -- "$cur") ) return fi local suffix @@ -57,7 +56,7 @@ _export() suffix+== compopt -o nospace fi - COMPREPLY=( $( compgen -A $action -S "$suffix" -- "$cur" ) ) + COMPREPLY=( $(compgen -A $action -S "$suffix" -- "$cur") ) ;; esac } && diff --git a/completions/faillog b/completions/faillog index 3b4a23d0..5e7d2ab2 100644 --- a/completions/faillog +++ b/completions/faillog @@ -6,11 +6,11 @@ _faillog() _init_completion -s || return case $prev in - -h|--help|-l|--lock-time|-m|--maximum|-t|--time) + --help|--lock-time|--maximum|--time|-!(-*)[hlmt]) return ;; - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|-!(-*)u) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; esac @@ -18,7 +18,7 @@ _faillog() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/fbgs b/completions/fbgs index c58a7af9..7a3ad7be 100644 --- a/completions/fbgs +++ b/completions/fbgs @@ -8,23 +8,23 @@ _fbgs() case "$prev" in -f|--font) local IFS=$'\n' - COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(fc-list 2>/dev/null)' -- "$cur") ) return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( command sed \ + COMPREPLY=( $(compgen -W '$(command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ - /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) + /etc/fb.modes 2>/dev/null)' -- "$cur") ) return ;; -d|--device) - COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + COMPREPLY=( $(compgen -f -d -- "${cur:-/dev/}") ) return ;; -fp|--firstpage|-lp|--lastpage|-r|--resolution|-s|--scroll|-t|\ --timeout) # expect integer value - COMPREPLY+=( $( compgen -W '{0..9}' ) ) + COMPREPLY+=( $(compgen -W '{0..9}') ) compopt -o nospace return ;; @@ -35,11 +35,11 @@ _fbgs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--bell --help --password -fp --firstpage + COMPREPLY=( $(compgen -W '--bell --help --password -fp --firstpage -lp --lastpage --color -l -xl -xxl --resolution --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose --{,no}random --vt --scroll --timeout --{,no}once --gamma --font - --device --mode' -- "$cur" ) ) + --device --mode' -- "$cur") ) [[ $COMPREPLY ]] && return fi diff --git a/completions/fbi b/completions/fbi index 75b46b61..ac92e60f 100644 --- a/completions/fbi +++ b/completions/fbi @@ -11,22 +11,22 @@ _fbi() return ;; -r|--resolution) - COMPREPLY+=( $( compgen -W '{1..5}' ) ) + COMPREPLY+=( $(compgen -W '{1..5}') ) return ;; -f|--font) local IFS=$'\n' - COMPREPLY=( $( compgen -W '$( fc-list 2> /dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(fc-list 2>/dev/null)' -- "$cur") ) return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( command sed \ + COMPREPLY=( $(compgen -W '$(command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ - /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) + /etc/fb.modes 2>/dev/null)' -- "$cur") ) return ;; -d|--device) - COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + COMPREPLY=( $(compgen -f -d -- "${cur:-/dev/}") ) return ;; --cachemem|--blend|-T|--vt|-s|--scroll|-t|--timeout|-g|--gamma) @@ -36,12 +36,12 @@ _fbi() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version --store --list --text + COMPREPLY=( $(compgen -W '--help --version --store --list --text --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose --{,no}random --{,no}comments --{,no}edit --{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend --vt --scroll --timeout --{,no}once --resolution --gamma --font - --device --mode' -- "$cur" ) ) + --device --mode' -- "$cur") ) [[ $COMPREPLY ]] && return fi diff --git a/completions/feh b/completions/feh index 1cd75420..71e59798 100644 --- a/completions/feh +++ b/completions/feh @@ -6,40 +6,40 @@ _feh() _init_completion -s || return case "$prev" in - -B|--image-bg) - COMPREPLY=( $( compgen -W 'checks white black' -- "$cur" ) ) + --image-bg|-B) + COMPREPLY=( $(compgen -W 'checks white black' -- "$cur") ) return ;; - -f|--filelist|-o|--output|-O|--output-only|-\||--start-at) + --filelist|--output|--output-only|--start-at|-!(-*)[foO\|]) _filedir return ;; - -K|--caption-path|-C|--fontpath|-j|--output-dir) + --caption-path|--fontpath|--output-dir|-!(-*)[KCj]) _filedir -d return ;; - -e|--font|-M|--menu-font|-@|--title-font) + --font|--menu-font|--title-font|-!(-*)[eM@]) # expect string like "dejavu.ttf/12" if [[ "$cur" == */* ]]; then # expect integer value - COMPREPLY=( $( compgen -P "$cur" -W '{0..9}' ) ) + COMPREPLY=( $(compgen -P "$cur" -W '{0..9}') ) compopt -o nospace return fi local font_path - # font_path="$( imlib2-config --prefix 2> /dev/null )/share/imlib2/data/fonts" - # COMPREPLY=( $( cd "$font_path" 2> /dev/null; compgen -f \ - # -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) ) + # font_path="$(imlib2-config --prefix 2>/dev/null)/share/imlib2/data/fonts" + # COMPREPLY=( $(cd "$font_path" 2>/dev/null; compgen -f \ + # -X "!*.@([tT][tT][fF])" -S / -- "$cur") ) for (( i=${#words[@]}-1; i>0; i-- )); do if [[ ${words[i]} == -@(C|-fontpath) ]]; then font_path="${words[i+1]}" - COMPREPLY+=( $( cd "$font_path" 2> /dev/null; compgen -f \ - -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) ) + COMPREPLY+=( $(cd "$font_path" 2>/dev/null; compgen -f \ + -X "!*.@([tT][tT][fF])" -S / -- "$cur") ) fi done compopt -o nospace return ;; - -T|--theme) + --theme|-!(-*)T) local conf_path=~/.config/feh/themes local theme_name theme_opts [[ -r $conf_path ]] || return @@ -47,51 +47,51 @@ _feh() if [[ "$theme_name" == '#'* || "$theme_name" == "" ]]; then continue fi - COMPREPLY+=( $( compgen -W "$theme_name" -- "$cur" ) ) - done < "$conf_path" + COMPREPLY+=( $(compgen -W "$theme_name" -- "$cur") ) + done <"$conf_path" return ;; - -S|--sort) - COMPREPLY=( $( compgen -W 'name filename mtime width height - pixels size format' -- "$cur" ) ) + --sort|-!(-*)S) + COMPREPLY=( $(compgen -W 'name filename mtime width height + pixels size format' -- "$cur") ) return ;; - -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\ - -y|--thumb-width|-J|--thumb-redraw|--magick-timeout) + --reload|--limit-height|--limit-width|--thumb-height|--thumb-width|\ + --thumb-redraw|--magick-timeout|-!(-*)[RHWEyJ]) # expect integer value - COMPREPLY+=( $( compgen -W '{0..9}' ) ) + COMPREPLY+=( $(compgen -W '{0..9}') ) compopt -o nospace return ;; --zoom) # expect integer value or "max", "fill" - COMPREPLY=( $( compgen -W 'max fill' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'max fill' -- "$cur") ) if [[ ! $cur || ! $COMPREPLY ]]; then - COMPREPLY+=( $( compgen -W '{0..9}' ) ) + COMPREPLY+=( $(compgen -W '{0..9}') ) compopt -o nospace fi return ;; - -a|--alpha) - COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) + --alpha|-!(-*)a) + COMPREPLY=( $(compgen -W '{0..255}' -- "$cur") ) return ;; - -b|--bg) + --bg|-!(-*)b) _filedir - COMPREPLY+=( $( compgen -W 'trans' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'trans' -- "$cur") ) return ;; - -g|--geometry|--max-dimension|--min-dimension) + --geometry|--max-dimension|--min-dimension|-!(-*)g) # expect string like 640x480 if [[ $cur && "$cur" != *x* ]]; then COMPREPLY=( x ) fi - COMPREPLY+=( $( compgen -W "{0..9}" ) ) + COMPREPLY+=( $(compgen -W "{0..9}") ) compopt -o nospace return ;; - -L|--customlist|--index-info|--info|-D|--slideshow-delay|-~|\ - --thumb-title|-^|--title) + --customlist|--index-info|--info|--slideshow-delay|--thumb-title|\ + --title|-!(-*)[LD~^]) # argument required but no completions available return ;; @@ -101,7 +101,7 @@ _feh() if [[ "$cur" == -* ]]; then # Some versions of feh just output "See 'man feh'" for --help :( - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return fi diff --git a/completions/file b/completions/file index f3f6df88..494c7866 100644 --- a/completions/file +++ b/completions/file @@ -6,22 +6,22 @@ _file() _init_completion || return case $prev in - --help|-v|--version|-F|--separator) + --help|--version|--separator|-!(-*)[vF]) return ;; - -m|--magic-file|-f|--files-from) + --magic-file|--files-from|-!(-*)[mf]) _filedir return ;; - -e|--exclude) - COMPREPLY=( $( compgen -W 'apptype ascii cdf compress elf encoding - soft tar text tokens troff' -- "$cur" ) ) + --exclude|-!(-*)e) + COMPREPLY=( $(compgen -W 'apptype ascii cdf compress elf encoding + soft tar text tokens troff' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/file-roller b/completions/file-roller index efa73bb1..bebf04ee 100644 --- a/completions/file-roller +++ b/completions/file-roller @@ -8,19 +8,19 @@ _file_roller() 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]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' case $prev in - -'?'|--help|--help-all|--help-gtk|--help-sm-client) + --help|--help-all|--help-gtk|--help-sm-client|-!(-*)'?') return ;; --sm-client-state-file) _filedir return ;; - -a|--add-to) + --add-to|-!(-*)a) _filedir_xspec unzip _filedir "$exts" return ;; - -e|--extract-to|--default-dir) + --extract-to|--default-dir|-!(-*)e) _filedir -d return ;; @@ -29,8 +29,7 @@ _file_roller() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/filefrag b/completions/filefrag index b4866dc0..b8b51e3c 100644 --- a/completions/filefrag +++ b/completions/filefrag @@ -6,7 +6,7 @@ _filefrag() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/filesnarf b/completions/filesnarf index 0cdcfe27..01766555 100644 --- a/completions/filesnarf +++ b/completions/filesnarf @@ -13,7 +13,7 @@ _snarf() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/find b/completions/find index 4451d059..80fbe8c0 100644 --- a/completions/find +++ b/completions/find @@ -9,7 +9,7 @@ _find() case $prev in -maxdepth|-mindepth) - COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..9}' -- "$cur") ) return ;; -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\ @@ -20,7 +20,7 @@ _find() -fstype) _fstypes [[ $OSTYPE == *bsd* ]] && \ - COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'local rdonly' -- "$cur") ) return ;; -gid) @@ -28,11 +28,11 @@ _find() return ;; -group) - COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) ) + COMPREPLY=( $(compgen -g -- "$cur" 2>/dev/null) ) return ;; -xtype|-type) - COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'b c d p f l s' -- "$cur") ) return ;; -uid) @@ -40,7 +40,7 @@ _find() return ;; -user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; -exec|-execdir|-ok|-okdir) @@ -56,15 +56,15 @@ _find() return ;; -regextype) - COMPREPLY=( $( compgen -W 'emacs posix-awk posix-basic posix-egrep - posix-extended' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'emacs posix-awk posix-basic posix-egrep + posix-extended' -- "$cur") ) return ;; esac local i exprfound=false # set exprfound to true if there is already an expression present - for i in ${words[@]}; do + for i in "${words[@]}"; do [[ "$i" == [-\(\),\!]* ]] && exprfound=true && break done @@ -75,7 +75,7 @@ _find() fi # complete using basic options - COMPREPLY=( $( compgen -W '-daystart -depth -follow -help + COMPREPLY=( $(compgen -W '-daystart -depth -follow -help -ignore_readdir_race -maxdepth -mindepth -mindepth -mount -noignore_readdir_race -noleaf -regextype -version -warn -nowarn -xdev -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false @@ -84,7 +84,7 @@ _find() -readable -regex -samefile -size -true -type -uid -used -user -wholename -writable -xtype -context -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir -print -print0 -printf -prune - -quit' -- "$cur" ) ) + -quit' -- "$cur") ) if [[ ${#COMPREPLY[@]} -ne 0 ]]; then # this removes any options from the list of completions that have @@ -98,7 +98,7 @@ _find() local j for i in "${words[@]}"; do [[ $i && ${onlyonce[$i]} ]] || continue - for j in ${!COMPREPLY[@]}; do + for j in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[j]} == $i ]] && unset 'COMPREPLY[j]' done done diff --git a/completions/find_member b/completions/find_member index df1a24f9..720e3074 100644 --- a/completions/find_member +++ b/completions/find_member @@ -15,8 +15,8 @@ _find_member() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --exclude --owners --help' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--listname --exclude --owners --help' \ + -- "$cur") ) fi } && diff --git a/completions/fio b/completions/fio new file mode 100644 index 00000000..7710cf6b --- /dev/null +++ b/completions/fio @@ -0,0 +1,89 @@ +# fio(1) completion -*- shell-script -*- + +_fio() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version) + return + ;; + --debug) + local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," + COMPREPLY=( $(compgen -W "process file io mem blktrace verify + random parse diskutil job mutex profile time net rate compress + steadystate helperthread" -- "${cur##*,}") ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) + return + ;; + --output-format) + COMPREPLY=( $(compgen -W "terse json json+ normal" -- "$cur") ) + return + ;; + --terse-version) + COMPREPLY=( $(compgen -W "2 3" -- "$cur") ) + return + ;; + --cmdhelp) + # TODO more commands? + COMPREPLY=( $(compgen -W "all" -- "$cur") ) + return + ;; + --enghelp) + # TODO print ioengine help, or list available ioengines + # TODO engine,help arg + return + ;; + --eta) + COMPREPLY=( $(compgen -W "always never auto" -- "$cur") ) + return + ;; + --daemonize) + _filedir pid + return + ;; + --client) + _known_hosts_real -- "$cur" + return + ;; + --remote-config) + _filedir job + return + ;; + --idle-prof) + COMPREPLY=( $(compgen -W "system percpu calibrate" -- "$cur") ) + return + ;; + --inflate-log) + _filedir log + return + ;; + --trigger-file) + _filedir + return + ;; + --trigger|--trigger-remote) + compopt -o filenames + COMPREPLY=( $(compgen -c -- "$cur") ) + return + ;; + --aux-path) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir job +} && +complete -F _fio fio + +# ex: filetype=sh diff --git a/completions/firefox b/completions/firefox new file mode 100644 index 00000000..eeaca9f6 --- /dev/null +++ b/completions/firefox @@ -0,0 +1,46 @@ +# firefox completion -*- shell-script -*- + +_firefox() +{ + local cur prev words cword split + _init_completion -s || return + + [[ $cur == -MOZ_LOG*=* ]] && prev=${cur%%=*} cur=${cur#*=} + + case $prev in + --help|--version|--display|--UILocale|-MOZ_LOG|--new-window|--new-tab|\ + --private-window|--window-size|--search|--start-debugger-server|\ + --recording|--debugger-args|-[hvPa]) + return + ;; + --profile|--screenshot) + _filedir -d + return + ;; + -MOZ_LOG_FILE) + _filedir log + return + ;; + --recording-file) + _filedir + return + ;; + --debugger|-d) + COMPREPLY=( $(compgen -c -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir "@(?([xs])htm?(l)|pdf)" +} && +complete -F _firefox firefox mozilla-firefox iceweasel + +# ex: filetype=sh diff --git a/completions/flake8 b/completions/flake8 index 6f0be12f..f18351e8 100644 --- a/completions/flake8 +++ b/completions/flake8 @@ -6,15 +6,15 @@ _flake8() _init_completion -s || return case $prev in - -h|--help|--version) + --help|--version|-!(-*)h) return ;; --format) - COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'default pylint' -- "$cur") ) return ;; - -j|--jobs) - COMPREPLY=( $( compgen -W "auto {1..$(_ncpus)}" -- "$cur" ) ) + --jobs|-!(-*)j) + COMPREPLY=( $(compgen -W "auto {1..$(_ncpus)}" -- "$cur") ) return ;; --output-file|--append-config|--config) @@ -30,7 +30,7 @@ _flake8() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/freeciv b/completions/freeciv new file mode 100644 index 00000000..0f475482 --- /dev/null +++ b/completions/freeciv @@ -0,0 +1,41 @@ +# freeciv client completions -*- shell-script -*- + +_freeciv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version|--name|--port|-[hvnp]) + return + ;; + --file|--log|--music|--read|--Sound|--tiles|-[flmrSt]) + _filedir + return + ;; + --Announce|-A) + COMPREPLY=( $(compgen -W 'IPv4 IPv6 none' -- "$cur") ) + return + ;; + --debug|-d) + COMPREPLY=( $(compgen -W '{0..3}' -- "$cur") ) + return + ;; + --Meta|--server|-[Ms]) + _known_hosts_real -- "$cur" + return + ;; + --Plugin|-P) + COMPREPLY=( $(compgen -W 'none esd sdl' -- "$cur") ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + fi + +} && +complete -F _freeciv freeciv{,-{gtk{2,3},sdl,xaw}} civclient + +# ex: filetype=sh diff --git a/completions/freeciv-gtk2 b/completions/freeciv-gtk2 deleted file mode 100644 index 953b829a..00000000 --- a/completions/freeciv-gtk2 +++ /dev/null @@ -1,30 +0,0 @@ -# freeciv client completions -*- shell-script -*- - -_civclient() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -l|-S|-t|--log|--Sound|--tiles) - _filedir - return - ;; - -P|--Plugin) - COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) ) - return - ;; - -s|--server) - _known_hosts_real -- "$cur" - return - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _civclient civclient freeciv-gtk2 freeciv-sdl freeciv-xaw - -# ex: filetype=sh diff --git a/completions/freeciv-server b/completions/freeciv-server index 78f57afa..08f63158 100644 --- a/completions/freeciv-server +++ b/completions/freeciv-server @@ -13,7 +13,7 @@ _civserver() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && diff --git a/completions/function b/completions/function index fbcf10d2..a97b5255 100644 --- a/completions/function +++ b/completions/function @@ -8,28 +8,28 @@ _function() if [[ $1 == @(declare|typeset) ]]; then if [[ $cur == [-+]* ]]; then local opts - opts=( $( _parse_usage "$1" ) ) + 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" ) ) + 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" ) ) + 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" ) ) + COMPREPLY=( $(compgen -A variable -- "$cur") ) fi fi elif [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -A function -- "$cur" ) ) + COMPREPLY=( $(compgen -A function -- "$cur") ) else - COMPREPLY=( "() $( type -- ${words[1]} | command sed -e 1,2d )" ) + COMPREPLY=( "() $(type -- ${words[1]} | command sed -e 1,2d)" ) fi } && complete -F _function function declare typeset diff --git a/completions/fusermount b/completions/fusermount index 23671bd6..c40c18ce 100644 --- a/completions/fusermount +++ b/completions/fusermount @@ -6,19 +6,19 @@ _fusermount() _init_completion || return case $prev in - -h|-V|-o) + -*[hVo]) return ;; - -u) - COMPREPLY=( $( compgen -W "$( awk \ + -*u) + COMPREPLY=( $(compgen -W "$(awk \ '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ - 2>/dev/null )" -- "$cur" ) ) + 2>/dev/null)" -- "$cur") ) return ;; esac - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) else _filedir -d fi diff --git a/completions/gcc b/completions/gcc index b93a33f2..b72bf972 100644 --- a/completions/gcc +++ b/completions/gcc @@ -34,31 +34,33 @@ _gcc() esac if [[ "$cur" == -* ]]; then - cc=$( $1 -print-prog-name=$backend 2>/dev/null ) + cc=$($1 -print-prog-name=$backend 2>/dev/null) [[ $cc ]] || return # sink stderr: # for C/C++/ObjectiveC it's useless # for FORTRAN/Java it's an error - COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\ - command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($cc --help 2>/dev/null | tr '\t' ' ' |\ + command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/')" \ + -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir fi } && -complete -F _gcc gcc g++ gfortran g77 g95 gcj gpc && +complete -F _gcc gcc{,-5,-6,-7,-8} g++{,-5,-6,-7,-8} g77 g95 \ + gccgo{,-5,-6,-7,-8} gcj gfortran{,-5,-6,-7,-8} gpc && { cc --version 2>/dev/null | command grep -q GCC || \ - [[ $( _realcommand cc ) == *gcc* ]] && \ + [[ $(_realcommand cc) == *gcc* ]] && \ complete -F _gcc cc || complete -F _minimal cc c++ --version 2>/dev/null | command grep -q GCC || \ - [[ $( _realcommand c++ ) == *g++* ]] && \ + [[ $(_realcommand c++) == *g++* ]] && \ complete -F _gcc c++ || complete -F _minimal c++ f77 --version 2>/dev/null | command grep -q GCC || \ - [[ $( _realcommand f77 ) == *gfortran* ]] && \ + [[ $(_realcommand f77) == *gfortran* ]] && \ complete -F _gcc f77 || complete -F _minimal f77 f95 --version 2>/dev/null | command grep -q GCC || \ - [[ $( _realcommand f95 ) == *gfortran* ]] && \ + [[ $(_realcommand f95) == *gfortran* ]] && \ complete -F _gcc f95 || complete -F _minimal f95 } diff --git a/completions/gcl b/completions/gcl index 5d1ca5f3..9acc813d 100644 --- a/completions/gcl +++ b/completions/gcl @@ -9,8 +9,8 @@ _gcl() # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir -compile - -o-file -c-file -h-file -data-file -system-p' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-eval -load -f -batch -dir -libdir -compile + -o-file -c-file -h-file -data-file -system-p' -- "$cur") ) else _filedir fi diff --git a/completions/gdb b/completions/gdb index 75414782..b37387e1 100644 --- a/completions/gdb +++ b/completions/gdb @@ -20,25 +20,25 @@ _gdb() if [[ "$cur" == */* ]]; then # compgen -c works as expected if $cur contains any slashes. IFS=$'\n' - COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) ) + COMPREPLY=( $(PATH="$PATH:." compgen -d -c -- "$cur") ) else # otherwise compgen -c contains Bash's built-in commands, # functions and aliases. Thus we need to retrieve the program # names manually. IFS=":" - local path_array=( $( \ - command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) ) + local path_array=( $(\ + command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH") ) IFS=$'\n' - COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ + COMPREPLY=( $(compgen -d -W '$(find "${path_array[@]}" . \ -mindepth 1 -maxdepth 1 -not -type d -executable \ - -printf "%f\\n" 2>/dev/null)' -- "$cur" ) ) + -printf "%f\\n" 2>/dev/null)' -- "$cur") ) fi elif [[ $cword -eq 2 ]]; then - COMPREPLY=( $( compgen -W "$( command ps axo comm,pid | \ - awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command ps axo comm,pid | \ + awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}')" -- "$cur") ) compopt -o filenames - COMPREPLY+=( $( compgen -f -X '!?(*/)core?(.+([0-9]))' -o plusdirs \ - -- "$cur" ) ) + COMPREPLY+=( $(compgen -f -X '!?(*/)core?(.?*)' -o plusdirs \ + -- "$cur") ) fi } && complete -F _gdb gdb diff --git a/completions/genaliases b/completions/genaliases index f9a9890a..3bad5c7e 100644 --- a/completions/genaliases +++ b/completions/genaliases @@ -6,7 +6,7 @@ _genaliases() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--quiet --help' -- "$cur") ) fi } && diff --git a/completions/genisoimage b/completions/genisoimage index caf6d457..52b66bbe 100644 --- a/completions/genisoimage +++ b/completions/genisoimage @@ -12,8 +12,8 @@ _mkisofs() return ;; -*-charset) - COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \ - help 2>&1 | tail -n +3 )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(mkisofs -input-charset \ + help 2>&1 | tail -n +3)' -- "$cur") ) return ;; -uid) @@ -27,7 +27,7 @@ _mkisofs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) else _filedir fi diff --git a/completions/geoiplookup b/completions/geoiplookup index 0c92548a..8347728f 100644 --- a/completions/geoiplookup +++ b/completions/geoiplookup @@ -20,7 +20,7 @@ _geoiplookup() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" -h)' -- "$cur") ) return fi diff --git a/completions/getconf b/completions/getconf index 80be667c..6e86e9de 100644 --- a/completions/getconf +++ b/completions/getconf @@ -11,9 +11,9 @@ _getconf() return ;; -v) - COMPREPLY=( $( compgen -W \ - '$( "$1" -a 2>/dev/null | awk "{ print \$1 }" )' -- \ - "${cur:-POSIX_V}" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- \ + "${cur:-POSIX_V}") ) return ;; esac @@ -21,10 +21,12 @@ _getconf() if [[ $prev == PATH_MAX ]]; then # TODO more path vars, better handling _filedir elif [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-a -v' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-a -v' -- "$cur") ) else - COMPREPLY=( $( compgen -W \ - '$( "$1" -a 2>/dev/null | awk "{ print \$1 }" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- "$cur") ) fi } && complete -F _getconf getconf + +# ex: filetype=sh diff --git a/completions/getent b/completions/getent index 0658b0bb..9a181f60 100644 --- a/completions/getent +++ b/completions/getent @@ -8,10 +8,10 @@ _getent() local i db for (( i=1; i < cword; i++ )); do case ${words[i]} in - -V|--version|--usage|-'?'|--help) + --version|--usage|--help|-!(-*)[V?]) return ;; - -s|--service) + --service|-!(-*)s) (( i++ )) ;; -*) @@ -26,29 +26,28 @@ _getent() case $db in passwd) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; group) - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) return ;; services) - COMPREPLY=( $( compgen -s -- "$cur" ) ) + COMPREPLY=( $(compgen -s -- "$cur") ) return ;; hosts) - COMPREPLY=( $( compgen -A hostname -- "$cur" ) ) + COMPREPLY=( $(compgen -A hostname -- "$cur") ) return ;; protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) - COMPREPLY=( $( compgen -W "$( $1 $db | \ - awk '{ print $1 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 $db | \ + awk '{ print $1 }')" -- "$cur") ) return ;; aliases|shadow|gshadow) - COMPREPLY=( $( compgen -W "$( $1 $db | cut -d: -f1 )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 $db | cut -d: -f1)" -- "$cur") ) return ;; ethers|netgroup) @@ -65,12 +64,12 @@ _getent() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ -z $db ]]; then - COMPREPLY=( $( compgen -W 'passwd group hosts services protocols + COMPREPLY=( $(compgen -W 'passwd group hosts services protocols networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc - shadow gshadow' -- "$cur" ) ) + shadow gshadow' -- "$cur") ) fi } && complete -F _getent getent diff --git a/completions/gkrellm b/completions/gkrellm index 52d2a651..9eb76bcb 100644 --- a/completions/gkrellm +++ b/completions/gkrellm @@ -32,7 +32,7 @@ _gkrellm() ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _gkrellm gkrellm gkrellm2 diff --git a/completions/gm b/completions/gm index 88c233c6..4ea4f3e9 100644 --- a/completions/gm +++ b/completions/gm @@ -2,8 +2,8 @@ _gm_commands() { - COMPREPLY+=( $( compgen -W '$( "$1" help | - awk "/^ +[^ ]+ +- / { print \$1 }" )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$("$1" help | + awk "/^ +[^ ]+ +- / { print \$1 }")' -- "$cur") ) } _gm() diff --git a/completions/gnatmake b/completions/gnatmake index 4cd24d2e..383bb9b4 100644 --- a/completions/gnatmake +++ b/completions/gnatmake @@ -8,14 +8,14 @@ _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 + 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" ) ) + -gnatz -gnatZ -gnat83' -- "$cur") ) else # source file completion _filedir '@(adb|ads)' diff --git a/completions/gnokii b/completions/gnokii index 95ccaeae..ff43c3d1 100644 --- a/completions/gnokii +++ b/completions/gnokii @@ -3,7 +3,7 @@ _gnokii_memory_type() { # TODO: reduce the number of choices - COMPREPLY=( $( compgen -W "IN OU SM ME MT" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "IN OU SM ME MT" -- "$cur") ) } _gnokii() @@ -24,15 +24,15 @@ _gnokii() [[ -f $config_file ]] && break done [[ ! -f $config_file ]] && return - COMPREPLY=( $( compgen -W \ - "$( command sed -n 's/^\[phone_\(.*\)\]/\1/p' $config_file )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + "$(command sed -n 's/^\[phone_\(.*\)\]/\1/p' $config_file)" \ + -- "$cur") ) return ;; --help) - COMPREPLY=( $( compgen -W 'all monitor sms mms phonebook calendar + COMPREPLY=( $(compgen -W 'all monitor sms mms phonebook calendar todo dial profile settings wap logo ringtone security file - other' -- "$cur" ) ) + other' -- "$cur") ) return ;; --version|--shell|ping) @@ -41,15 +41,15 @@ _gnokii() # MONITOR --monitor) - COMPREPLY=( $( compgen -W 'delay once' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'delay once' -- "$cur") ) return ;; --getdisplaystatus|--displayoutput) return ;; --netmonitor) - COMPREPLY=( $( compgen -W 'reset off field devel next nr' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'reset off field devel next nr' \ + -- "$cur") ) return ;; @@ -59,8 +59,8 @@ _gnokii() return ;; --savesms) - COMPREPLY=( $( compgen -W '--sender --smsc --smscno --folder - --location --sent --read --deliver --datetime' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--sender --smsc --smscno --folder + --location --sent --read --deliver --datetime' -- "$cur") ) return ;; --memory-type|--memory|--getsms|--deletesms|--getmms|--deletemms|\ @@ -82,8 +82,8 @@ _gnokii() return ;; --writephonebook) - COMPREPLY=( $( compgen -W '--overwrite --find-free --memory-type - --location --vcard --ldif' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--overwrite --find-free --memory-type + --location --vcard --ldif' -- "$cur") ) return ;; --writecalendarnote|--writetodo) @@ -97,7 +97,7 @@ _gnokii() return ;; --divert) - COMPREPLY=( $( compgen -W '--op' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--op' -- "$cur") ) return ;; @@ -112,7 +112,7 @@ _gnokii() # SETTINGS --reset) - COMPREPLY=( $( compgen -W 'soft hard' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'soft hard' -- "$cur") ) return ;; --setdatetime|--setalarm) @@ -131,12 +131,12 @@ _gnokii() # LOGOS --sendlogo) - COMPREPLY=( $( compgen -W 'caller op picture' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'caller op picture' -- "$cur") ) return ;; --setlogo|--getlogo) - COMPREPLY=( $( compgen -W 'op startup caller dealer text' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'op startup caller dealer text' \ + -- "$cur") ) return ;; --viewlogo) @@ -145,7 +145,7 @@ _gnokii() ;; --entersecuritycode) - COMPREPLY=( $( compgen -W 'PIN PIN2 PUK PUK2 SEC' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'PIN PIN2 PUK PUK2 SEC' -- "$cur") ) return ;; @@ -166,16 +166,16 @@ _gnokii() return ;; --gettodo|--getcalendarnote) - COMPREPLY=( $( compgen -W '{1..9} end --vCal' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9} end --vCal' -- "$cur") ) return ;; --deletecalendarnote) - COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9} end' -- "$cur") ) return ;; --divert) - COMPREPLY=( $( compgen -W 'register enable query disable - erasure' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'register enable query disable + erasure' -- "$cur") ) return ;; esac @@ -186,20 +186,20 @@ _gnokii() tprev=${words[cword-3]} case $tprev in --deletesms|--deletemms) - COMPREPLY=( $( compgen -W 'end' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'end' -- "$cur") ) return ;; --getphonebook|--writetodo|--writecalendarnote) - COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9} end' -- "$cur") ) return ;; --gettodo|--getcalendarnote) [[ ${words[cword-1]} == end ]] && \ - COMPREPLY=( $( compgen -W '--vCal' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--vCal' -- "$cur") ) return ;; --divert) - COMPREPLY=( $( compgen -W '--type' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--type' -- "$cur") ) return esac fi @@ -209,26 +209,26 @@ _gnokii() fprev=${words[cword-4]} case $fprev in --getphonebook) - COMPREPLY=( $( compgen -W '--raw --vcard --ldif' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--raw --vcard --ldif' -- "$cur") ) return ;; --divert) - COMPREPLY=( $( compgen -W 'all busy noans outofreach notavail' \ - -- "$cur" ) ) + 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" )" + 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" ) + 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 + [[ $COMP_LINE =~ $(tr ' ' '\b|'<<<$main_cmd) ]] && return - COMPREPLY=( $( compgen -W "$all_cmd" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$all_cmd" -- "$cur") ) } && complete -F _gnokii gnokii diff --git a/completions/gnome-mplayer b/completions/gnome-mplayer index 9a250419..fa4361df 100644 --- a/completions/gnome-mplayer +++ b/completions/gnome-mplayer @@ -10,7 +10,7 @@ _gnome_mplayer() return ;; --showcontrols|--showsubtitles|--autostart) - COMPREPLY=( $( compgen -w '0 1' -- "$cur" ) ) + COMPREPLY=( $(compgen -w '0 1' -- "$cur") ) return ;; --subtitle) @@ -18,7 +18,7 @@ _gnome_mplayer() return ;; --tvdriver) - COMPREPLY=( $( compgen -W 'v4l v4l2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'v4l v4l2' -- "$cur") ) return ;; esac @@ -26,8 +26,7 @@ _gnome_mplayer() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/gnome-screenshot b/completions/gnome-screenshot new file mode 100644 index 00000000..d0270c38 --- /dev/null +++ b/completions/gnome-screenshot @@ -0,0 +1,31 @@ +# gnome-screenshot(1) completion -*- shell-script -*- + +_gnome_screenshot() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--help-*|--version|--delay|--display|-!(-*)[hd]) + return + ;; + --border-effect|-!(-*)e) + COMPREPLY=( $(compgen -W 'shadow border vintage none' -- "$cur") ) + return + ;; + --file|-!(-*)f) + _filedir '@(jp?(e)|pn)g' + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi +} && +complete -F _gnome_screenshot gnome-screenshot + +# ex: filetype=sh diff --git a/completions/gpasswd b/completions/gpasswd index ada12b8d..8f27cfec 100644 --- a/completions/gpasswd +++ b/completions/gpasswd @@ -6,19 +6,19 @@ _gpasswd() _init_completion || return case $prev in - -a|--add|-d|--delete|-A|--administrators|-M|--members) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --add|--delete|--administrators|--members|-!(-*)[adAM]) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then # TODO: only -A and -M can be combined - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) } && complete -F _gpasswd gpasswd diff --git a/completions/gpg b/completions/gpg index 3fee3df3..cb00fa66 100644 --- a/completions/gpg +++ b/completions/gpg @@ -6,31 +6,31 @@ _gpg() _init_completion || return case $prev in - -s|--sign|--clearsign|--decrypt-files|--load-extension) + --sign|--clearsign|--decrypt-files|--load-extension|-!(-*)s) _filedir return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + COMPREPLY=( $(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ - 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur") ) return ;; - -r|--recipient) - COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ - 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + --recipient|-!(-*)r) + COMPREPLY=( $(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ + 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur") ) if [[ -e ~/.gnupg/gpg.conf ]]; then - COMPREPLY+=( $( compgen -W "$( command sed -ne \ + COMPREPLY+=( $(compgen -W "$(command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ - ~/.gnupg/gpg.conf )" -- "$cur" ) ) + ~/.gnupg/gpg.conf)" -- "$cur") ) fi return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --dump-options)' -- "$cur") ) fi } && complete -F _gpg -o default gpg diff --git a/completions/gpg2 b/completions/gpg2 index 66630590..45014922 100644 --- a/completions/gpg2 +++ b/completions/gpg2 @@ -10,31 +10,31 @@ _gpg2() _filedir -d return ;; - -s|--sign|--clearsign|--options|--decrypt) + --sign|--clearsign|--options|--decrypt|-!(-*)s) _filedir return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + COMPREPLY=( $(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ - 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur") ) return ;; - -r|--recipient) - COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | \ - command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + --recipient|-!(-*)r) + COMPREPLY=( $(compgen -W "$($1 --list-keys 2>/dev/null | \ + command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur") ) if [[ -e ~/.gnupg/gpg.conf ]]; then - COMPREPLY+=( $( compgen -W "$( command sed -ne \ + COMPREPLY+=( $(compgen -W "$(command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ - ~/.gnupg/gpg.conf)" -- "$cur" ) ) + ~/.gnupg/gpg.conf)" -- "$cur") ) fi return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --dump-options)' -- "$cur") ) fi } && complete -F _gpg2 -o default gpg2 diff --git a/completions/gpgv b/completions/gpgv new file mode 100644 index 00000000..a3221afc --- /dev/null +++ b/completions/gpgv @@ -0,0 +1,46 @@ +# gpgv(1) completion -*- shell-script -*- + +_gpgv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version|--weak-digest|--*-fd|-!(-*)[?h]*) + return + ;; + --keyring) + _filedir "@(gpg|kbx)" + return + ;; + --homedir) + _filedir -d + return + ;; + esac + + local args + _count_args "" "--@(weak-digest|*-fd|keyring|homedir)" + + if [[ $cur == -* && $args -eq 1 ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + if [[ $args -gt 1 ]]; then + if [[ ${COMP_LINE,,} == *.@(asc|sig|sign)\ * ]]; then + # Detached signature, only complete one arbitrary file arg and - + if [[ $args -eq 2 ]]; then + COMPREPLY=( $(compgen -W '-' -- "$cur") ) + _filedir + fi + else + _filedir gpg + fi + else + _filedir "@(asc|gpg|sig|sign)" + fi +} && +complete -F _gpgv gpgv gpgv2 + +# ex: filetype=sh diff --git a/completions/gphoto2 b/completions/gphoto2 index 94bf0634..89277a95 100644 --- a/completions/gphoto2 +++ b/completions/gphoto2 @@ -23,20 +23,20 @@ _gphoto2() return ;; --port) - COMPREPLY=( $(compgen -W "$( $1 --list-ports 2>/dev/null | \ - awk 'NR>3 { print $1 }' )" -- "$cur") ) + COMPREPLY=( $(compgen -W "$($1 --list-ports 2>/dev/null | \ + awk 'NR>3 { print $1 }')" -- "$cur") ) __ltrim_colon_completions "$cur" return ;; --camera) local IFS=$'\n' - COMPREPLY=( $(compgen -W "$( $1 --list-cameras 2>/dev/null | \ - awk -F'"' 'NR>2 { print $2 }' )" -- "$cur") ) + COMPREPLY=( $(compgen -W "$($1 --list-cameras 2>/dev/null | \ + awk -F'"' 'NR>2 { print $2 }')" -- "$cur") ) return ;; --get-config|--set-config|--set-config-index|--set-config-value) - COMPREPLY=( $(compgen -W "$( $1 --list-config 2>/dev/null \ - )" -- "$cur") ) + COMPREPLY=( $(compgen -W "$($1 --list-config 2>/dev/null \ + )" -- "$cur") ) return ;; esac @@ -44,7 +44,7 @@ _gphoto2() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi diff --git a/completions/gprof b/completions/gprof index b9692bad..d1f4a4a3 100644 --- a/completions/gprof +++ b/completions/gprof @@ -17,8 +17,8 @@ _gprof() ;; -O*) cur=${cur:2} - COMPREPLY=( $( compgen -P -O -W 'auto bsd 4.4bsd magic prof' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -P -O -W 'auto bsd 4.4bsd magic prof' \ + -- "$cur") ) return ;; esac @@ -36,8 +36,7 @@ _gprof() return ;; --file-format) - COMPREPLY=( $( compgen -W 'auto bsd 4.4bsd magic prof' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'auto bsd 4.4bsd magic prof' -- "$cur") ) return ;; esac @@ -45,7 +44,7 @@ _gprof() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '--annotated-source --brief --exec-counts + COMPREPLY=( $(compgen -W '--annotated-source --brief --exec-counts --file-info --directory-path --no-annotated-source --print-path --flat-profile --no-flat-profile --graph --no-graph --table-length= --separate-files --no-exec-counts --function-ordering @@ -53,7 +52,7 @@ _gprof() --no-demangle --no-static --static-call-graph --ignore-non-functions -k --line --min-count= --time= --no-time= --external-symbol-table= --display-unused-functions --debug --help - --file-format= --sum --version' -- "$cur" ) ) + --file-format= --sum --version' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/groupadd b/completions/groupadd index c5a74b7a..013feaa4 100644 --- a/completions/groupadd +++ b/completions/groupadd @@ -9,7 +9,7 @@ _groupadd() # with -g/--gid case $prev in - -g|--gid|-K|--key|-p|--password) + --gid|--key|--password|-!(-*)[gKp]) return ;; esac @@ -17,7 +17,7 @@ _groupadd() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/groupdel b/completions/groupdel index 867b1741..fcdd14c1 100644 --- a/completions/groupdel +++ b/completions/groupdel @@ -16,11 +16,11 @@ _groupdel() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) } && complete -F _groupdel groupdel diff --git a/completions/groupmems b/completions/groupmems index 3bb5d820..6e599a24 100644 --- a/completions/groupmems +++ b/completions/groupmems @@ -7,11 +7,11 @@ _groupmems() case $prev in -a|--add|-d|--delete) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; -g|--group) - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) return ;; -R|--root) @@ -20,7 +20,7 @@ _groupmems() ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _groupmems groupmems diff --git a/completions/groupmod b/completions/groupmod index 51e23b5c..2ac62ea3 100644 --- a/completions/groupmod +++ b/completions/groupmod @@ -9,7 +9,7 @@ _groupmod() # with -g/--gid case $prev in - -g|--gid|-h|--help|-n|--new-name|-p|--password) + --gid|--help|--new-name|--password|-!(-*)[ghnp]) return ;; esac @@ -17,12 +17,12 @@ _groupmod() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) } && complete -F _groupmod groupmod diff --git a/completions/growisofs b/completions/growisofs index 04b29a55..a0c6de3f 100644 --- a/completions/growisofs +++ b/completions/growisofs @@ -15,7 +15,7 @@ _growisofs() return ;; /?(r)dev/*) - if [[ $cur == =* ]] ; then + if [[ $cur == =* ]]; then # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero cur="${cur#=}" _filedir @@ -26,9 +26,9 @@ _growisofs() if [[ "$cur" == -* ]]; then # TODO: mkisofs options - COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \ - -- "$cur" ) ) - [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace + COMPREPLY=( $(compgen -W '-dvd-compat -overburn -speed= -Z -M' \ + -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/grpck b/completions/grpck index 18a53920..9f5eac7b 100644 --- a/completions/grpck +++ b/completions/grpck @@ -5,8 +5,16 @@ _grpck() local cur prev words cword _init_completion || return + case $prev in + --root|-!(-*)R) + _filedir + return + ;; + esac + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) return fi diff --git a/completions/gzip b/completions/gzip index 59818d92..d3bce282 100644 --- a/completions/gzip +++ b/completions/gzip @@ -6,18 +6,17 @@ _gzip() _init_completion || return case $prev in - -b|--blocksize|-S|--suffix|-h|--help|-V|--version) + --blocksize|--suffix|--help|--version|-!(-*)[bShV]) return ;; - -p|--processes) - COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + --processes|-!(-*)p) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -36,8 +35,8 @@ _gzip() _tilde "$cur" || return compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") \ + $(compgen -d -- "$cur") ) } && complete -F _gzip gzip pigz diff --git a/completions/hcitool b/completions/hcitool index 38d66427..ccc64f18 100644 --- a/completions/hcitool +++ b/completions/hcitool @@ -3,28 +3,28 @@ _bluetooth_addresses() { if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then - COMPREPLY+=( $( compgen -W "$( hcitool scan | \ - awk '/^\t/{print $1}' )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "$(hcitool scan | \ + awk '/^\t/{print $1}')" -- "$cur") ) fi } _bluetooth_devices() { - COMPREPLY+=( $( compgen -W "$( hcitool dev | \ - awk '/^\t/{print $1}' )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "$(hcitool dev | \ + awk '/^\t/{print $1}')" -- "$cur") ) } _bluetooth_services() { - COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP + COMPREPLY=( $(compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \ - -- "$cur" ) ) + -- "$cur") ) } _bluetooth_packet_types() { - COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \ + -- "$cur") ) } _hcitool() @@ -38,7 +38,7 @@ _hcitool() return ;; --role) - COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'm s' -- "$cur") ) return ;; --pkt-type) @@ -53,11 +53,11 @@ _hcitool() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'dev inq scan name info spinq epinq cmd + COMPREPLY=( $(compgen -W 'dev inq scan name info spinq epinq cmd con cc dc sr cpt rssi lq tpl afh lst auth enc key clkoff - clock' -- "$cur" ) ) + clock' -- "$cur") ) fi else local args @@ -70,7 +70,7 @@ _hcitool() ;; cc) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--role --pkt-type' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--role --pkt-type' -- "$cur") ) else _count_args if [[ $args -eq 2 ]]; then @@ -83,7 +83,7 @@ _hcitool() if [[ $args -eq 2 ]]; then _bluetooth_addresses else - COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'master slave' -- "$cur") ) fi ;; cpt) @@ -99,7 +99,7 @@ _hcitool() if [[ $args -eq 2 ]]; then _bluetooth_addresses else - COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 1' -- "$cur") ) fi ;; esac @@ -125,39 +125,39 @@ _sdptool() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'search browse records add del get - setattr setseq' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'search browse records add del get + setattr setseq' -- "$cur") ) fi else case $arg in search) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--bdaddr --tree --raw --xml' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur") ) else _bluetooth_services fi ;; browse|records) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--tree --raw --xml' -- "$cur") ) else _bluetooth_addresses fi ;; add) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--handle --channel' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--handle --channel' -- "$cur") ) else _bluetooth_services fi ;; get) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--bdaddr --tree --raw --xml' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur") ) fi ;; esac @@ -181,7 +181,7 @@ _l2ping() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _bluetooth_addresses fi @@ -209,10 +209,10 @@ _rfcomm() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'show connect listen watch bind - release' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'show connect listen watch bind + release' -- "$cur") ) fi else local args @@ -249,10 +249,10 @@ _ciptool() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'show search connect release loopback' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'show search connect release loopback' \ + -- "$cur") ) fi else local args @@ -281,14 +281,14 @@ _dfutool() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else local args _count_args case $args in 1) - COMPREPLY=( $( compgen -W 'verify modify upgrade archive' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'verify modify upgrade archive' \ + -- "$cur") ) ;; 2) _filedir @@ -307,13 +307,13 @@ _hciconfig() _get_first_arg if [[ -z $arg ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --all' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --all' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'up down reset rstat auth noauth encrypt + COMPREPLY=( $(compgen -W 'up down reset rstat auth noauth encrypt noencrypt secmgr nosecmgr piscan noscan iscan pscan ptype name class voice iac inqmode inqdata inqtype inqparams pageparms pageto afhmode aclmtu scomtu putkey delkey commands features - version revision lm' -- "$cur" ) ) + version revision lm' -- "$cur") ) fi else local args @@ -327,8 +327,8 @@ _hciconfig() lm) _count_args if [[ $args -eq 2 ]]; then - COMPREPLY=( $( compgen -W 'MASTER SLAVE NONE ACCEPT' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'MASTER SLAVE NONE ACCEPT' \ + -- "$cur") ) fi ;; ptype) @@ -348,26 +348,26 @@ _hciattach() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-n -p -t -b -s -l' -- "$cur") ) else local args _count_args case $args in 1) - COMPREPLY=( $( printf '%s\n' /dev/tty* ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} - ${COMPREPLY[@]#/dev/}' -- "$cur" ) ) + COMPREPLY=( $(printf '%s\n' /dev/tty*) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} + ${COMPREPLY[@]#/dev/}' -- "$cur") ) ;; 2) - COMPREPLY=( $( compgen -W 'any ericsson digi xircom csr bboxes - swave bcsp 0x0105 0x080a 0x0160 0x0002' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'any ericsson digi xircom csr bboxes + swave bcsp 0x0105 0x080a 0x0160 0x0002' -- "$cur") ) ;; 3) - COMPREPLY=( $( compgen -W '9600 19200 38400 57600 115200 230400 - 460800 921600' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '9600 19200 38400 57600 115200 230400 + 460800 921600' -- "$cur") ) ;; 4) - COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'flow noflow' -- "$cur") ) ;; 5) _bluetooth_addresses diff --git a/completions/hddtemp b/completions/hddtemp index 123b74a1..b7487cc9 100644 --- a/completions/hddtemp +++ b/completions/hddtemp @@ -6,19 +6,19 @@ _hddtemp() _init_completion -s || return case $prev in - -f|--file) + --file|-!(-*)f) _filedir db return ;; - -l|--listen) + --listen|-!(-*)l) _ip_addresses return ;; - -u|--unit) - COMPREPLY=( $( compgen -W 'C F' -- "$cur" ) ) + --unit|-!(-*)u) + COMPREPLY=( $(compgen -W 'C F' -- "$cur") ) return ;; - -p|--port|-s|--separator|-S|--syslog|-v|--version|-h|-\?|--help) + --port|--separator|--syslog|--version|--help|-!(-*)[psSvh?]) return ;; esac @@ -26,7 +26,7 @@ _hddtemp() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") --help' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else cur=${cur:=/dev/} diff --git a/completions/hid2hci b/completions/hid2hci index 9221c4d0..9e3305d0 100644 --- a/completions/hid2hci +++ b/completions/hid2hci @@ -6,8 +6,8 @@ _hid2hci() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 --tohid' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --quiet -0 --tohci -1 --tohid' \ + -- "$cur") ) fi } && complete -F _hid2hci hid2hci diff --git a/completions/hostname b/completions/hostname index 48f4222f..68f9b4ed 100644 --- a/completions/hostname +++ b/completions/hostname @@ -6,17 +6,17 @@ _hostname() _init_completion || return case $prev in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]) return ;; - -F|--file) + --file|-!(-*)F) _filedir return ;; esac [[ $cur == -* ]] && \ - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _hostname hostname diff --git a/completions/hping2 b/completions/hping2 index 6344ed73..78d35b05 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -6,26 +6,26 @@ _hping2() _init_completion || return case $prev in - -I|--interface) + --interface|-!(-*)I) _available_interfaces return ;; - -a|--spoof) + --spoof|-!(-*)a) _known_hosts_real -- "$cur" return ;; - -o|--tos) - COMPREPLY=( $( compgen -W '02 04 08 10' ) ) + --tos|-!(-*)o) + COMPREPLY=( $(compgen -W '02 04 08 10') ) return ;; - -E|--file) + --file|-!(-*)E) _filedir return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/htop b/completions/htop index 13c06b15..3f1680b5 100644 --- a/completions/htop +++ b/completions/htop @@ -6,15 +6,15 @@ _htop() _init_completion -s || return case "$prev" in - -s|--sort-key) - COMPREPLY=( $( compgen -W '$( "$1" -s help )' -- "$cur" ) ) + --sort-key|-!(-*)s) + COMPREPLY=( $(compgen -W '$("$1" -s help)' -- "$cur") ) return ;; - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|-!(-*)u) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -d|--delay) + --delay|-!(-*)d) # argument required but no completions available return ;; @@ -23,7 +23,7 @@ _htop() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/htpasswd b/completions/htpasswd index bf3acb22..827e6dcc 100644 --- a/completions/htpasswd +++ b/completions/htpasswd @@ -16,7 +16,7 @@ _htpasswd() if [[ $o -eq 0 || $o -eq $cword ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi # Password file (first non-option argument) @@ -24,8 +24,8 @@ _htpasswd() elif [[ $o -eq $cword-1 ]]; then # Username (second non-option argument) - COMPREPLY=( $( compgen -W \ - '$( cut -d: -f1 "${words[o]}" 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(cut -d: -f1 "${words[o]}" 2>/dev/null)' -- "$cur") ) fi } && complete -F _htpasswd htpasswd diff --git a/completions/hunspell b/completions/hunspell new file mode 100644 index 00000000..627f3e4b --- /dev/null +++ b/completions/hunspell @@ -0,0 +1,42 @@ +# hunspell(1) completion -*- shell-script -*- + +_hunspell() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version|-vv|-[hPv]) + return + ;; + -d) + local IFS=$' \t\n' reset=$(shopt -p nullglob); shopt -s nullglob + local -a dicts=( /usr/share/hunspell/*.dic + /usr/local/share/hunspell/*.dic ) + dicts=( "${dicts[@]##*/}" ) + dicts=( "${dicts[@]%.dic}" ) + $reset + IFS=$'\n' + COMPREPLY=( $(compgen -W '${dicts[@]}' -- "$cur") ) + return + ;; + -i) + _xfunc iconv _iconv_charsets + return + ;; + -p) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + _filedir +} && +complete -F _hunspell hunspell + +# ex: filetype=sh diff --git a/completions/iconv b/completions/iconv index 50edb4c5..2fb1c92d 100644 --- a/completions/iconv +++ b/completions/iconv @@ -1,21 +1,26 @@ # iconv(1) completion -*- shell-script -*- +_iconv_charsets() +{ + COMPREPLY+=( $(compgen -W '$(${1:-iconv} -l | \ + command sed -e "s@/*\$@@" -e "s/[,()]//g")' -- "$cur") ) +} + _iconv() { local cur prev words cword split _init_completion -s || return case $prev in - -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ - --widechar-subst) + --help|--usage|--version|--unicode-subst|--byte-subst|\ + --widechar-subst|-!(-*)[?V]) return ;; - -f|--from-code|-t|--to-code) - COMPREPLY=( $( compgen -W '$( iconv -l | \ - command sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + --from-code|--to-code|-!(-*)[ft]) + _iconv_charsets $1 return ;; - -o|--output) + --output|-!(-*)o) _filedir return ;; @@ -24,7 +29,7 @@ _iconv() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/id b/completions/id index 137a5f7e..3f3087cb 100644 --- a/completions/id +++ b/completions/id @@ -6,11 +6,11 @@ _id() _init_completion || return if [[ "$cur" == -* ]]; then - local opts=$( _parse_help "$1" ) + local opts=$(_parse_help "$1") [[ $opts ]] || opts="-G -g -u" # POSIX fallback - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) else - COMPREPLY=( $( compgen -u "$cur" ) ) + COMPREPLY=( $(compgen -u "$cur") ) fi } && complete -F _id id diff --git a/completions/idn b/completions/idn index 12f4bdd1..39d13021 100644 --- a/completions/idn +++ b/completions/idn @@ -6,18 +6,18 @@ _idn() _init_completion -s || return case $prev in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]) return ;; - -p|--profile) - COMPREPLY=( $( compgen -W 'Nameprep iSCSI Nodeprep Resourceprep - trace SASLprep' -- "$cur" ) ) + --profile|-!(-*)p) + COMPREPLY=( $(compgen -W 'Nameprep iSCSI Nodeprep Resourceprep + trace SASLprep' -- "$cur") ) return ;; esac if ! $split && [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/ifstat b/completions/ifstat new file mode 100644 index 00000000..9fac3d30 --- /dev/null +++ b/completions/ifstat @@ -0,0 +1,62 @@ +# bash completion for ifstat(1) -*- shell-script -*- + +_ifstat() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version|--scan|--interval|-!(-*)[hvV]) + return + ;; + -!(-*)i) + # TODO comma separated + _available_interfaces -a + return + ;; + -!(-*)d) + # iproute2: no completion (scan delay) + # traditional: parse driver + if ! { "$1" --help 2>&1 || :; } | \ + command grep -q -- '-d.*--scan'; then + COMPREPLY=( $(compgen -W '$("$1" -v | command \ + sed -e "s/[,.]//g" -ne "s/^.*drivers://p")' -- "$cur") ) + fi + return + ;; + --noupdate|-!(-*)s) + # iproute2: pass through (skip history update) + # traditional: hostnames (snmp) + if ! { "$1" --help 2>&1 || :; } | \ + command grep -q -- '-s.*--noupdate'; then + _known_hosts_real -- "$cur" + return + fi + ;; + -!(-*)t) + # iproute2: no completion (interval) + # traditional: pass through (add timestamp) + ! { "$1" --help 2>&1 || :; } | \ + command grep -q -- '-t.*--interval' || return + ;; + --extended|-!(-*)x) + # iproute2: parse xstat types + COMPREPLY=( $(compgen -W '$("$1" -x nonexistent-xstat 2>&1 | + awk "found { print \$1 } /supported xstats:/ { found=1 }")' \ + -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _ifstat ifstat + +# ex: filetype=sh diff --git a/completions/iftop b/completions/iftop index 831e327b..6320316d 100644 --- a/completions/iftop +++ b/completions/iftop @@ -19,7 +19,7 @@ _iftop() ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) } && complete -F _iftop iftop diff --git a/completions/ifup b/completions/ifup index 42cb8f80..db8de8e0 100644 --- a/completions/ifup +++ b/completions/ifup @@ -7,12 +7,33 @@ _ifupdown() local cur prev words cword _init_completion || return - if [[ $cword -eq 1 ]]; then + case $prev in + --help|--version|--allow|--exclude|--option|-!(-*)[hVXo]) + return + ;; + --interfaces|-!(-*)i) + _filedir + return + ;; + --state-dir) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + local args + _count_args "" "@(--allow|-i|--interfaces|--state-dir|-X|--exclude|-o)" + + if [[ $args -eq 1 ]]; then _configured_interfaces COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) fi - } && -complete -F _ifupdown ifup ifdown ifstatus +complete -F _ifupdown ifup ifdown ifquery ifstatus # ex: filetype=sh diff --git a/completions/info b/completions/info index ba2cf4cb..87179ac8 100644 --- a/completions/info +++ b/completions/info @@ -12,10 +12,10 @@ _info() fi case $prev in - -k|--apropos|--index-search|-n|--node|-h|--help|-v|--version) + --apropos|--index-search|--node|--help|--version|-!(-*)[knhv]) return ;; - -d) + -!(-*)d) if [[ ${1##*/} == info ]]; then _filedir -d return @@ -25,7 +25,7 @@ _info() _filedir -d return ;; - --dribble|-f|--file|-o|--output|--restore|-r|--raw-filename|--rcfile) + --dribble|--file|--output|--restore|--raw-filename|--rcfile|-!(-*)[for]) _filedir return ;; @@ -34,7 +34,7 @@ _info() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -57,7 +57,7 @@ _info() fi # redirect stderr for when path doesn't exist - COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) ) + COMPREPLY=( $(eval command ls "$infopath" 2>/dev/null) ) # weed out directory path names and paths to info pages COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) # weed out info dir file @@ -66,7 +66,7 @@ _info() done # strip suffix from info pages COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}") ) } && complete -F _info info pinfo diff --git a/completions/inject b/completions/inject index 20ea9b7f..8becf274 100644 --- a/completions/inject +++ b/completions/inject @@ -15,7 +15,7 @@ _inject() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--listname --queue --help' -- "$cur") ) else _filedir fi diff --git a/completions/inotifywait b/completions/inotifywait new file mode 100644 index 00000000..637d4742 --- /dev/null +++ b/completions/inotifywait @@ -0,0 +1,47 @@ +# bash completion for inotifywait(1) and inotifywatch(1) -*- shell-script -*- + +_inotifywait_events() +{ + # Expecting line with "Events:", followed by ones starting with one + # tab. Word following the tab is event name, others are line + # wrapped explanations. + COMPREPLY+=( $(compgen -W "$($1 --help 2>/dev/null | \ + command sed -e '/^Events:/,/^[^'$'\t'']/!d' \ + -ne 's/^'$'\t''\([^ '$'\t'']\{1,\}\)[ '$'\t''].*/\1/p')" \ + -- "$cur") ) +} + +_inotifywait() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--exclude|--excludei|--format|--timefmt|--timeout|-!(-*)[ht]) + return + ;; + --fromfile|--outfile|-!(-*)o) + _filedir + return + ;; + --event|-!(-*)e) + _inotifywait_events "$1" + return + ;; + --ascending|--descending) + COMPREPLY=( $(compgen -W 'total' -- "$cur") ) + _inotifywait_events "$1" + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + _filedir +} && +complete -F _inotifywait inotifywait inotifywatch + +# ex: filetype=sh diff --git a/completions/insmod b/completions/insmod index ec81c93e..36c29dc4 100644 --- a/completions/insmod +++ b/completions/insmod @@ -9,8 +9,8 @@ _insmod() if [[ $cword -eq 1 ]]; then _filedir '@(?(k)o?(.gz))' else # do module parameter completion - COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ - -p ${words[1]} 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(PATH="$PATH:/sbin" modinfo \ + -p ${words[1]} 2>/dev/null | cut -d: -f1)" -- "$cur") ) fi } && complete -F _insmod insmod insmod.static diff --git a/completions/installpkg b/completions/installpkg index f002f775..3ebf1dfc 100644 --- a/completions/installpkg +++ b/completions/installpkg @@ -11,7 +11,7 @@ _installpkg() return ;; --priority) - COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ADD REC OPT SKP' -- "$cur") ) return ;; --tagfile) @@ -21,8 +21,8 @@ _installpkg() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse - --menu --ask --priority --tagfile' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--warn --md5sum --root --infobox --terse + --menu --ask --priority --tagfile' -- "$cur") ) return fi diff --git a/completions/interdiff b/completions/interdiff index cf71002e..e7923751 100644 --- a/completions/interdiff +++ b/completions/interdiff @@ -6,7 +6,7 @@ _interdiff() _init_completion -s || return case $prev in - -U|--unified|-p|--strip-match|-d|--drop-context) + --unified|--strip-match|--drop-context|-!(-*)[Upd]) return ;; esac @@ -14,13 +14,13 @@ _interdiff() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi local exts='@(?(d)patch|dif?(f))' word - for word in ${words[@]}; do + for word in "${words[@]}"; do if [[ $word == -@(z|-decompress) ]]; then exts+='?(.@(gz|bz2))' break diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d index 777f6ace..e4b2afc9 100644 --- a/completions/invoke-rc.d +++ b/completions/invoke-rc.d @@ -12,22 +12,22 @@ _invoke_rc_d() [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d \ || sysvdir=/etc/init.d - services=( $( printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob) ) ) + services=( $(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob)) ) services=( ${services[@]#$sysvdir/} ) options=( --help --quiet --force --try-anyway --disclose-deny --query \ --no-fallback ) if [[ ($cword -eq 1) || ("$prev" == --* ) ]]; then - valid_options=( $( \ - tr " " "\n" <<<"${words[@]} ${options[@]}" \ - | command sed -ne "/$( command sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ + valid_options=( $(\ + tr " " "\n" <<<"${words[*]} ${options[*]}" \ + | command sed -ne "/$(command sed "s/ /\\\\|/g" <<<"${options[*]}")/p" \ | sort | uniq -u \ ) ) - COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${valid_options[@]} ${services[@]}' -- "$cur") ) elif [[ -x $sysvdir/$prev ]]; then - COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ + COMPREPLY=( $(compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ - $sysvdir/$prev`' -- "$cur" ) ) + $sysvdir/$prev`' -- "$cur") ) else COMPREPLY=() fi diff --git a/completions/ip b/completions/ip index 00dd839d..372d2d85 100644 --- a/completions/ip +++ b/completions/ip @@ -2,9 +2,9 @@ _iproute2_etc() { - COMPREPLY+=( $( compgen -W \ - "$( awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null )" \ - -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null)" \ + -- "$cur") ) } _ip() @@ -17,7 +17,7 @@ _ip() return ;; -f|-family) - COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'inet inet6 ipx dnet link' -- "$cur") ) return ;; -b|-batch) @@ -25,7 +25,7 @@ _ip() return ;; -force) - COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-batch' -- "$cur") ) return ;; esac @@ -45,15 +45,15 @@ _ip() local c="-Version -statistics -details -resolve -family -oneline -timestamp -batch -rcvbuf" [[ $cword -eq 1 ]] && c+=" -force" - COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$c" -- "$cur") ) return ;; *) - COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | command sed -e \ + COMPREPLY=( $(compgen -W "help $(ip help 2>&1 | command sed -e \ '/OBJECT := /,/}/!d' -e \ 's/.*{//' -e \ 's/}.*//' -e \ - 's/|//g' )" -- "$cur" ) ) + 's/|//g')" -- "$cur") ) return ;; esac @@ -73,12 +73,12 @@ _ip() _available_interfaces ;; 2) - COMPREPLY=( $( compgen -W 'type' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'type' -- "$cur") ) ;; 3) [[ $prev == type ]] && \ - COMPREPLY=( $( compgen -W 'vlan veth vcan dummy - ifb macvlan can' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'vlan veth vcan dummy + ifb macvlan can' -- "$cur") ) ;; esac ;; @@ -89,8 +89,7 @@ _ip() case $prev in arp|dynamic|multicast|allmulticast|promisc|\ trailers) - COMPREPLY=( $( compgen -W 'on off' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) ;; txqueuelen|name|address|broadcast|mtu|netns|alias) ;; @@ -99,7 +98,7 @@ _ip() promisc trailers txqueuelen name address broadcast mtu netns alias" [[ $prev != @(up|down) ]] && c+=" up down" - COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$c" -- "$cur") ) ;; esac fi @@ -107,7 +106,7 @@ _ip() show) if [[ $cword -eq $subcword+1 ]]; then _available_interfaces - COMPREPLY+=( $( compgen -W 'dev group up' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'dev group up' -- "$cur") ) elif [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == group ]]; then @@ -116,8 +115,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help add delete set show' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help add delete set show' \ + -- "$cur") ) ;; esac ;; @@ -145,9 +144,9 @@ _ip() show|flush) if [[ $cword -eq $subcword+1 ]]; then _available_interfaces - COMPREPLY+=( $( compgen -W 'dev scope to label dynamic + COMPREPLY+=( $(compgen -W 'dev scope to label dynamic permanent tentative deprecated dadfailed temporary - primary secondary up' -- "$cur" ) ) + primary secondary up' -- "$cur") ) elif [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == scope ]]; then @@ -156,8 +155,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help add change replace del - show flush' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help add change replace del + show flush' -- "$cur") ) ;; esac ;; @@ -173,8 +172,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help list add del flush' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help list add del flush' \ + -- "$cur") ) ;; esac ;; @@ -196,8 +195,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help list flush get add del - change append replace monitor' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help list flush get add del + change append replace monitor' -- "$cur") ) ;; esac ;; @@ -211,8 +210,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help list add del flush' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help list add del flush' \ + -- "$cur") ) ;; esac ;; @@ -227,8 +226,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help add del change replace - show flush' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help add del change replace + show flush' -- "$cur") ) ;; esac ;; @@ -243,8 +242,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help change show' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help change show' \ + -- "$cur") ) ;; esac ;; @@ -258,8 +257,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help add change del show prl - 6rd' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help add change del show prl + 6rd' -- "$cur") ) ;; esac ;; @@ -273,14 +272,14 @@ _ip() if [[ $cword -eq $subcword+1 || $prev == dev ]]; then _available_interfaces [[ $prev != dev ]] && \ - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} dev' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} dev' \ + -- "$cur") ) fi ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help add del show' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help add del show' \ + -- "$cur") ) ;; esac ;; @@ -292,7 +291,7 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help show' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help show' -- "$cur") ) ;; esac ;; @@ -302,7 +301,7 @@ _ip() all) ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'help all' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help all' -- "$cur") ) ;; esac ;; @@ -314,8 +313,8 @@ _ip() ;; *) [[ $cword -eq $subcword ]] && \ - COMPREPLY=( $( compgen -W 'state policy monitor' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'state policy monitor' \ + -- "$cur") ) ;; esac ;; diff --git a/completions/iperf b/completions/iperf index 712ab946..43f9bcaf 100644 --- a/completions/iperf +++ b/completions/iperf @@ -3,37 +3,43 @@ _iperf() { local cur prev words cword split - _init_completion -s || return + _init_completion -s -n : || return case $prev in - -h|--help|-v|--version|-i|--interval|-l|--len|-p|--port|-w|--window|\ - -M|--mss|-b|--bandwidth|-n|--num|-t|--time|-L|--listenport|-P|\ - --parallel|-T|--ttl|-Z|--linux-congestion) + --help|--version|--interval|--len|--port|--window|--mss|--bandwidth|\ + --num|--time|--listenport|--parallel|--ttl|--linux-congestion|--omit|\ + --congestion|--bytes|--blockcount|--cport|--set-mss|--flowlabel|\ + --title|--tos|--affinity|-!(-*)[hvilpwMbntLPTZCkOSA]) return ;; - -f|--format) - COMPREPLY=( $( compgen -W 'k m K M' -- "$cur" ) ) + --format|-!(-*)f) + COMPREPLY=( $(compgen -W 'k m g K M G' -- "$cur") ) return ;; - -o|--output|-F|--fileinput) + --output|--fileinput|-!(-*)[oF]) _filedir return ;; - -B|--bind) + --bind|-!(-*)B) _available_interfaces -a - _ip_addresses + _ip_addresses -a + __ltrim_colon_completions "$cur" return ;; - -c|--client) + --client|-!(-*)c) _known_hosts_real -- "$cur" return ;; - -x|--reportexclude) - COMPREPLY=( $( compgen -W 'C D M S V' -- "$cur" ) ) + --reportexclude|-!(-*)x) + COMPREPLY=( $(compgen -W 'C D M S V' -- "$cur") ) return ;; - -y|--reportstyle) - COMPREPLY=( $( compgen -W 'C' -- "$cur" ) ) + --reportstyle|-!(-*)y) + COMPREPLY=( $(compgen -W 'C' -- "$cur") ) + return + ;; + --logfile) + _filedir log return ;; esac @@ -42,22 +48,22 @@ _iperf() # Filter mode specific options local i filter=cat - for i in ${words[@]}; do + for i in "${words[@]}"; do case $i in -s|--server) - filter='command sed -e /^Client.specific/,/^$/d' + filter='command sed -e /^Client.specific/,/^\(Server.specific.*\)\?$/d' ;; -c|--client) - filter='command sed -e /^Server.specific/,/^$/d' + filter='command sed -e /^Server.specific/,/^\(Client.specific.*\)\?$/d' ;; esac done [[ $filter != cat ]] && filter+=' -e /--client/d -e /--server/d' - COMPREPLY=( $( compgen -W \ - '$( "$1" --help 2>&1 | $filter | _parse_help - )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" --help 2>&1 | $filter | _parse_help -)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && -complete -F _iperf iperf +complete -F _iperf iperf iperf3 # ex: filetype=sh diff --git a/completions/ipmitool b/completions/ipmitool index 5a660733..f6307cfa 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -2,8 +2,8 @@ _ipmitool_singleline_help() { - COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ - command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 $2 2>&1 | \ + command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p')" -- "$cur") ) } _ipmitool() @@ -12,53 +12,53 @@ _ipmitool() _init_completion || return case $prev in - -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l) + -*[hVpUekyPmbtBTl]) return ;; - -d) - COMPREPLY=( $( compgen -W "$( \ + -*d) + COMPREPLY=( $(compgen -W "$(\ command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ - 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ - -- "$cur" ) ) + 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p')" \ + -- "$cur") ) return ;; - -I) - COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \ + -*I) + COMPREPLY=( $(compgen -W "$($1 -h 2>&1 | \ command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ - -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \ - -- "$cur" ) ) + -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p')" \ + -- "$cur") ) return ;; - -H) + -*H) _known_hosts_real -- "$cur" return ;; - -f|-S|-O) + -*[fSO]) _filedir return ;; - -C) - COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) ) + -*C) + COMPREPLY=( $(compgen -W '{0..14}' -- "$cur") ) return ;; - -L) - COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ - -- "$cur" ) ) + -*L) + COMPREPLY=( $(compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ + -- "$cur") ) return ;; - -A) - COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) ) + -*A) + COMPREPLY=( $(compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur") ) return ;; - -o) - COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \ - awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) ) + -*o) + COMPREPLY=( $(compgen -W "$($1 -o list 2>&1 | \ + awk '/^[ \t]+/ { print $1 }') list" -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h)' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi @@ -70,13 +70,13 @@ _ipmitool() local i c cmd subcmd for (( i=1; i < ${#words[@]}-1; i++ )); do [[ -n $cmd ]] && subcmd=${words[i]} && break - for c in ${cmds[@]}; do + for c in "${cmds[@]}"; do [[ ${words[i]} == $c ]] && cmd=$c && break done done if [[ -z $cmd ]]; then - COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${cmds[@]}' -- "$cur") ) return fi @@ -101,15 +101,15 @@ _ipmitool() ;; alert) [[ $prev == alert ]] && \ - COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'print set' -- "$cur") ) ;; stats) [[ $prev == stats ]] && \ - COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'print set' -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W 'print set alert stats' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'print set alert stats' \ + -- "$cur") ) ;; esac ;; @@ -119,8 +119,8 @@ _ipmitool() get|info|type|list|entity) ;; elist) - COMPREPLY=( $( compgen -W 'all full compact event mclog fru - generic' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all full compact event mclog fru + generic' -- "$cur") ) ;; dump) _filedir @@ -128,8 +128,7 @@ _ipmitool() fill) case $prev in fill) - COMPREPLY=( $( compgen -W 'sensors file' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'sensors file' -- "$cur") ) ;; file) _filedir @@ -137,8 +136,8 @@ _ipmitool() esac ;; *) - COMPREPLY=( $( compgen -W 'get info type list elist entity - dump fill' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'get info type list elist entity + dump fill' -- "$cur") ) ;; esac ;; @@ -148,7 +147,7 @@ _ipmitool() list|get|thresh) ;; *) - COMPREPLY=( $( compgen -W 'list get thresh' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'list get thresh' -- "$cur") ) ;; esac ;; @@ -162,11 +161,11 @@ _ipmitool() ;; time) [[ $prev == time ]] && \ - COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'get set' -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W 'info clear list elist delete add - get save writeraw readraw time' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'info clear list elist delete add + get save writeraw readraw time' -- "$cur") ) ;; esac ;; @@ -177,20 +176,19 @@ _ipmitool() ;; set) [[ $prev == set ]] && \ - COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'name password' -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W 'summary list set disable enable - priv test' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'summary list set disable enable + priv test' -- "$cur") ) ;; esac ;; set) [[ $prev == set ]] && \ - COMPREPLY=( $( compgen -W 'hostname username password privlvl - authtype localaddr targetaddr port csv verbose' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'hostname username password privlvl + authtype localaddr targetaddr port csv verbose' -- "$cur") ) ;; esac diff --git a/completions/ipsec b/completions/ipsec index 357d5055..00e6b7ea 100644 --- a/completions/ipsec +++ b/completions/ipsec @@ -10,7 +10,7 @@ _ipsec_connections() if [[ $keyword == [#]* ]]; then continue; fi [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=( "$name" ) done - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) } _ipsec_freeswan() @@ -19,28 +19,27 @@ _ipsec_freeswan() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual + COMPREPLY=( $(compgen -W 'auto barf eroute klipsdebug look manual pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp - tncfg whack' -- "$cur" ) ) + tncfg whack' -- "$cur") ) return fi case ${words[1]} in auto) - COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete + COMPREPLY=( $(compgen -W '--asynchronous --up --add --delete --replace --down --route --unroute --ready --status - --rereadsecrets' -- "$cur" ) ) + --rereadsecrets' -- "$cur") ) ;; manual) - COMPREPLY=( $( compgen -W '--up --down --route --unroute --union' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--up --down --route --unroute --union' \ + -- "$cur") ) ;; ranbits) - COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--quick --continuous --bytes' -- "$cur") ) ;; setup) - COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--start --stop --restart' -- "$cur") ) ;; *) ;; @@ -53,7 +52,7 @@ _ipsec_strongswan() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'down irdumm leases listaacerts listacerts + COMPREPLY=( $(compgen -W 'down irdumm leases listaacerts listacerts listalgs listall listcacerts listcainfos listcards listcerts listcrls listgroups listocsp listocspcerts listpubkeys openac pki pluto pool purgecerts purgecrls purgeike purgeocsp ready reload @@ -61,25 +60,25 @@ _ipsec_strongswan() rereadgroups rereadocspcerts rereadsecrets restart route scdecrypt scencrypt scepclient secrets start starter status statusall stop stroke unroute uci up update version whack --confdir --copyright - --directory --help --version --versioncode' -- "$cur" ) ) + --directory --help --version --versioncode' -- "$cur") ) return fi case ${words[1]} in down|route|status|statusall|unroute|up) - local confdir=$( ipsec --confdir ) - _ipsec_connections < "$confdir/ipsec.conf" + local confdir=$(ipsec --confdir) + _ipsec_connections <"$confdir/ipsec.conf" ;; list*) - COMPREPLY=( $( compgen -W '--utc' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--utc' -- "$cur") ) ;; restart|start) - COMPREPLY=( $( compgen -W '--attach-gdb --auto-update --debug - --debug-all --debug-more --nofork' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--attach-gdb --auto-update --debug + --debug-all --debug-more --nofork' -- "$cur") ) ;; pki) - COMPREPLY=( $( compgen -W '--gen --issue --keyid --print --pub - --req --self --signcrl --verify' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--gen --issue --keyid --print --pub + --req --self --signcrl --verify' -- "$cur") ) ;; pool) ;; @@ -91,7 +90,7 @@ _ipsec_strongswan() esac } -case "$( ipsec --version 2>/dev/null )" in +case "$(ipsec --version 2>/dev/null)" in *strongSwan*) complete -F _ipsec_strongswan ipsec ;; diff --git a/completions/iptables b/completions/iptables index 5ef81037..69072613 100644 --- a/completions/iptables +++ b/completions/iptables @@ -7,44 +7,39 @@ _iptables() local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' - if [[ ${words[@]} == *-t\ *filter* ]]; then - table="-t filter" - elif [[ ${words[@]} == *-t\ *nat* ]]; then - table="-t nat" - elif [[ ${words[@]} == *-t\ *mangle* ]]; then - table="-t mangle" - fi + [[ "${words[*]}" =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] \ + && table="-t ${BASH_REMATCH[2]}" case $prev in -*[AIDRPFXLZ]) - COMPREPLY=( $( compgen -W '`"$1" $table -nL 2>/dev/null | \ - command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '`"$1" $table -nL 2>/dev/null | \ + command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur") ) ;; -*t) - COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'nat filter mangle' -- "$cur") ) ;; -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT + COMPREPLY=( $(compgen -W 'ACCEPT DROP LOG ULOG REJECT `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ - "$cur" ) ) + "$cur") ) elif [[ $table == "-t nat" ]]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MIRROR SNAT + COMPREPLY=( $(compgen -W 'ACCEPT DROP LOG ULOG REJECT MIRROR SNAT DNAT MASQUERADE `"$1" $table -nL 2>/dev/null | \ command sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ - -- "$cur" ) ) + -- "$cur") ) elif [[ $table == "-t mangle" ]]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MARK TOS + COMPREPLY=( $(compgen -W 'ACCEPT DROP LOG ULOG REJECT MARK TOS `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ - "$cur" ) ) + "$cur") ) fi ;; *) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( "$1" --help 2>&1 | - command sed -e "s/^\[\!\]//" | _parse_help - )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" --help 2>&1 | + command sed -e "s/^\[\!\]//" | _parse_help -)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi ;; diff --git a/completions/ipv6calc b/completions/ipv6calc index 0dacff94..f001999a 100644 --- a/completions/ipv6calc +++ b/completions/ipv6calc @@ -6,14 +6,14 @@ _ipv6calc() _init_completion -s || return case "$prev" in - -d|--debug) + --debug|-!(-*)d) return ;; - -I|--in|-O|--out|-A|--action) + --in|--out|--action|-!(-*)[IOA]) # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. - COMPREPLY=( $( compgen -W "$( $1 "$prev" -h 2>&1 | \ - command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 "$prev" -h 2>&1 | \ + command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p')" \ + -- "$cur") ) return ;; --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6) @@ -28,13 +28,13 @@ _ipv6calc() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --debug --quiet --in --out --action + COMPREPLY=( $(compgen -W '--help --debug --quiet --in --out --action --examples --showinfo --show_types --machine_readable --db-geoip --db-geoip-default --db-ip2location-ipv4 --db-ip2location-ipv6 --lowercase --uppercase --printprefix --printsuffix --maskprefix --masksuffix --printstart --printend --printcompressed --printuncompressed --printfulluncompressed --printmirrored' \ - -- "$cur" ) ) + -- "$cur") ) fi } && diff --git a/completions/iscsiadm b/completions/iscsiadm index e5218d75..1fa30db6 100644 --- a/completions/iscsiadm +++ b/completions/iscsiadm @@ -6,21 +6,21 @@ _iscsiadm() _init_completion -s || return case $prev in - -m|--mode) - COMPREPLY=( $( compgen -W 'discovery node session iface fw host' \ - -- "$cur" ) ) + --mode|-!(-*)m) + COMPREPLY=( $(compgen -W 'discovery node session iface fw host' \ + -- "$cur") ) return ;; - -o|--op) - COMPREPLY=( $( compgen -W 'new delete update show' -- "$cur" ) ) + --op|-!(-*)o) + COMPREPLY=( $(compgen -W 'new delete update show' -- "$cur") ) return ;; - -t|--type) - COMPREPLY=( $( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) ) + --type|-!(-*)t) + COMPREPLY=( $(compgen -W 'sendtargets st slp isns fw' -- "$cur") ) return ;; - -L|-U|--loginall|--logoutall) - COMPREPLY=( $( compgen -W 'all manual automatic' -- "$cur" ) ) + --loginall|--logoutall|-!(-*)[LU]) + COMPREPLY=( $(compgen -W 'all manual automatic' -- "$cur") ) return ;; esac @@ -28,7 +28,7 @@ _iscsiadm() $split && return local options - if [[ $cword -gt 1 ]] ; then + if [[ $cword -gt 1 ]]; then case ${words[2]} in discovery) @@ -59,7 +59,7 @@ _iscsiadm() options='--mode' fi - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) } && complete -F _iscsiadm iscsiadm diff --git a/completions/isort b/completions/isort new file mode 100644 index 00000000..e4a028be --- /dev/null +++ b/completions/isort @@ -0,0 +1,41 @@ +# isort completion -*- shell-script -*- + +_isort() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--add-import|--builtin|--future|--from-first|-ff|\ + --force-grid-wrap|-fgw|--indent|--lines|--lines-after-imports|-lai|\ + --lines-between-types|-lbt|--line-ending|-le|--no-lines-before|-nlb|\ + --dont-skip|-ns|--thirdparty|--project|--remove-import|--skip|\ + --skip-glob|-sg|--settings-path|-sp|--top|--virtual-env|--line-width|\ + --wrap-length|-wl|-[habfiloprstw]) + return + ;; + --jobs|-j) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) + return + ;; + --multi-line|-m) + COMPREPLY=( $(compgen -W '{0..5}' -- "$cur") ) + return + ;; + --section-default|-sd) + COMPREPLY=( $(compgen -W 'FUTURE STDLIB THIRDPARTY FIRSTPARTY + LOCALFOLDER' -- "$cur") ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + _filedir '@(py|pyi)' +} && +complete -F _isort isort + +# ex: filetype=sh diff --git a/completions/isql b/completions/isql index 862a9304..4bd24c41 100644 --- a/completions/isql +++ b/completions/isql @@ -7,7 +7,7 @@ _isql() _init_completion || return [[ -f $ODBCINI ]] \ - && COMPREPLY=( $( command grep "\[$cur" "$ODBCINI" | tr -d \[\] ) ) + && COMPREPLY=( $(command grep "\[$cur" "$ODBCINI" | tr -d \[\]) ) } && complete -F _isql isql diff --git a/completions/iwconfig b/completions/iwconfig index 114081dd..762ec2ea 100644 --- a/completions/iwconfig +++ b/completions/iwconfig @@ -7,81 +7,81 @@ _iwconfig() case $prev in mode) - COMPREPLY=( $( compgen -W 'managed ad-hoc master repeater secondary - monitor' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'managed ad-hoc master repeater secondary + monitor' -- "$cur") ) return ;; essid) - COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off any' -- "$cur") ) if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then - COMPREPLY+=( $( compgen -W \ - "$( iwlist ${words[1]} scan | \ - awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(iwlist ${words[1]} scan | \ + awk -F'\"' '/ESSID/ {print $2}')" -- "$cur") ) fi return ;; nwid) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; channel) - COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ - awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(iwlist ${words[1]} channel | \ + awk '/^[ \t]*Channel/ {print $2}')" -- "$cur") ) return ;; freq) - COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ - awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(iwlist ${words[1]} channel | \ + awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur") ) return ;; ap) - COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off any' -- "$cur") ) if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then - COMPREPLY+=( $( compgen -W \ - "$( iwlist ${words[1]} scan | \ - awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(iwlist ${words[1]} scan | \ + awk -F ': ' '/Address/ {print $2}')" -- "$cur") ) fi return ;; rate) - COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) ) - COMPREPLY+=( $( compgen -W \ - "$( iwlist ${words[1]} rate | \ - awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'auto fixed' -- "$cur") ) + COMPREPLY+=( $(compgen -W \ + "$(iwlist ${words[1]} rate | \ + awk '/^[ \t]*[0-9]/ {print $1"M"}')" -- "$cur") ) return ;; rts|frag) - COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'auto fixed off' -- "$cur") ) return ;; key|enc) - COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'off on open restricted' -- "$cur") ) return ;; power) - COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'period timeout off on' -- "$cur") ) return ;; txpower) - COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'off on auto' -- "$cur") ) return ;; retry) - COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'limit lifetime' -- "$cur") ) return ;; esac if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version' -- "$cur") ) else _available_interfaces -w fi else - COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode ap - nick rate rts frag enc key power txpower commit' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'essid nwid mode freq channel sens mode ap + nick rate rts frag enc key power txpower commit' -- "$cur") ) fi } && diff --git a/completions/iwlist b/completions/iwlist index b27dbe8b..65e0b2fb 100644 --- a/completions/iwlist +++ b/completions/iwlist @@ -7,14 +7,14 @@ _iwlist() if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version' -- "$cur") ) else _available_interfaces -w fi else - COMPREPLY=( $( compgen -W 'scan scanning freq frequency channel rate + COMPREPLY=( $(compgen -W 'scan scanning freq frequency channel rate bit bitrate key enc encryption power txpower retry ap accesspoint - peers event' -- "$cur" ) ) + peers event' -- "$cur") ) fi } && complete -F _iwlist iwlist diff --git a/completions/iwpriv b/completions/iwpriv index c7f8209e..83673b4e 100644 --- a/completions/iwpriv +++ b/completions/iwpriv @@ -7,23 +7,23 @@ _iwpriv() case $prev in roam) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; port) - COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ad-hoc managed' -- "$cur") ) return ;; esac if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version' -- "$cur") ) else _available_interfaces -w fi else - COMPREPLY=( $( compgen -W '--all roam port' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--all roam port' -- "$cur") ) fi } && complete -F _iwpriv iwpriv diff --git a/completions/iwspy b/completions/iwspy index 1cf3a283..e4805116 100644 --- a/completions/iwspy +++ b/completions/iwspy @@ -7,12 +7,12 @@ _iwspy() if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version' -- "$cur") ) else _available_interfaces -w fi else - COMPREPLY=( $( compgen -W 'setthr getthr off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'setthr getthr off' -- "$cur") ) fi } && complete -F _iwspy iwspy diff --git a/completions/jar b/completions/jar index b7de930f..c839aa85 100644 --- a/completions/jar +++ b/completions/jar @@ -6,7 +6,7 @@ _jar() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'c t x u' -- "$cur") ) return fi diff --git a/completions/jarsigner b/completions/jarsigner index 2441bd1a..171865b2 100644 --- a/completions/jarsigner +++ b/completions/jarsigner @@ -7,7 +7,7 @@ _jarsigner() case $prev in -keystore) - COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'NONE' -- "$cur") ) _filedir '@(jks|ks|p12|pfx)' return ;; @@ -21,7 +21,7 @@ _jarsigner() return ;; -storetype) - COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'JKS PKCS11 PKCS12' -- "$cur") ) return ;; -signedjar) @@ -34,20 +34,20 @@ _jarsigner() local i jar=false for (( i=0; i < ${#words[@]}-1; i++ )) ; do if [[ "${words[i]}" == *.jar && \ - "${words[i-1]}" != -signedjar ]] ; then + "${words[i-1]}" != -signedjar ]]; then jar=true break fi done if ! $jar ; then - if [[ "$cur" == -* ]] ; then + if [[ "$cur" == -* ]]; then # Documented as "should not be used": -internalsf, -sectionsonly - COMPREPLY=( $( compgen -W '-keystore -storepass -storetype + COMPREPLY=( $(compgen -W '-keystore -storepass -storetype -keypass -sigfile -signedjar -digestalg -sigalg -verify -verbose -certs -tsa -tsacert -altsigner -altsignerpath -protected -providerName -providerClass -providerArg' \ - -- "$cur" ) ) + -- "$cur") ) fi _filedir jar fi diff --git a/completions/java b/completions/java index e8d81fb4..3ca65869 100644 --- a/completions/java +++ b/completions/java @@ -62,18 +62,18 @@ _java_classes() for i in ${classpath//:/ }; do if [[ "$i" == *.@(jar|zip) && -r $i ]]; then if type zipinfo &>/dev/null; then - COMPREPLY+=( $( zipinfo -1 "$i" "$cur*" 2>/dev/null | \ - command grep '^[^$]*\.class$' ) ) + COMPREPLY+=( $(zipinfo -1 "$i" "$cur*" 2>/dev/null | \ + command grep '^[^$]*\.class$') ) else - COMPREPLY+=( $( jar tf "$i" "$cur" | \ - command grep '^[^$]*\.class$' ) ) + COMPREPLY+=( $(jar tf "$i" "$cur" | \ + command grep '^[^$]*\.class$') ) fi elif [[ -d $i ]]; then COMPREPLY+=( - $( compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|" ) - $( compgen -f -X '!*.class' -- "$i/$cur" | \ - command sed -e '/\$/d' -e "s|^$i/||" ) + $(compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|") + $(compgen -f -X '!*.class' -- "$i/$cur" | \ + command sed -e '/\$/d' -e "s|^$i/||") ) [[ $COMPREPLY == *.class ]] || compopt -o nospace @@ -102,12 +102,12 @@ _java_packages() # parse each sourcepath element for packages for i in ${sourcepath//:/ }; do if [[ -d $i ]]; then - COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \ - command sed -e 's|^'$i'/||' ) ) + COMPREPLY+=( $(command ls -F -d $i/$cur* 2>/dev/null | \ + command sed -e 's|^'$i'/||') ) fi done # keep only packages - COMPREPLY=( $( tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$" ) ) + COMPREPLY=( $(tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$") ) # remove packages extension COMPREPLY=( ${COMPREPLY[@]%/} ) # convert path syntax to package syntax @@ -142,7 +142,7 @@ _java() case $cur in # standard option completions -verbose:*) - COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'class gc jni' -- "${cur#*:}") ) return ;; -javaagent:*) @@ -166,17 +166,17 @@ _java() return ;; -Xcheck:*) - COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'jni' -- "${cur#*:}") ) return ;; -Xgc:*) - COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \ - -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'singlecon gencon singlepar genpar' \ + -- "${cur#*:}") ) return ;; -Xgcprio:*) - COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \ - -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'throughput pausetime deterministic' \ + -- "${cur#*:}") ) return ;; -Xloggc:*|-Xverboselog:*) @@ -185,16 +185,16 @@ _java() return ;; -Xshare:*) - COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'auto off on' -- "${cur#*:}") ) return ;; -Xverbose:*) - COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt - gcpause gcreport' -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'memory load jni cpuinfo codegen opt + gcpause gcreport' -- "${cur#*:}") ) return ;; -Xverify:*) - COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -W 'all none remote' -- "${cur#*:}") ) return ;; # the rest that we have no completions for @@ -211,9 +211,9 @@ _java() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) [[ $cur == -X* ]] && \ - COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$(_parse_help "$1" -X)' -- "$cur") ) else if [[ "$prev" == -jar ]]; then # jar file completion @@ -271,7 +271,7 @@ _javadoc() fi if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) else # source files completion _filedir java @@ -304,16 +304,16 @@ _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 | command sed -e 's/-g:none/-g:{none}/' -ne \ - "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p" ) - COMPREPLY=( $( compgen -W "${opts//,/ }" -- "${cur#*:}" ) ) + local opts=$("$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \ + "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p") + COMPREPLY=( $(compgen -W "${opts//,/ }" -- "${cur#*:}") ) return fi if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) [[ $cur == -X* ]] && \ - COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$(_parse_help "$1" -X)' -- "$cur") ) else # source files completion _filedir java diff --git a/completions/javaws b/completions/javaws index 7d6e22c8..c21d3ac4 100644 --- a/completions/javaws +++ b/completions/javaws @@ -22,7 +22,7 @@ _javaws() if [[ $cur == *= ]]; then return elif [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(_parse_help "$1" -help) " -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/jpegoptim b/completions/jpegoptim index 754f16a2..044cc753 100644 --- a/completions/jpegoptim +++ b/completions/jpegoptim @@ -6,19 +6,19 @@ _jpegoptim() _init_completion -s || return case $prev in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]*) return ;; - -d|--dest) + --dest|-!(-*)d) _filedir -d return ;; - -m|--max|-T|--threshold) - COMPREPLY=( $( compgen -W '{0..100}' -- "$cur" ) ) + --max|--threshold|-!(-*)[mT]) + COMPREPLY=( $(compgen -W '{0..100}' -- "$cur") ) return ;; - -S|--size) - COMPREPLY=( $( compgen -W '{1..99}%' -- "$cur" ) ) + --size|-!(-*)S) + COMPREPLY=( $(compgen -W '{1..99}%' -- "$cur") ) return ;; esac @@ -26,7 +26,7 @@ _jpegoptim() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/jps b/completions/jps index e46c9f16..a6a60299 100644 --- a/completions/jps +++ b/completions/jps @@ -14,7 +14,7 @@ _jps() if [[ $cur == -* ]]; then # Not using _parse_usage because output has [-help] which does not # mean -h, -e, -l, -p... - COMPREPLY=( $( compgen -W "-q -m -l -v -V -J -help" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "-q -m -l -v -V -J -help" -- "$cur") ) [[ $COMPREPLY == -J* ]] && compopt -o nospace else _known_hosts_real -- "$cur" diff --git a/completions/jq b/completions/jq new file mode 100644 index 00000000..3fdbfb0c --- /dev/null +++ b/completions/jq @@ -0,0 +1,54 @@ +# jq(1) completion -*- shell-script -*- + +_jq() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version|--arg|--argjson|--slurpfile|--argfile) + return + ;; + --indent) + COMPREPLY=( $(compgen -W '{1..8}' -- "$cur") ) + return + ;; + --from-file|--run-tests|-!(-*)f) + _filedir + return + ;; + -!(-*)L) + _filedir -d + return + ;; + esac + + (( cword > 2 )) && \ + case ${words[cword-2]} in + --arg|--argjson) + return + ;; + --slurpfile|--argfile) + _filedir json + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + local args + # TODO: DTRT with args taking 2 options + _count_args "" "@(--arg|--arg?(json|file)|--?(slurp|from-)file|--indent|--run-tests|-!(-*)[fL])" + + # 1st arg is filter + [[ $args -eq 1 ]] && return + # 2... are input files + _filedir json + +} && +complete -F _jq jq + +# ex: filetype=sh diff --git a/completions/jshint b/completions/jshint index ea9bbeb5..ee89070a 100644 --- a/completions/jshint +++ b/completions/jshint @@ -14,11 +14,11 @@ _jshint() return ;; --reporter) - COMPREPLY=( $( compgen -W "jslint checkstyle unix" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "jslint checkstyle unix" -- "$cur") ) return ;; --extract) - COMPREPLY=( $( compgen -W "auto always never" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "auto always never" -- "$cur") ) return ;; esac @@ -26,7 +26,7 @@ _jshint() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/json_xs b/completions/json_xs new file mode 100644 index 00000000..98d0ba63 --- /dev/null +++ b/completions/json_xs @@ -0,0 +1,31 @@ +# json_xs completion -*- shell-script -*- + +_json_xs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*f) + COMPREPLY=( $(compgen -W 'json cbor storable storable-file bencode + clzf eval yaml string none' -- "$cur") ) + return + ;; + -*t) + COMPREPLY=( $(compgen -W 'json json-utf-8 json-pretty + json-utf-16le json-utf-16be json-utf-32le json-utf-32be + cbor storable storable-file bencode clzf yaml dump dumper + string none' -- "$cur") ) + return + ;; + -*e) + return + ;; + esac + + [[ $cur == -* ]] && + COMPREPLY=( $(compgen -W '$(_parse_usage "$1") -f' -- "$cur") ) +} && +complete -F _json_xs json_xs + +# ex: filetype=sh diff --git a/completions/jsonschema b/completions/jsonschema new file mode 100644 index 00000000..441977e4 --- /dev/null +++ b/completions/jsonschema @@ -0,0 +1,29 @@ +# bash completion for jsonschema -*- shell-script -*- + +_jsonschema() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--error-format|--validator|-[hFV]) + return + ;; + --instance|-i) + _filedir json + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + local args; _count_args "" "-*" + [[ $args -eq 1 ]] || return + _filedir '@(json|schema)' +} && +complete -F _jsonschema jsonschema + +# ex: filetype=sh diff --git a/completions/k3b b/completions/k3b index 2cbcbb1b..b52e6de0 100644 --- a/completions/k3b +++ b/completions/k3b @@ -31,13 +31,13 @@ _k3b() return ;; --ao) - COMPREPLY=( $( compgen -W 'alsa arts' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'alsa arts' -- "$cur") ) return ;; esac - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W "$(_parse_help "$1")" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir diff --git a/completions/kcov b/completions/kcov index 5d067778..8490a969 100644 --- a/completions/kcov +++ b/completions/kcov @@ -11,8 +11,8 @@ _kcov() return ;; --sort-type|-s) - COMPREPLY=( $( compgen -W 'filename percent reverse lines - uncovered' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'filename percent reverse lines + uncovered' -- "$cur") ) return ;; --include-path|--exclude-path) @@ -33,11 +33,11 @@ _kcov() if [[ "$cur" == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" - COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "{0..100}" -- "$cur") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && \ COMPREPLY=( ${COMPREPLY/#/$prev,} ) else - COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "{0..100}" -- "$cur") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/%/,} ) compopt -o nospace fi @@ -52,7 +52,7 @@ _kcov() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/kill b/completions/kill index ac179cd9..4cd5f911 100644 --- a/completions/kill +++ b/completions/kill @@ -18,7 +18,7 @@ _kill() if [[ $cword -eq 1 && "$cur" == -* ]]; then # return list of available signals _signals - - COMPREPLY+=( $( compgen -W "-s -l" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "-s -l" -- "$cur") ) else # return list of available PIDs _pids diff --git a/completions/killall b/completions/killall index 6d1532c3..e1b56ce1 100644 --- a/completions/killall +++ b/completions/killall @@ -8,14 +8,14 @@ _killall() _init_completion -s || return case $prev in - -Z|--context|-o|--older-than|-y|--younger-than|-V|--version) + --context|--older-than|--younger-than|--version|-!(-*)@([Zoy]|V*)) return ;; - -s|--signal) + --signal|-!(-*)s) _signals return ;; - -u|--user) + --user|-!(-*)u) _allowed_users return ;; @@ -24,7 +24,7 @@ _killall() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $cword -eq 1 ]] && _signals - return fi diff --git a/completions/kldload b/completions/kldload index 0442e95e..4817679e 100644 --- a/completions/kldload +++ b/completions/kldload @@ -11,7 +11,7 @@ _kldload() [[ -d $moddir ]] || moddir=/boot/kernel/ compopt -o filenames - COMPREPLY=( $( compgen -f "$moddir$cur" ) ) + COMPREPLY=( $(compgen -f "$moddir$cur") ) COMPREPLY=( ${COMPREPLY[@]#$moddir} ) COMPREPLY=( ${COMPREPLY[@]%.ko} ) diff --git a/completions/kldunload b/completions/kldunload index 52634c1e..e1462677 100644 --- a/completions/kldunload +++ b/completions/kldunload @@ -7,7 +7,7 @@ _kldunload() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W '$(kldstat)' -X 'kernel' -X '!*.ko' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(kldstat)' -X 'kernel' -X '!*.ko' -- "$cur") ) COMPREPLY=( ${COMPREPLY[@]%.ko} ) } && complete -F _kldunload kldunload diff --git a/completions/koji b/completions/koji index 30b8d49a..be43f0a2 100644 --- a/completions/koji +++ b/completions/koji @@ -2,8 +2,8 @@ _koji_search() { - COMPREPLY+=( $( compgen -W \ - '$( "$1" -q search $2 "$cur*" 2>/dev/null )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + '$("$1" -q search $2 "$cur*" 2>/dev/null)' -- "$cur") ) } _koji_build() @@ -23,14 +23,13 @@ _koji_user() _koji_tag() { - COMPREPLY+=( $( compgen -W '$( "$1" -q list-tags 2>/dev/null )' \ - -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$("$1" -q list-tags 2>/dev/null)' -- "$cur") ) } _koji_target() { - COMPREPLY+=( $( compgen -W '$( "$1" -q list-targets 2>/dev/null | - awk "{ print \$1 }" )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$("$1" -q list-targets 2>/dev/null | + awk "{ print \$1 }")' -- "$cur") ) } _koji() @@ -47,10 +46,10 @@ _koji() done case $prev in - -h|--help|--help-commands) + --help|--help-commands|-!(-*)h*) return ;; - -c|--config|--keytab|-o) + --config|--keytab|-!(-*)[co]) _filedir return ;; @@ -59,8 +58,7 @@ _koji() return ;; --authtype) - COMPREPLY=( $( compgen -W 'noauth ssl password kerberos' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'noauth ssl password kerberos' -- "$cur") ) return ;; --topdir) @@ -70,7 +68,7 @@ _koji() --type) case $command in latest-pkg|list-tagged) - COMPREPLY=( $( compgen -W 'maven' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'maven' -- "$cur") ) ;; esac return @@ -109,8 +107,8 @@ _koji() if [[ $command ]]; then if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( _parse_help "$1" "$command --help" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(_parse_help "$1" "$command --help")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -199,8 +197,8 @@ _koji() search) case $nth in 1) - COMPREPLY=( $( compgen -W 'package build tag target - user host rpm' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'package build tag target + user host rpm' -- "$cur") ) ;; esac ;; @@ -235,11 +233,11 @@ _koji() fi if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ ! $command ]]; then - COMPREPLY=( $( compgen -W '$( "$1" --help-commands 2>/dev/null | \ - awk "/^( +|\t)/ { print \$1 }" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" --help-commands 2>/dev/null | \ + awk "/^( +|\t)/ { print \$1 }")' -- "$cur") ) fi } && complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji diff --git a/completions/ktutil b/completions/ktutil index 2baa1c6c..572a2ec4 100644 --- a/completions/ktutil +++ b/completions/ktutil @@ -2,21 +2,21 @@ _heimdal_principals() { - COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \ - awk '{print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(kadmin -l dump 2>/dev/null | \ + awk '{print $1}')" -- "$cur") ) } _heimdal_realms() { - COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \ - awk '{print $1}' | awk -F@ '{print $2}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(kadmin -l dump 2>/dev/null | \ + awk '{print $1}' | awk -F@ '{print $2}')" -- "$cur") ) } _heimdal_encodings() { - COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 + COMPREPLY=( $(compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 - aes256-cts-hmac-sha1-96' -- "$cur" ) ) + aes256-cts-hmac-sha1-96' -- "$cur") ) } _ktutil() @@ -57,7 +57,7 @@ _ktutil() for (( i=1; i < cword; i++ )); do case ${words[i]} in -k|--keytab) - i=$(($i+1)) + (( i++ )) ;; -*) ;; @@ -97,7 +97,7 @@ _ktutil() options='-k --keytab -v --verbose --version -v --help' ;; esac - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else case $command in copy) @@ -110,7 +110,7 @@ _ktutil() _heimdal_principals ;; *) - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) ;; esac fi diff --git a/completions/larch b/completions/larch index 5b7ebd14..0773c2da 100644 --- a/completions/larch +++ b/completions/larch @@ -7,7 +7,7 @@ _larch() _init_completion || return if [[ $cword -eq 1 || "$prev" == -* ]]; then - COMPREPLY=( $( compgen -W ' \ + COMPREPLY=( $(compgen -W ' \ my-id my-default-archive register-archive whereis-archive archives \ init-tree tree-root tree-version set-tree-version inventory \ tagging-method tree-lint missing-tags add delete \ @@ -30,7 +30,7 @@ _larch() distribution-name notify my-notifier mail-new-categories \ mail-new-branches mail-new-versions mail-new-revisions \ notify-library notify-browser push-new-revisions sendmail-mailx' \ - "$cur" ) ) + "$cur") ) fi } && diff --git a/completions/lastlog b/completions/lastlog index 4ac6b520..19e928c2 100644 --- a/completions/lastlog +++ b/completions/lastlog @@ -6,18 +6,18 @@ _lastlog() _init_completion -s || return case $prev in - -b|--before|-h|--help|-t|--time) + --before|--help|--time|-!(-*)@([bt]|h*)) return ;; - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|-!(-*)u) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _lastlog lastlog diff --git a/completions/ldapsearch b/completions/ldapsearch index 9a6f25db..a0bdcb9d 100644 --- a/completions/ldapsearch +++ b/completions/ldapsearch @@ -2,12 +2,12 @@ _ldap_uris() { - COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ldap:// ldaps://' -- "$cur") ) } _ldap_protocols() { - COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '2 3' -- "$cur") ) } _ldapsearch() @@ -16,39 +16,38 @@ _ldapsearch() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -T) + -*T) _filedir -d return ;; - -f|-y) + -*[fy]) _filedir return ;; - -s) - COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) ) + -*s) + COMPREPLY=( $(compgen -W 'base one sub children' -- "$cur") ) return ;; - -a) - COMPREPLY=( $( compgen -W 'never always search find' \ - -- "$cur" ) ) + -*a) + COMPREPLY=( $(compgen -W 'never always search find' -- "$cur") ) return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldapsearch ldapsearch @@ -59,26 +58,26 @@ _ldapaddmodify() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -S|-f|-y) + -*[Sfy]) _filedir return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldapaddmodify ldapadd ldapmodify @@ -89,26 +88,26 @@ _ldapdelete() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -f|-y) + -*[fy]) _filedir return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldapdelete ldapdelete @@ -119,26 +118,26 @@ _ldapcompare() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -y) + -*y) _filedir return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldapcompare ldapcompare @@ -149,26 +148,26 @@ _ldapmodrdn() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -f|-y) + -*[fy]) _filedir return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -ZZ -MM' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -ZZ -MM' -- "$cur") ) fi } && complete -F _ldapmodrdn ldapmodrdn @@ -179,26 +178,26 @@ _ldapwhoami() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -f|-y) + -*[fy]) _filedir return ;; - -P) + -*P) _ldap_protocols return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldapwhoami ldapwhoami @@ -209,22 +208,22 @@ _ldappasswd() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H) + -*H) _ldap_uris return ;; - -t|-T|-y) + -*[tTy]) _filedir return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur") ) fi } && complete -F _ldappasswd ldappasswd diff --git a/completions/ldapvi b/completions/ldapvi index 7d3fcf66..a7b55fcc 100644 --- a/completions/ldapvi +++ b/completions/ldapvi @@ -6,44 +6,44 @@ _ldapvi() _init_completion || return case $prev in - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -Y|--sasl-mech) - COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 - PLAIN ANONYMOUS' -- "$cur" ) ) + --sasl-mech|-!(-*)Y) + COMPREPLY=( $(compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 + PLAIN ANONYMOUS' -- "$cur") ) return ;; --bind) - COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'simple sasl' -- "$cur") ) return ;; --bind-dialog) - COMPREPLY=( $( compgen -W 'never auto always' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'never auto always' -- "$cur") ) return ;; --scope) - COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'base one sub' -- "$cur") ) return ;; --deref) - COMPREPLY=( $( compgen -W 'never searching finding always' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'never searching finding always' \ + -- "$cur") ) return ;; --encoding) - COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ASCII UTF-8 binary' -- "$cur") ) return ;; --tls) - COMPREPLY=( $( compgen -W 'never allow try strict' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'never allow try strict' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _ldapvi ldapvi diff --git a/completions/lftp b/completions/lftp index 3eb07399..41fb1356 100644 --- a/completions/lftp +++ b/completions/lftp @@ -6,22 +6,22 @@ _lftp() _init_completion || return case $prev in - -f) + -!(-*)f) _filedir return ;; - -c|-h|--help|-v|--version|-e|-u|-p) + --help|--version|-!(-*)[chveups]) return ;; esac - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -W \ - '$( cut -f 1 -s ~/.lftp/bookmarks ${XDG_DATA_HOME:-$HOME/.local/share}/lftp/bookmarks 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(cut -f 1 -s ~/.lftp/bookmarks ${XDG_DATA_HOME:-$HOME/.local/share}/lftp/bookmarks 2>/dev/null)' -- "$cur") ) _known_hosts_real -- "$cur" } && complete -F _lftp lftp diff --git a/completions/lftpget b/completions/lftpget index 8f1d4a2f..1583500c 100644 --- a/completions/lftpget +++ b/completions/lftpget @@ -5,8 +5,8 @@ _lftpget() local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '-c -d -v' -- "$cur") ) fi } && complete -F _lftpget lftpget diff --git a/completions/lilo b/completions/lilo index 1ccca35c..03e3ee29 100644 --- a/completions/lilo +++ b/completions/lilo @@ -2,8 +2,8 @@ _lilo_labels() { - COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ - /etc/lilo.conf | command sed -e 's/\"//g' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(awk -F'=' '/label/ {print $2}' \ + /etc/lilo.conf | command sed -e 's/\"//g')" -- "$cur") ) } _lilo() @@ -33,16 +33,16 @@ _lilo() ;; -T) # topic completion - COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= table= - video' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help ChRul EBDA geom geom= table= + video' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then # relevant options completion - COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m -M -p -P - -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m -M -p -P + -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur") ) fi } && complete -F _lilo lilo diff --git a/completions/links b/completions/links index 8c72970e..6bfee654 100644 --- a/completions/links +++ b/completions/links @@ -3,31 +3,98 @@ _links() { local cur prev words cword - _init_completion || return + _init_completion -n : || return - case $cur in - --*) - COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) - ;; - -*) - COMPREPLY=( $( compgen -W '-async-dns -max-connections - -max-connections-to-host -retries -receive-timeout - -unrestartable-receive-timeout -format-cache-size - -memory-cache-size -http-proxy -ftp-proxy -download-dir - -assume-codepage -anonymous -dump -no-connect -source -version - -help' -- "$cur" ) ) - ;; - *) - if [[ -r ~/.links/links.his ]]; then - COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \ - -- "$cur" ) ) - fi - _filedir '@(htm|html)' + case $prev in + -html-t-text-color|-html-t-link-color) + COMPREPLY=( $(compgen -W '{0..15}' -- "$cur") ) + return + ;; + -http.fake-firefox|-html-[gt]-ignore-document-color) + COMPREPLY=( $(compgen -W '0 1' -- "$cur") ) + return + ;; + --help|-help|-mode|-display|-source|-dump|-width|-max-connections|\ + -max-connections-to-host|-retries|-receive-timeout|\ + -unrestartable-receive-timeout|-*-size|-*-proxy|\ + -append-text-to-dns-lookups|-ssl.client-cert-passwd|-http.fake-*|\ + -http.extra-header|-ftp.anonymous-passwd|-*-color|-*-gamma|\ + -bfu-aspect|-html-image-scale|-html-margin) + return + ;; + -lookup) + _known_hosts_real -- "$cur" + return + ;; + -driver) + local drivers=$("$1" -driver foo 2>&1 | + command sed -ne '$!d' -e '/^[a-z0-9, ]\{1,\}$/s/,/ /gp') + [[ $drivers ]] || drivers='x svgalib fb directfb pmshell atheos' + COMPREPLY=( $(compgen -W "$drivers" -- "$cur") ) + return + ;; + -codepage|-bookmarks-codepage|-http-assume-codepage) + _xfunc iconv _iconv_charsets + return + ;; + -download-dir) + _filedir -d + return + ;; + -bind-address) + _ip_addresses + return + ;; + -bind-address-ipv6) + _ip_addresses -6 + __ltrim_colon_completions "$cur" + return + ;; + -async-dns|-download-utime|-aggressive-cache|-only-proxies|\ + -http-bugs.*|-http.do-not-track|-ftp.use-*|-ftp.fast|-ftp.set-iptos|\ + -smb.allow-hyperlinks-to-smb|-save-url-history|-dither-letters|\ + -dither-images|-overwrite-instead-of-scroll|-html-*) + COMPREPLY=( $(compgen -W '0 1' -- "$cur") ) + return + ;; + -address-preference|-http.referer) + COMPREPLY=( $(compgen -W '{0..4}' -- "$cur") ) + return + ;; + -ssl-certificates|-display-optimize|-gamma-correction) + COMPREPLY=( $(compgen -W '{0..2}' -- "$cur") ) + return + ;; + -ssl.client-cert-key) + _filedir '@(key|pem)' + return + ;; + -ssl.client-cert-crt) + _filedir '@(c?(e)rt|cer|pem|der)' + return + ;; + -bookmarks-file) + _filedir html return ;; esac + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1" | + command grep -vF -- "->")' -- "$cur") ) + return + fi + + local dir + for dir in .links .links2; do + if [[ -r ~/$dir/links.his ]]; then + COMPREPLY+=( $(compgen -W '$(cat ~/$dir/links.his)' -- "$cur") ) + __ltrim_colon_completions "$cur" + fi + done + _filedir '@(htm|html)' + } && -complete -F _links links +complete -F _links links links2 # ex: filetype=sh diff --git a/completions/lintian b/completions/lintian index e62a6265..fbf54f96 100644 --- a/completions/lintian +++ b/completions/lintian @@ -4,13 +4,13 @@ _lintian_tags() { local match search tags - tags=$( awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc ) + tags=$(awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$( command grep -nE "^Tag: $item$" \ - /usr/share/lintian/checks/*.desc | cut -d: -f1 ) - tags=$( command sed -e "s/\<$item\>//g" <<<$tags ) + 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 @@ -24,16 +24,16 @@ _lintian_checks() { local match search todisable checks - checks=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' \ - /usr/share/lintian/checks/*.desc ) + checks=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' \ + /usr/share/lintian/checks/*.desc) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$( command grep -nE "^(Check-Script|Abbrev): $item$" \ - /usr/share/lintian/checks/*.desc | cut -d: -f1 ) - todisable=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' $match ) + match=$(command grep -nE "^(Check-Script|Abbrev): $item$" \ + /usr/share/lintian/checks/*.desc | cut -d: -f1) + todisable=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' $match) for name in $todisable; do - checks=$( command sed -e "s/\<$name\>//g" <<<$checks ) + checks=$(command sed -e "s/\<$name\>//g" <<<$checks) done done COMPREPLY+=( $(compgen -W "$checks") ) @@ -48,14 +48,14 @@ _lintian_infos() { local match search infos - infos=$( awk '/^Collector/ { print $2 }' \ - /usr/share/lintian/collection/*.desc ) + infos=$(awk '/^Collector/ { print $2 }' \ + /usr/share/lintian/collection/*.desc) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$( command grep -nE "^Collector: $item$" \ - /usr/share/lintian/collection/*.desc | cut -d: -f1 ) - infos=$( command sed -e "s/\<$item\>//g" <<<$infos ) + 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 diff --git a/completions/lisp b/completions/lisp index 279ffcdb..f9f68275 100644 --- a/completions/lisp +++ b/completions/lisp @@ -9,9 +9,9 @@ _lisp() # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init + COMPREPLY=( $(compgen -W '-core -lib -batch -quit -edit -eval -init -dynamic-space-size -hinit -noinit -nositeinit -load -slave' \ - -- "$cur" ) ) + -- "$cur") ) else _filedir fi diff --git a/completions/list_admins b/completions/list_admins index 06542f91..11f7414d 100644 --- a/completions/list_admins +++ b/completions/list_admins @@ -6,7 +6,7 @@ _list_admins() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--all-vhost --all --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/list_lists b/completions/list_lists index 629e4c07..c0807178 100644 --- a/completions/list_lists +++ b/completions/list_lists @@ -2,7 +2,7 @@ _mailman_lists() { - COMPREPLY=( $( compgen -W '$( list_lists -b 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(list_lists -b 2>/dev/null)' -- "$cur") ) } _list_lists() @@ -11,8 +11,8 @@ _list_lists() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview --bare - --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--advertised --virtual-host-overview --bare + --help' -- "$cur") ) fi } && diff --git a/completions/list_members b/completions/list_members index e60f61da..90db5cba 100644 --- a/completions/list_members +++ b/completions/list_members @@ -11,12 +11,12 @@ _list_members() return ;; -d|--digest) - COMPREPLY=( $( compgen -W 'mime plain' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'mime plain' -- "$cur") ) return ;; -n|--nomail) - COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'byadmin byuser bybounce unknown' \ + -- "$cur") ) return ;; esac @@ -24,8 +24,8 @@ _list_members() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--output --regular --digest --nomail - --fullnames --preserve --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--output --regular --digest --nomail + --fullnames --preserve --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/list_owners b/completions/list_owners index 88b25bb3..18b52476 100644 --- a/completions/list_owners +++ b/completions/list_owners @@ -6,8 +6,8 @@ _list_owners() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--with-listnames --moderators --help' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--with-listnames --moderators --help' \ + -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/locale-gen b/completions/locale-gen new file mode 100644 index 00000000..3dae76ff --- /dev/null +++ b/completions/locale-gen @@ -0,0 +1,32 @@ +# locale-gen(8) completion -*- shell-script -*- + +_locale_gen() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|-h) + return + ;; + --aliases) + _filedir alias + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=( $(compgen -W \ + '$(awk "{ print \$1 }" /usr/share/i18n/SUPPORTED 2>/dev/null)' \ + -- "$cur") ) +} && +complete -F _locale_gen locale-gen + +# ex: filetype=sh diff --git a/completions/lpq b/completions/lpq index b02705af..a1223268 100644 --- a/completions/lpq +++ b/completions/lpq @@ -7,17 +7,17 @@ _lpq() case $prev in -P) - COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur") ) return ;; -U) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; esac if [[ "$cur" == - ]]; then - COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-E -P -U -a -h -l' -- "$cur") ) return fi diff --git a/completions/lpr b/completions/lpr index b1515bd5..9a9e8639 100644 --- a/completions/lpr +++ b/completions/lpr @@ -7,22 +7,22 @@ _lpr() case $prev in -P) - COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur") ) return ;; -U) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; -o) - COMPREPLY=( $( compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return ;; esac if [[ "$cur" == - ]]; then - COMPREPLY=( $( compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur") ) return fi diff --git a/completions/lrzip b/completions/lrzip index 5338bd87..5eb2445b 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -8,36 +8,36 @@ _lrzip() local xspec="*.lrz" case $prev in - -w|-S|-V|-h|-'?'|-m) + -*@([wSm]|[Vh?]*)) return ;; - -d) + -*d) xspec="!"$xspec ;; - -o) + -*o) _filedir return ;; - -O) + -*O) _filedir -d return ;; - -L) - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + -*L) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) return ;; - -N) - COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) ) + -*N) + COMPREPLY=( $(compgen -W '{-20..19}' -- "$cur") ) return ;; - -p) - COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + -*p) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi @@ -45,8 +45,7 @@ _lrzip() local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _lrzip lrzip diff --git a/completions/lsof b/completions/lsof index 329946d5..e904f406 100644 --- a/completions/lsof +++ b/completions/lsof @@ -18,11 +18,11 @@ _lsof() return ;; -D) - COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '? b i r u' -- "$cur") ) return ;; -f) - COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'c f g G n' -- "$cur") ) return ;; -g) @@ -37,15 +37,15 @@ _lsof() ;; -u) # TODO: handle ^foo exclusions, comma separated lists - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; esac if [[ "$cur" == [-+]* ]]; then - COMPREPLY=( $( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g + 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" ) ) + -u -U -v -V +w -w -x -X -z -Z' -- "$cur") ) return fi diff --git a/completions/lspci b/completions/lspci index 70abc3c4..e31a5b57 100644 --- a/completions/lspci +++ b/completions/lspci @@ -6,34 +6,34 @@ _lspci() _init_completion || return case $prev in - -s|-D|-O) + -*[sDO]) return ;; - -i) + -*i) _filedir ids return ;; - -p) + -*p) _filedir pcimap return ;; - -A) - COMPREPLY+=( $( compgen -W '$( $1 -A help | command grep -vF : )' \ + -*A) + COMPREPLY+=( $(compgen -W '$($1 -A help | command grep -vF :)' \ -- "$cur") ) return ;; - -H) - COMPREPLY+=( $( compgen -W "1 2" -- "$cur" ) ) + -*H) + COMPREPLY+=( $(compgen -W "1 2" -- "$cur") ) return ;; - -F) + -*F) _filedir return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _lspci lspci diff --git a/completions/lsscsi b/completions/lsscsi index b64c5927..b401c8ab 100644 --- a/completions/lsscsi +++ b/completions/lsscsi @@ -6,10 +6,10 @@ _lsscsi() _init_completion -s || return case $prev in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]*) return ;; - -y|--sysfsroot) + --sysfsroot|-!(-*)y) _filedir -d return ;; @@ -18,7 +18,7 @@ _lsscsi() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/lsusb b/completions/lsusb index d6700beb..c315abd1 100644 --- a/completions/lsusb +++ b/completions/lsusb @@ -6,13 +6,13 @@ _lsusb() _init_completion || return case $prev in - -h|--help|-V|--version|-s|-D) + --help|--version|-!(-*)@([sD]|[hV]*)) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _lsusb lsusb diff --git a/completions/lua b/completions/lua index 9413319e..775eae20 100644 --- a/completions/lua +++ b/completions/lua @@ -12,7 +12,7 @@ _lua() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(_parse_help "$1")" -- "$cur") ) return fi diff --git a/completions/luac b/completions/luac index 9c91f25a..15b562ae 100644 --- a/completions/luac +++ b/completions/luac @@ -16,7 +16,7 @@ _luac() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(_parse_help "$1")" -- "$cur") ) return fi diff --git a/completions/luseradd b/completions/luseradd index 41769b00..2fa336db 100644 --- a/completions/luseradd +++ b/completions/luseradd @@ -6,20 +6,20 @@ _luseradd() _init_completion -s || return case $prev in - -\?|--help|--usage|-c|--gecos|-u|--uid|-l|--login|-P|--plainpassword|\ - -p|--password|--commonname|--givenname|--surname|--roomnumber|\ - --telephonenumber|--homephone) + --help|--usage|--gecos|--uid|--login|--plainpassword|--password|\ + --commonname|--givenname|--surname|--roomnumber|--telephonenumber|\ + --homephone|-!(-*)@([culPp]|[?]*)) return ;; - -d|--directory|-k|--skeleton) + --directory|--skeleton|-!(-*)[dk]) _filedir -d return ;; - -s|--shell) + --shell|-!(-*)s) _shells return ;; - -g|--gid) + --gid|-!(-*)g) _gids return ;; @@ -28,12 +28,12 @@ _luseradd() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - [[ ${1##*/} == luseradd ]] || COMPREPLY=( $( compgen -u -- "$cur" ) ) + [[ ${1##*/} == luseradd ]] || COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _luseradd luseradd lusermod diff --git a/completions/luserdel b/completions/luserdel index 83e1818b..ee2b4fdb 100644 --- a/completions/luserdel +++ b/completions/luserdel @@ -6,17 +6,17 @@ _luserdel() _init_completion || return case $prev in - -\?|--help|--usage) + --help|--usage|-!(-*)[?]*) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _luserdel luserdel diff --git a/completions/lvm b/completions/lvm index fb83a3fb..63048aeb 100644 --- a/completions/lvm +++ b/completions/lvm @@ -8,30 +8,30 @@ _lvm_filedir() _lvm_volumegroups() { - COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ - command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(vgscan 2>/dev/null | \ + command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur") ) } _lvm_physicalvolumes_all() { - COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ - command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(pvscan 2>/dev/null | \ + command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur") ) } _lvm_physicalvolumes() { - COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ - command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(pvscan 2>/dev/null | \ + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur") ) } _lvm_logicalvolumes() { - COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ - command sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(lvscan 2>/dev/null | \ + command sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur") ) if [[ $cur == /dev/mapper/* ]]; then _filedir local i - for i in ${!COMPREPLY[@]}; do + for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' done fi @@ -39,12 +39,12 @@ _lvm_logicalvolumes() _lvm_units() { - COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'h s b k m g t H K M G T' -- "$cur") ) } _lvm_sizes() { - COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'k K m M g G t T' -- "$cur") ) } # @param $1 glob matching args known to take an argument @@ -58,7 +58,7 @@ _lvm_count_args() local i prev=${words[$offset-1]} for (( i=$offset; i < cword; i++ )); do if [[ "${words[i]}" != -* && $prev != $1 ]]; then - args=$(($args + 1)) + (( args++ )) fi prev=${words[i]} done @@ -70,7 +70,7 @@ _lvmdiskscan() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) fi } && complete -F _lvmdiskscan lvmdiskscan @@ -81,9 +81,9 @@ _pvscan() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup --help + COMPREPLY=( $(compgen -W '--debug --exported --novolumegroup --help --ignorelockingfailure --partial --short --uuid --verbose - --version' -- "$cur" ) ) + --version' -- "$cur") ) fi } && complete -F _pvscan pvscan @@ -94,9 +94,9 @@ _pvs() _init_completion || return case $prev in - -o|-O|--options|--sort) - COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used - pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur" ) ) + --options|--sort|-!(-*)[oO]) + COMPREPLY=( $(compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used + pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur") ) return ;; --units) @@ -106,7 +106,7 @@ _pvs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_physicalvolumes_all fi @@ -126,7 +126,7 @@ _pvdisplay() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_physicalvolumes_all fi @@ -139,14 +139,14 @@ _pvchange() _init_completion || return case $prev in - -A|-x|--autobackup|--allocatable) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|--allocatable|-!(-*)[Ax]) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_physicalvolumes_all fi @@ -163,12 +163,12 @@ _pvcreate() _filedir return ;; - -M|--metadatatype) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + --metadatatype|-!(-*)M) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; --metadatacopies) - COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 1 2' -- "$cur") ) return ;; --metadatasize|--setphysicalvolumesize) @@ -178,7 +178,7 @@ _pvcreate() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_filedir fi @@ -191,19 +191,19 @@ _pvmove() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -n|--name) + --name|-!(-*)n) _lvm_logicalvolumes return esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--abort --autobackup --background --debug + COMPREPLY=( $(compgen -W '--abort --autobackup --background --debug --force --help --interval --test --verbose --version --name' \ - -- "$cur" ) ) + -- "$cur") ) else _lvm_physicalvolumes fi @@ -216,7 +216,7 @@ _pvremove() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_physicalvolumes_all fi @@ -229,7 +229,7 @@ _vgscan() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) fi } && complete -F _vgscan vgscan @@ -240,11 +240,11 @@ _vgs() _init_completion || return case $prev in - -o|-O|--options|--sort) - COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size + --options|--sort|-!(-*)[oO]) + COMPREPLY=( $(compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size vg_free vg_sysid vg_extent_size vg_extent_count vg_free_count max_lv max_pv pv_count lv_count snap_count vg_seqno' \ - -- "$cur" ) ) + -- "$cur") ) return ;; --units) @@ -254,7 +254,7 @@ _vgs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -274,7 +274,7 @@ _vgdisplay() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -287,17 +287,17 @@ _vgchange() _init_completion || return case $prev in - -a|-A|-x|--available|--autobackup|--resizeable) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --available|--autobackup|--resizeable|-!(-*)[aAx]) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--autobackup --alloc --partial --debug + COMPREPLY=( $(compgen -W '--autobackup --alloc --partial --debug --help --ignorelockingfailure --test --uuid --verbose --version --available --resizeable --logicalvolume --addtag --deltag' \ - -- "$cur" ) ) + -- "$cur") ) else _lvm_volumegroups fi @@ -310,24 +310,24 @@ _vgcreate() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -M|--metadatatype) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + --metadatatype|-!(-*)M) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; - -s|--physicalextentsize) + --physicalextentsize|-!(-*)s) _lvm_sizes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc --debug --help + COMPREPLY=( $(compgen -W '--autobackup --addtag --alloc --debug --help --maxlogicalvolumes --metadatatype --maxphysicalvolumes - --physicalextentsize --test --verbose --version' -- "$cur" ) ) + --physicalextentsize --test --verbose --version' -- "$cur") ) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' @@ -346,7 +346,7 @@ _vgremove() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -359,14 +359,14 @@ _vgrename() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -379,14 +379,14 @@ _vgreduce() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else local args @@ -406,18 +406,18 @@ _vgextend() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -L|--size) + --size|-!(-*)L) _lvm_sizes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' @@ -436,7 +436,7 @@ _vgport() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -449,7 +449,7 @@ _vgck() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -462,12 +462,12 @@ _vgconvert() _init_completion || return case $prev in - -M|--metadatatype) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + --metadatatype|-!(-*)M) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; --metadatacopies) - COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 1 2' -- "$cur") ) return ;; --metadatasize) @@ -477,7 +477,7 @@ _vgconvert() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -490,14 +490,14 @@ _vgcfgbackup() _init_completion || return case $prev in - -f|--file) + --file|-!(-*)f) _filedir return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -510,22 +510,22 @@ _vgcfgrestore() _init_completion || return case $prev in - -f|--file) + --file|-!(-*)f) _filedir return ;; - -M|--metadatatype) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + --metadatatype|-!(-*)M) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; - -n|--name) + --name|-!(-*)n) _lvm_volumegroups return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -538,14 +538,14 @@ _vgmerge() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -558,19 +558,19 @@ _vgsplit() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -M|--metadatatype) - COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) + --metadatatype|-!(-*)M) + COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--autobackup --debug --help --list - --metadatatype --test --verbose --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--autobackup --debug --help --list + --metadatatype --test --verbose --version' -- "$cur") ) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' @@ -589,7 +589,7 @@ _vgmknodes() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_volumegroups fi @@ -602,7 +602,7 @@ _lvscan() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) fi } && complete -F _lvscan lvscan @@ -613,10 +613,10 @@ _lvs() _init_completion || return case $prev in - -o|-O|--options|--sort) - COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size + --options|--sort|-!(-*)[oO]) + 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" ) ) + chunksize seg_start seg_size' -- "$cur") ) return ;; --units) @@ -626,7 +626,7 @@ _lvs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -646,7 +646,7 @@ _lvdisplay() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -659,18 +659,18 @@ _lvchange() _init_completion || return case $prev in - -a|-A|-C|-M|--available|--autobackup|--contiguous|--persistent) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --available|--autobackup|--contiguous|--persistent|-!(-*)[aACM]) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -p|--permission) - COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) + --permission|-!(-*)p) + COMPREPLY=( $(compgen -W 'r rw' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -683,26 +683,26 @@ _lvcreate() _init_completion || return case $prev in - -A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|--contiguous|--persistent|--zero|-!(-*)[ACMZ]) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -L|--size) + --size|-!(-*)L) _lvm_sizes return ;; - -p|--permission) - COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) + --permission|-!(-*)p) + COMPREPLY=( $(compgen -W 'r rw' -- "$cur") ) return ;; - -n|--name) + --name|-!(-*)n) _lvm_logicalvolumes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + 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)' @@ -721,14 +721,14 @@ _lvremove() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -741,14 +741,14 @@ _lvrename() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -761,18 +761,18 @@ _lvreduce() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -L|--size) + --size|-!(-*)L) _lvm_sizes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _lvm_logicalvolumes fi @@ -785,18 +785,18 @@ _lvresize() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -L|--size) + --size|-!(-*)L) _lvm_sizes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' @@ -815,18 +815,18 @@ _lvextend() _init_completion || return case $prev in - -A|--autobackup) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + --autobackup|-!(-*)A) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; - -L|--size) + --size|-!(-*)L) _lvm_sizes return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' @@ -845,13 +845,13 @@ _lvm() _init_completion || return if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'dumpconfig help lvchange lvcreate lvdisplay + COMPREPLY=( $(compgen -W 'dumpconfig help lvchange lvcreate lvdisplay lvextend lvmchange lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvresize lvs lvscan pvchange pvcreate pvdata pvdisplay pvmove pvremove pvresize pvs pvscan vgcfgbackup vgcfgrestore vgchange vgck vgconvert vgcreate vgdisplay vgexport vgextend vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan - vgsplit version' -- "$cur" ) ) + vgsplit version' -- "$cur") ) else case "${words[1]}" in pvchange|pvcreate|pvdisplay|pvmove|pvremove|pvresize|pvs|pvscan|\ diff --git a/completions/lz4 b/completions/lz4 index 365fef9d..db8198f8 100644 --- a/completions/lz4 +++ b/completions/lz4 @@ -13,9 +13,9 @@ _lz4() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( _parse_help "$1" -h | command sed -e "/#/d" ) -B{4..7} -i{1..9}' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(_parse_help "$1" -h | command sed -e "/#/d") -B{4..7} -i{1..9}' \ + -- "$cur") ) return fi @@ -23,7 +23,7 @@ _lz4() _count_args [[ $args -gt 2 ]] && return - for word in ${words[@]}; do + for word in "${words[@]}"; do case $word in -*[dt]*) case $args in @@ -46,8 +46,7 @@ _lz4() local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _lz4 lz4 lz4c diff --git a/completions/lzip b/completions/lzip index c1aab4a8..0f95722c 100644 --- a/completions/lzip +++ b/completions/lzip @@ -8,18 +8,18 @@ _lzip() local decompress=false case $prev in - -h|--help|-V|--version|-b|--member-size|-m|--match-length|\ - -s|--dictionary-size|-S|--volume-size|-B|--data-size) + --help|--version|--member-size|--match-length|--dictionary-size|\ + --volume-size|--data-size|-!(-*)@([bmsSB]|[hV]*)) return ;; - -d|--decompress) + --decompress-!(-*)d) decompress=true ;; - -n|--threads) - COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + --threads-!(-*)n) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) return ;; - -o|--output) + --output-!(-*)o) _filedir return ;; @@ -28,8 +28,7 @@ _lzip() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -41,8 +40,7 @@ _lzip() local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -f -X "*.lz" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "*.lz" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _lzip clzip lzip pdlzip plzip diff --git a/completions/lzma b/completions/lzma index 0a5ab355..81a626f5 100644 --- a/completions/lzma +++ b/completions/lzma @@ -3,14 +3,14 @@ _lzma() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return + + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 - --help --decompress --compress --keep --force --suffix --test - --stdout --quiet --verbose --license --list --version --small - --fast --best --text' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") -{1..9}' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -27,8 +27,7 @@ _lzma() _tilde "$cur" || return compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _lzma lzma diff --git a/completions/lzop b/completions/lzop index 900a36ad..bedc122e 100644 --- a/completions/lzop +++ b/completions/lzop @@ -6,7 +6,7 @@ _lzop() _init_completion || return case $prev in - -o|--output) + --output|-!(-*)o) _filedir return ;; @@ -14,19 +14,19 @@ _lzop() _filedir -d return ;; - -S|--suffix) + --suffix|-!(-*)S) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P + COMPREPLY=( $(compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P --fast --best --decompress --extract --test --list --ls --info --sysinfo --license --help --version --stdout --output --path --force --no-checksum --no-name --name --no-mode --no-time --suffix --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose --no-stdin --filter --checksum --no-color --mono --color' \ - -- "$cur" ) ) + -- "$cur") ) return fi @@ -52,8 +52,7 @@ _lzop() local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _lzop lzop diff --git a/completions/macof b/completions/macof index dacae2fd..c92a3864 100644 --- a/completions/macof +++ b/completions/macof @@ -14,7 +14,7 @@ _macof() if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/mailmanctl b/completions/mailmanctl index 717df7b9..dac1c5bf 100644 --- a/completions/mailmanctl +++ b/completions/mailmanctl @@ -6,10 +6,10 @@ _mailmanctl() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--no-restart --run-as-user - --stale-lock-cleanup --quiet --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--no-restart --run-as-user + --stale-lock-cleanup --quiet --help' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'start stop restart reopen' -- "$cur") ) fi } && diff --git a/completions/make b/completions/make index 45d51168..f119dcc3 100644 --- a/completions/make +++ b/completions/make @@ -6,7 +6,7 @@ _make_target_extract_script() shift local prefix="$1" - local prefix_pat=$( command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix" ) + local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") local basename=${prefix##*/} local dirname_len=$(( ${#prefix} - ${#basename} )) @@ -89,24 +89,24 @@ _make() local file makef makef_dir=( "-C" "." ) makef_inc i case $prev in - -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\ - --new-file|--assume-new) + --file|--makefile|--old-file|--assume-old|--what-if| --new-file|\ + --assume-new|-!(-*)[foW]) _filedir return ;; - -I|--include-dir|-C|--directory|-m) + --include-dir|--directory|-!(-*)[ICm]) _filedir -d return ;; - -E) - COMPREPLY=( $( compgen -v -- "$cur" ) ) + -!(-*)E) + COMPREPLY=( $(compgen -v -- "$cur") ) return ;; - --eval|-D|-V|-x) + --eval|-!(-*)[DVx]) return ;; - --jobs|-j) - COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) ) + --jobs|-!(-*)j) + COMPREPLY=( $(compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur") ) return ;; esac @@ -114,9 +114,8 @@ _make() $split && return if [[ "$cur" == -* ]]; then - local opts="$( _parse_help "$1" )" - [[ $opts ]] || opts="$( _parse_usage "$1" )" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts="$(_parse_help "$1")" + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ $cur == *=* ]]; then prev=${cur%%=*} @@ -130,7 +129,7 @@ _make() for (( i=0; i < ${#words[@]}; i++ )); do if [[ ${words[i]} == -@(C|-directory) ]]; then # eval for tilde expansion - eval makef_dir=( -C "${words[i+1]}" ) + eval "makef_dir=( -C \"${words[i+1]}\" )" break fi done @@ -140,7 +139,7 @@ _make() for (( i=0; i < ${#words[@]}; i++ )); do if [[ ${words[i]} == -@(f|-?(make)file) ]]; then # eval for tilde expansion - eval makef=( -f "${words[i+1]}" ) + eval "makef=( -f \"${words[i+1]}\" )" break fi done @@ -152,11 +151,11 @@ _make() mode=-d # display-only mode fi - local IFS=$' \t\n' script=$( _make_target_extract_script $mode "$cur" ) - COMPREPLY=( $( LC_ALL=C \ + local IFS=$' \t\n' script=$(_make_target_extract_script $mode "$cur") + COMPREPLY=( $(LC_ALL=C \ $1 -npq __BASH_MAKE_COMPLETION__=1 \ "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \ - command sed -ne "$script" ) ) + command sed -ne "$script") ) if [[ $mode != -d ]]; then # Completion will occur if there is only one suggestion diff --git a/completions/makepkg b/completions/makepkg index 84b4af79..98edda8f 100644 --- a/completions/makepkg +++ b/completions/makepkg @@ -1,25 +1,47 @@ -# Slackware Linux makepkg completion -*- shell-script -*- +# makepkg completion -*- shell-script -*- -_makepkg() +# Slackware Linux variant +_makepkg_slackware() { local cur prev words cword _init_completion || return case "$prev" in -l|--linkadd|-c|--chown) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend -c --chown' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$1 | command sed -e "s/^options://" | _parse_help -' -- "$cur") ) return fi _filedir +} + +_makepkg_bootstrap() +{ + local fname help + + # Use --help to detect variant; the Slackware one starts making + # a package for unknown args, including --version :P + help=$("$1" --help 2>&1) + case ${help,,} in + *slackware*) + fname=_makepkg_slackware + ;; + *) + fname=_minimal + ;; + esac + + unset -f _makepkg_bootstrap + complete -F $fname makepkg + $fname } && -complete -F _makepkg makepkg +complete -F _makepkg_bootstrap makepkg # ex: filetype=sh diff --git a/completions/man b/completions/man index 0668b8ee..02bd4f70 100644 --- a/completions/man +++ b/completions/man @@ -10,29 +10,29 @@ _man() local mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))" case $prev in - -C|--config-file) + --config-file|-!(-*)C) _filedir conf return ;; - -l|--local-file) + --local-file|-!(-*)l) _filedir "$manext" return ;; - -M|--manpath) + --manpath|-!(-*)M) _filedir -d return ;; - -P|--pager) + --pager|-!(-*)P) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; - -p|--preprocessor) - COMPREPLY=( $( compgen -W 'e p t g r v' -- "$cur" ) ) + --preprocessor|-!(-*)p) + COMPREPLY=( $(compgen -W 'e p t g r v' -- "$cur") ) return ;; - -L|--locale|-m|--systems|-e|--extension|-r|--prompt|-R|--recode|\ - -E|--encoding) + --locale|--systems|--extension|--prompt|--recode|--encoding|\ + -!(-*)[LmerRE]) return ;; esac @@ -40,7 +40,7 @@ _man() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -51,7 +51,7 @@ _man() return fi - local manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) + local 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 @@ -67,13 +67,16 @@ _man() manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }" fi + local IFS=$' \t\n' reset=$(shopt -p failglob); shopt -u failglob # redirect stderr for when path doesn't exist - COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) ) + COMPREPLY=( $(eval command ls "$manpath" 2>/dev/null) ) + $reset + # weed out directory path names and paths to man pages COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) # strip suffix from man pages COMPREPLY=( ${COMPREPLY[@]%$comprsuffix} ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}") ) if [[ "$prev" != $mansect ]]; then # File based completion for the rest, prepending ./ if needed diff --git a/completions/mc b/completions/mc index dc322a15..8e96dd97 100644 --- a/completions/mc +++ b/completions/mc @@ -6,16 +6,11 @@ _mc() _init_completion -s || return case $prev in - -e|--edit|-v|--view|-l|--ftplog|-P|--printwd) + --edit|--view|--ftplog|--printwd|-!(-*)[evlP]) _filedir return ;; - -C|--colors|-D|--debuglevel) - # argument required but no completions available - return - ;; - -h|--help|--help-*|-V|--version) - # all other arguments are noop with these + --help|--help-*|--version|--colors|--debuglevel|-!(-*)[hVCD]) return ;; esac @@ -23,8 +18,7 @@ _mc() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir -d diff --git a/completions/mcrypt b/completions/mcrypt index 6d6a898f..f6094a22 100644 --- a/completions/mcrypt +++ b/completions/mcrypt @@ -8,27 +8,27 @@ _mcrypt() case $prev in -g|--openpgp-z) - COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..9}' -- "$cur") ) return ;; -o|--keymode) - COMPREPLY=( $( compgen -W '$( $1 --list-keymodes \ - 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --list-keymodes 2>/dev/null )' \ + -- "$cur") ) return ;; -m|--mode) - COMPREPLY=( $( compgen -W "$( $1 --list 2>/dev/null | \ - cut -d: -f2- )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 --list 2>/dev/null | cut -d: -f2-)" \ + -- "$cur") ) return ;; -a|--algorithm) - COMPREPLY=( $( compgen -W "$( $1 --list 2>/dev/null | \ - awk '{print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 --list 2>/dev/null | \ + awk '{print $1}')" -- "$cur") ) return ;; -h|--hash) - COMPREPLY=( $( compgen -W '$( $1 --list-hash 2>/dev/null | \ - command sed -e 1d )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --list-hash 2>/dev/null | \ + command sed -e 1d)' -- "$cur") ) return ;; -k|-s|--key|--keysize) @@ -45,7 +45,7 @@ _mcrypt() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) elif [[ ${words[0]} == mdecrypt ]]; then _filedir nc else diff --git a/completions/mdadm b/completions/mdadm index d19e89d2..5fbd9bf3 100644 --- a/completions/mdadm +++ b/completions/mdadm @@ -6,11 +6,11 @@ _mdadm_raid_level() for (( i=1; i < cword; i++ )); do case ${words[i]} in - -C|--create) + -!(-*)C*|--create) mode=create break ;; - -B|--build) + -!(-*)B*|--build) mode=build break ;; @@ -19,13 +19,13 @@ _mdadm_raid_level() case $mode in create) - COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror + COMPREPLY=( $(compgen -W 'linear raid0 0 stripe raid1 1 mirror raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' \ - -- "$cur" ) ) + -- "$cur") ) ;; build) - COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath mp - faulty' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'linear stripe raid0 0 raid1 multipath mp + faulty' -- "$cur") ) ;; esac } @@ -42,29 +42,29 @@ _mdadm_raid_layout() case $level in raid5) - COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric - right-asymmetric right-symmetric la ra ls rs' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'left-asymmetric left-symmetric + right-asymmetric right-symmetric la ra ls rs' -- "$cur") ) ;; raid10) - COMPREPLY=( $( compgen -W 'n o p' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'n o p' -- "$cur") ) ;; faulty) - COMPREPLY=( $( compgen -W 'write-transient wt read-transient rt + COMPREPLY=( $(compgen -W 'write-transient wt read-transient rt write-persistent wp read-persistent rp write-all read-fixable - rf clear flush none' -- "$cur" ) ) + rf clear flush none' -- "$cur") ) ;; esac } _mdadm_auto_flag() { - COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'no yes md mdp part p' -- "$cur") ) } _mdadm_update_flag() { - COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync - byteorder super-minor' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'sparc2.2 summaries uuid name homehost resync + byteorder super-minor' -- "$cur") ) } @@ -74,23 +74,23 @@ _mdadm() _init_completion -s || return case $prev in - -c|--config|-b|--bitmap|--backup-file) + --config|--bitmap|--backup-file|-!(-*)[cb]) _filedir return ;; - -l|--level) + --level|-!(-*)l) _mdadm_raid_level return ;; - -p|--layout|--parity) + --layout|--parity|-!(-*)p) _mdadm_raid_layout return ;; - -a|--auto) + --auto|-!(-*)a) _mdadm_auto_flag return ;; - -U|--update) + --update|-!(-*)U) _mdadm_update_flag return ;; @@ -102,40 +102,40 @@ _mdadm() --force --config= --scan --metadata= --homehost=' if [[ "$cur" == -* ]]; then - if [[ $cword -eq 1 ]] ; then - COMPREPLY=( $( compgen -W "$options --assemble --build --create - --monitor --grow" -- "$cur" ) ) + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $(compgen -W "$options --assemble --build --create + --monitor --grow" -- "$cur") ) else case ${words[cword-1]} in - -A|--assemble) - COMPREPLY=( $( compgen -W "$options --uuid= --super-minor= + --assemble|-!(-*)A*) + COMPREPLY=( $(compgen -W "$options --uuid= --super-minor= --name= --force --run --no-degraded --auto= --bitmap= --backup-file= --update= --auto-update-homehost" \ - -- "$cur" ) ) + -- "$cur") ) ;; - -B|-C|-G|--build|--create|--grow) - COMPREPLY=( $( compgen -W "$options --raid-devices= + --build|--create|--grow|-!(-*)[BCG]*) + COMPREPLY=( $(compgen -W "$options --raid-devices= --spare-devices= --size= --chunk= --rounding= --level= --layout= --parity= --bitmap= --bitmap-chunk= --write-mostly --write-behind= --assume-clean --backup-file= --name= --run --force --auto=" \ - -- "$cur" ) ) + -- "$cur") ) ;; - -F|--follow|--monitor) - COMPREPLY=( $( compgen -W "$options --mail --program + --follow|--monitor|-!(-*)F) + COMPREPLY=( $(compgen -W "$options --mail --program --alert --syslog --delay --daemonise --pid-file - --oneshot --test" -- "$cur" ) ) + --oneshot --test" -- "$cur") ) ;; /dev/*|--add|--fail|--remove) - COMPREPLY=( $( compgen -W "$options --add --re-add - --remove --fail --set-faulty" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options --add --re-add + --remove --fail --set-faulty" -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W "$options --query --detail + COMPREPLY=( $(compgen -W "$options --query --detail --examine --sparc2.2 --examine-bitmap --run --stop --readonly --readwrite --zero-superblock --test" \ - -- "$cur" ) ) + -- "$cur") ) ;; esac fi diff --git a/completions/mdtool b/completions/mdtool index b4f36e56..67a3c7c3 100644 --- a/completions/mdtool +++ b/completions/mdtool @@ -16,16 +16,16 @@ _mdtool() if [[ -n "$command" ]]; then case $command in "build") - COMPREPLY=( $( compgen -W '--f --buildfile --p --project' \ - -S":" -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--f --buildfile --p --project' \ + -S":" -- "$cur") ) # TODO: This does not work :( #if [[ "$prev" == *: ]]; then # case $prev in # @(--p:|--project:)) - # COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) ) + # COMPREPLY=( $(compgen -f -G "*.mdp" -- "$cur") ) # ;; # @(--f:|--buildfile:)) - # COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) ) + # COMPREPLY=( $(compgen -f -G "*.mdp" -G "*.mds" -- "$cur") ) # ;; # esac #fi @@ -33,27 +33,27 @@ _mdtool() ;; "generate-makefiles") compopt -o filenames - COMPREPLY=( $( compgen -o filenames -G"*.mds" -- "$cur" ) ) + COMPREPLY=( $(compgen -o filenames -G"*.mds" -- "$cur") ) if [[ "$prev" == *mds ]]; then - COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--simple-makefiles --s --d:' \ + -- "$cur") ) fi return ;; "setup") # TODO: at least return filenames after these options. - COMPREPLY=( $( compgen -W 'install i uninstall u check-install + COMPREPLY=( $(compgen -W 'install i uninstall u check-install ci update up list l list-av la list-update lu rep-add ra 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" ) ) + -- "$cur") ) return ;; esac fi - COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export - generate-makefiles gettext-update setup -q' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'gsetup build dbgen project-export + generate-makefiles gettext-update setup -q' -- "$cur") ) } && complete -F _mdtool mdtool diff --git a/completions/medusa b/completions/medusa index 017d163d..f0ca7022 100644 --- a/completions/medusa +++ b/completions/medusa @@ -6,23 +6,23 @@ _medusa() _init_completion || return case $prev in - -h) + -*h) _known_hosts_real -- "$cur" return ;; - -H|-U|-P|-C|-O) + -*[HUPCO]) _filedir return ;; - -M) - COMPREPLY=( $( compgen -W "$($1 -d | awk '/^ +\+/ {print $2}' \ - | command sed -e 's/\.mod$//')" ) ) + -*M) + COMPREPLY=( $(compgen -W "$($1 -d | awk '/^ +\+/ {print $2}' \ + | command sed -e 's/\.mod$//')") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _medusa medusa diff --git a/completions/mii-diag b/completions/mii-diag index 87f5d8d5..b62174e7 100644 --- a/completions/mii-diag +++ b/completions/mii-diag @@ -7,8 +7,8 @@ _mii_diag() case $prev in -F|-A|--advertise|--fixed-speed) - COMPREPLY=( $( compgen -W '100baseT4 100baseTx 100baseTx-FD - 100baseTx-HD 10baseT 10baseT-FD 10baseT-HD' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '100baseT4 100baseTx 100baseTx-FD + 100baseTx-HD 10baseT 10baseT-FD 10baseT-HD' -- "$cur") ) return ;; esac @@ -16,7 +16,7 @@ _mii_diag() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else _available_interfaces -a fi diff --git a/completions/mii-tool b/completions/mii-tool index 3c5f9b45..9c88ba14 100644 --- a/completions/mii-tool +++ b/completions/mii-tool @@ -6,14 +6,14 @@ _mii_tool() _init_completion -s || return case $prev in - -F|--force) - COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD 10baseT-FD - 10baseT-HD' -- "$cur" ) ) + --force|-!(-*)F) + COMPREPLY=( $(compgen -W '100baseTx-FD 100baseTx-HD 10baseT-FD + 10baseT-HD' -- "$cur") ) return ;; - -A|--advertise) - COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD - 10baseT-FD 10baseT-HD' -- "$cur" ) ) + --advertise|-!(-*)A) + COMPREPLY=( $(compgen -W '100baseT4 100baseTx-FD 100baseTx-HD + 10baseT-FD 10baseT-HD' -- "$cur") ) return ;; esac @@ -21,7 +21,7 @@ _mii_tool() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _available_interfaces -a diff --git a/completions/minicom b/completions/minicom index 897475ed..2e98229a 100644 --- a/completions/minicom +++ b/completions/minicom @@ -2,37 +2,38 @@ _minicom() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return case $prev in - -a|-c) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + --attrib|--color|-!(-*)[ac]) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; - -S|-C) + --script|--capturefile|-!(-*)[SC]) _filedir return ;; - -P) - COMPREPLY=( $( printf '%s\n' /dev/tty* ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \ - -- "$cur" ) ) + --ptty|-!(-*)p) + COMPREPLY=( $(printf '%s\n' /dev/tty*) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \ + -- "$cur") ) return ;; esac + $split && return 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" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi COMPREPLY=( - $( printf '%s\n' /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* \ + $(printf '%s\n' /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* \ | command sed -e '/\*$/d' -e 's/^.*minirc\.//' \ - | command grep "^${cur}" ) ) + | command grep "^${cur}") ) } && complete -F _minicom -o default minicom diff --git a/completions/mkinitrd b/completions/mkinitrd index f0efb294..2e131227 100644 --- a/completions/mkinitrd +++ b/completions/mkinitrd @@ -23,12 +23,12 @@ _mkinitrd() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version --help -v -f --preload \ + COMPREPLY=( $(compgen -W '--version --help -v -f --preload \ --force-scsi-probe --omit-scsi-modules \ --omit-ide-modules --image-version --force-raid-probe \ --omit-raid-modules --with= --force-lvm-probe \ --omit-lvm-modules --builtin --omit-dmraid --net-dev \ - --fstab --nocompress --dsdt --bootchart' -- "$cur" ) ) + --fstab --nocompress --dsdt --bootchart' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else local args diff --git a/completions/mktemp b/completions/mktemp index a8903c16..96c7a118 100644 --- a/completions/mktemp +++ b/completions/mktemp @@ -9,7 +9,7 @@ _mktemp() --help|--version|--suffix) return ;; - --tmpdir|-p) + --tmpdir|-!(-*)p) _filedir -d return ;; @@ -18,9 +18,9 @@ _mktemp() $split && return if [[ "$cur" == -* ]]; then - local opts=$( _parse_help "$1" ) + local opts=$(_parse_help "$1") [[ $opts ]] || opts="-d -u -q -p -t" # non-GNU fallback - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/mmsitepass b/completions/mmsitepass index db1cbf74..fc938d82 100644 --- a/completions/mmsitepass +++ b/completions/mmsitepass @@ -6,7 +6,7 @@ _mmsitepass() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--listcreator --help' -- "$cur") ) fi } && diff --git a/completions/modinfo b/completions/modinfo index 28f19308..c151fad4 100644 --- a/completions/modinfo +++ b/completions/modinfo @@ -2,31 +2,34 @@ _modinfo() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return case "$prev" in - -F|--field) - COMPREPLY=( $( compgen -W 'alias author depends description + --field|-!(-*)F) + COMPREPLY=( $(compgen -W 'alias author depends description filename firmware license parm srcversion staging vermagic - version' -- "${cur,,}" ) ) + version' -- "${cur,,}") ) return ;; - -k) + --set-version|-!(-*)k) _kernel_versions return ;; esac + $split && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-V --version -F --field -k -0 --null -a -d - -l -p -n' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi local i version=$(uname -r) for (( i=${#words[@]}-1; i>0; i-- )); do - if [[ ${words[i]} == -k ]]; then + if [[ ${words[i]} == -@(!(-*)k*|-set-version) ]]; then version=${words[i+1]} break fi diff --git a/completions/modprobe b/completions/modprobe index 43a2b01b..16c8453a 100644 --- a/completions/modprobe +++ b/completions/modprobe @@ -6,18 +6,18 @@ _modprobe() _init_completion -s || return case "$prev" in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]) return ;; - -C|--config) + --config|-!(-*)C) _filedir return ;; - -d|--dirname|-t|--type) + --dirname|--type|-!(-*)[dt]) _filedir -d return ;; - -S|--set-version) + --set-version|-!(-*)S) _kernel_versions return ;; @@ -26,36 +26,36 @@ _modprobe() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) if [[ ! $COMPREPLY ]]; then - COMPREPLY=( $( compgen -W '-a --all -b --use-blacklist -C --config + 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" ) ) + --verbose' -- "$cur") ) fi [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - local i mode=insert module= version=$(uname -r) + local i mode=insert module="" version=$(uname -r) for (( i=1; i < $cword; i++ )); do case "${words[i]}" in - -r|--remove) + --remove|-!(-*)r*) mode=remove ;; - -l|--list) + --list|-!(-*)l*) mode=list ;; --dump-modversions) mode=file ;; - -S|--set-version) + --set-version|-!(-*)S) version=${words[i+1]} # -S is not $prev and not $cur ;; - -C|--config|-d|--dirname|-t|--type) + --config|--dirname|--type|-!(-*)[Cdt]) ((i++)) # skip option and its argument ;; -*) @@ -83,17 +83,29 @@ _modprobe() _filedir '@(?(k)o?(.gz))' elif [[ -n "$module" ]]; then # do module parameter completion - COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ - -p "$module" 2>/dev/null | \ - awk -F: '!/^[ \t]/ { print $1 }' )" -- "$cur" ) ) + if [[ $cur == *=* ]]; then + prev=${cur%%=*} + cur=${cur#*=} + if PATH="$PATH:/sbin" modinfo -p "$module" 2>/dev/null \ + | command grep -q "^$prev:.*(bool)"; then + local choices="on off" + [[ $cur ]] && choices="1 0 y Y n N on off" + COMPREPLY=( $(compgen -W "$choices" -- "$cur") ) + fi + else + COMPREPLY=( $(compgen -S = -W "$(PATH="$PATH:/sbin" \ + modinfo -p "$module" 2>/dev/null | \ + awk -F: '!/^[ \t]/ { print $1 }')" -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi else _modules $version if [[ $COMPREPLY ]]; then # filter out already installed modules local -a mods=( "${COMPREPLY[@]}" ) _installed_modules "$cur" - for i in ${!mods[@]}; do - for module in ${COMPREPLY[@]}; do + for i in "${!mods[@]}"; do + for module in "${COMPREPLY[@]}"; do if [[ ${mods[i]} == $module ]]; then unset 'mods[i]' break diff --git a/completions/monodevelop b/completions/monodevelop index 13685dfb..4aa213b7 100644 --- a/completions/monodevelop +++ b/completions/monodevelop @@ -8,7 +8,7 @@ _monodevelop() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir diff --git a/completions/mount b/completions/mount deleted file mode 100644 index a8748d1b..00000000 --- a/completions/mount +++ /dev/null @@ -1,62 +0,0 @@ -# mount(8) completion -*- shell-script -*- - -if [[ $OSTYPE == *linux* ]]; then - . "$BASH_SOURCE.linux" - return -fi - -# This will pull a list of possible mounts out of -# /etc/{,v}fstab, unless the word being completed contains a ':', which -# would indicate the specification of an NFS server. In that case, we -# query the server for a list of all available exports and complete on -# that instead. -# -_mount() -{ - local cur prev words cword - _init_completion -n : || return - - local sm host - - case $prev in - -t|--types) - _fstypes - return - ;; - esac - - [[ "$cur" == \\ ]] && cur="/" - - if [[ "$cur" == *:* ]]; then - for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do - [[ -x $sm ]] || continue - COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \ - awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) - return - done - fi - - if [[ "$cur" == //* ]]; then - host=${cur#//} - host=${host%%/*} - if [[ -n $host ]]; then - COMPREPLY=( $( compgen -P "//$host" -W \ - "$( smbclient -d 0 -NL $host 2>/dev/null | - 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 - # Solaris - COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) ) - elif [[ ! -e /etc/fstab ]]; then - # probably Cygwin - 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" ) ) - fi -} && -complete -F _mount -o default -o dirnames mount - -# ex: filetype=sh diff --git a/completions/mount.linux b/completions/mount.linux deleted file mode 100644 index ed198ad8..00000000 --- a/completions/mount.linux +++ /dev/null @@ -1,245 +0,0 @@ -# mount(8) completion -*- shell-script -*- - -_mount() -{ - local cur prev words cword - _init_completion -n =: || return - - local split=false - case "$prev" in - -t|--types) - # find /lib/modules/$(uname -r)/ -type f -path '*/fs/*.ko' -printf '%f\n' | cut -d. -f1 - # FIXME: no<fstype> - if [[ "$cur" == ?*,* ]]; then - prev="${cur%,*}" - cur="${cur##*,}" - split=true - fi - COMPREPLY=( $( compgen -W 'auto adfs affs autofs btrfs cifs coda - cramfs davfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus - hpfs iso9660 jffs2 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g - proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs - udf ufs umsdos usbfs vfat xfs' -- "$cur" ) ) - _fstypes - $split && COMPREPLY=( ${COMPREPLY[@]/#/$prev,} ) - return - ;; - --bind|-B|--rbind|-R) - _filedir -d - return - ;; - -p|--pass-fd) - COMPREPLY=( $(compgen -W '{0..9}') ) - compopt -o nospace - return - ;; - -L) - COMPREPLY=( $( cd "/dev/disk/by-label/" 2>/dev/null || return; \ - compgen -f -- "$cur" ) ) - return - ;; - -U) - COMPREPLY=( $( cd "/dev/disk/by-uuid/" 2>/dev/null || return; \ - compgen -f -- "$cur" ) ) - return - ;; - -O|--test-opts) - # argument required but no completions available - return - ;; - -o|--options) - local fstype=auto # default fstype - for (( i=${#words[@]}-1; i>0; i-- )); do - if [[ "${words[i]}" == -@(t|-types)* ]]; then - if [[ "${words[i]}" == *=* ]]; then - [[ "${words[i]}" == ?*,* ]] && break - fstype="${words[i]#-*=}" - else - [[ "${words[i+1]}" == ?*,* ]] && break - fstype="${words[i+1]}" - fi - break - fi - done - # no<fstype> is not a real fstype, reset to "auto" - [[ "$fstype" == no?* ]] && fstype=auto - # split options list - if [[ "$cur" == ?*,* ]]; then - prev="${cur%,*}" - cur="${cur##*,}" - split=true - fi - # no completion if $cur is opt=smth - [[ "$cur" == *=* ]] && return - # mount options - COMPREPLY=( $(compgen -W 'loop {,a}sync {,no}atime {,no}auto - {,fs,def,root}context= defaults {,no}dev {,no}diratime dirsync - {,no}exec group {,no}iversion {,no}mand _netdev nofail - {,no}relatime {,no}strictatime {,no}suid owner remount ro rw - {,no}user users' -- "$cur") ) - case "$fstype" in - adfs|auto) - COMPREPLY+=( $(compgen -W '{u,g}id= {own,oth}mask=' -- "$cur") ) - ;;& - affs|auto) - COMPREPLY+=( $(compgen -W '{u,g}id= set{u,g}id= mode= protect - usemp verbose prefix= volume= reserved= root= bs= - {,no,usr,grp}quota' -- "$cur") ) - ;;& - btrfs|auto) - COMPREPLY+=( $(compgen -W 'degraded subvol= subvolid= device= - nodatasum nodatacow nobarrier max_inline= alloc_start= - thread_pool= compress= compress-force= ssd noacl notreelog - flushoncommit metadata_ratio= {,no}space_cache clear_cache - user_subvol_rm_allowed autodefrag inode_cache' -- "$cur") ) - ;;& - cifs|auto) - COMPREPLY+=( $(compgen -W 'user= password= credentials= {u,g}id= - force{u,g}id port= servern= netbiosname= {file,dir}_mode= - ip= domain= guest iocharset {,no}setuids {,no,dyn}perm - directio {,no}mapchars {,no}intr hard soft noacl nocase sec= - nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size= - rwpidforward backup{u,g}id cache=' -- "$cur") ) - ;;& - davfs|auto) - COMPREPLY+=( $(compgen -W 'conf= {file,dir}_mode= {u,g}id= - username=' -- "$cur") ) - ;;& - ext[2-4]|auto) - COMPREPLY+=( $(compgen -W '{,no}acl bsddf minixdf check= debug - errors= {,no}grpid {bsd,sysv}groups {,no,usr,grp}quota - nobh nouid32 oldalloc orlov res{u,g}id= sb= - {,no}user_xattr' -- "$cur") ) - ;;& - ext[34]|auto) - COMPREPLY+=( $(compgen -W 'journal= journal_dev= norecovery - noload data= barrier= commit=' -- "$cur") ) - ;;& - ext4|auto) - COMPREPLY+=( $(compgen -W 'journal_checksum journal_async_commit - nobarrier inode_readahead= stripe= {,no}delalloc abort - {max,min}_batch_time= journal_ioprio= {,no}auto_da_alloc - {,no}discard nouid32 resize {,no}block_validity - dioread_{,no}lock max_dir_size_kb= i_version' -- "$cur") ) - ;;& - msdos|umsdos|vfat|auto) - COMPREPLY+=( $(compgen -W 'blocksize= {u,g}id= {u,d,f}mask= - allow_utime= check= codepage= conv= cvf_format= cvf_option= - debug fat= iocharset= tz= quiet showexec sys_immutable flush - usefree {,no}dots dotsOK=' -- "$cur") ) - ;;& - vfat|auto) - COMPREPLY+=( $(compgen -W 'uni_xlate posix nonumtail utf8 - shortname=' -- "$cur") ) - ;;& - iso9660|auto) - COMPREPLY+=( $(compgen -W 'norock nojoliet check= {u,g}id= map= - mode= unhide block= conv= cruft session= sbsector= - iocharset= utf8' -- "$cur") ) - ;;& - jffs2|auto) - COMPREPLY+=( $(compgen -W 'compr= rp_size=' -- "$cur") ) - ;;& - jfs|auto) - COMPREPLY+=( $(compgen -W 'iocharset= resize= {,no}integrity - errors= {,no,usr,grp}quota' -- "$cur") ) - ;;& - nfs|nfs4|auto) - COMPREPLY+=( $(compgen -W 'soft hard timeo= retrans= {r,w}size= - {,no}ac acreg{min,max}= acdir{min,max}= actimeo= bg fg - retry= sec= {,no}sharecache {,no}resvport lookupcache= - proto= port= {,no}intr {,no}cto {,nfs}vers= ' -- "$cur") ) - ;;& - nfs|auto) - COMPREPLY+=( $(compgen -W 'udp tcp rdma mount{port,proto,host}= - mountvers= namlen={,no}lock {,no}acl {,no}rdirplus - {,no}fsc' -- "$cur") ) - ;;& - nfs4|auto) - COMPREPLY+=( $(compgen -W 'clientaddr= {,no}migration' \ - -- "$cur") ) - ;;& - ntfs-3g) - COMPREPLY+=( $(compgen -W '{u,g}id= {u,f,d}mask= usermapping= - permissions inherit locale= force {,no}recover - ignore_case remove_hiberfile show_sys_files - hide_{hid,dot}_files windows_names allow_other max_read= - silent no_def_opts streams_interface= user_xattr efs_raw - {,no}compression debug no_detach' -- "$cur") ) - ;;& - proc|auto) - COMPREPLY+=( $(compgen -W '{u,g}id=' -- "$cur") ) - ;;& - reiserfs|auto) - COMPREPLY+=( $(compgen -W 'conv hash= {,no_un}hashed_relocation - noborder nolog notail replayonly resize= user_xattr acl - barrier=' -- "$cur") ) - ;;& - tmpfs|auto) - COMPREPLY+=( $(compgen -W 'size= nr_blocks= nr_inodes= mode= - {u,g}id= mpol=' -- "$cur") ) - ;;& - udf|auto) - COMPREPLY+=( $(compgen -W '{u,g}id= umask= unhide undelete - nostrict iocharset bs= novrs session= anchor= volume= - partition= lastblock= fileset= rootdir=' -- "$cur") ) - ;;& - usbfs|auto) - COMPREPLY+=( $(compgen -W 'dev{u,g}id= devmode= bus{u,g}id= - busmode= list{u,g}id= listmode=' -- "$cur") ) - ;;& - xfs|auto) - COMPREPLY+=( $(compgen -W 'allocsize= {,no}attr2 barrier dmapi - {,no}grpid {bsd,sysv}groups ihashsize= {,no}ikeep - inode{32,64} {,no}largeio logbufs= logbsize= logdev= - rtdev= mtpt= noalign norecovery nouuid osyncisosync - {u,g,p}qnoenforce {,u,usr,g,grp,p,prj}quota sunit= swidth= - swalloc' -- "$cur") ) - ;;& - esac - # COMP_WORDBREAKS is a real pain in the ass - prev="${prev##*[$COMP_WORDBREAKS]}" - $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version --help --verbose --all --fork - --fake --internal-only -l --no-mtab --no-canonicalize --pass-fd -s - --read-only --rw -L -U --types --test-opts --options --bind --rbind - --move' -- "$cur" ) ) - [[ $COMPREPLY ]] && return - fi - - [[ "$cur" == \\ ]] && cur="/" - - local sm host - - if [[ "$cur" == *:* ]]; then - for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do - [[ -x $sm ]] || continue - COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \ - awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) - return - done - fi - - if [[ "$cur" == //* ]]; then - host=${cur#//} - host=${host%%/*} - if [[ -n $host ]]; then - COMPREPLY=( $( compgen -P "//$host" -W \ - "$( smbclient -d 0 -NL $host 2>/dev/null | - command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | - command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \ - -- "${cur#//$host}" ) ) - fi - fi - - _filedir -} && -complete -F _mount mount - -# ex: filetype=sh diff --git a/completions/mplayer b/completions/mplayer index e43e6c08..525c63e2 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -3,9 +3,9 @@ _mplayer_options_list() { cur=${cur%\\} - COMPREPLY=( $( compgen -W "$( $1 -noconfig all $2 help 2>/dev/null | \ + COMPREPLY=( $(compgen -W "$($1 -noconfig all $2 help 2>/dev/null | \ command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \ - command sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) + command sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//')" -- "$cur") ) } _mplayer() @@ -36,7 +36,7 @@ _mplayer() _filedir ttf fi local IFS=$'\n' - COMPREPLY+=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '$(fc-list 2>/dev/null)' -- "$cur") ) return ;; -sub|-sub-file) @@ -46,22 +46,22 @@ _mplayer() -vobsub) _filedir '@(idx|ifo|sub)' local IFS=$'\n' - COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do + COMPREPLY=( $(for i in "${COMPREPLY[@]}"; do if [[ -f $i && -r $i ]]; then printf '%s\n' ${i%.*} else printf '%s\n' $i fi - done ) ) + done) ) return ;; -subcp|-msgcharset) local cp - cp=( $( iconv --list 2>/dev/null | command 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" ) ) + COMPREPLY=( $(compgen -W '${cp[@],,}' -- "$cur") ) else - COMPREPLY=( $( compgen -W '${cp[@]^^}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${cp[@]^^}' -- "$cur") ) fi return ;; @@ -84,11 +84,10 @@ _mplayer() fi local IFS=$'\n' - for i in ~/.mplayer/skins ${dirs[@]}; do + for i in ~/.mplayer/skins "${dirs[@]}"; do if [[ -d $i && -r $i ]]; then - for j in $( compgen -d -- $i/$cur ); do - COMPREPLY[$k]=${j#$i/} - k=$((++k)) + for j in $(compgen -d -- $i/$cur); do + COMPREPLY[k++]=${j#$i/} done fi done @@ -138,23 +137,23 @@ _mplayer() return ;; -channels) - COMPREPLY=( $( compgen -W '2 4 6 8' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '2 4 6 8' -- "$cur") ) 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" ) ) + 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 ;; -lavdopts) - COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray + COMPREPLY=( $(compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= - threads= vismv= vstats' -- "$cur" ) ) + threads= vismv= vstats' -- "$cur") ) return ;; -lavcopts) - COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= + COMPREPLY=( $(compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= mbqmax= vqdiff= vmax_b_frames= vme= vhq v4mv keyint= vb_strategy= vpass= aspect= vbitrate= vratetol= vrc_maxrate= vrc_minrate= vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= @@ -163,100 +162,99 @@ _mplayer() vpsize= gray vfdct= idct= lumi_mask= dark_mask= tcplx_mask= scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic - umv' -- "$cur" ) ) + umv' -- "$cur") ) return ;; -ssf) - COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur") ) return ;; -jpeg) - COMPREPLY=( $( compgen -W 'noprogressive progressive nobaseline - baseline optimize= smooth= quality= outdir=' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'noprogressive progressive nobaseline + baseline optimize= smooth= quality= outdir=' -- "$cur") ) return ;; -xvidopts) - COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'dr2 nodr2' -- "$cur") ) return ;; -xvidencopts) - COMPREPLY=( $( compgen -W 'pass= bitrate= fixed_quant= me_quality= + COMPREPLY=( $(compgen -W 'pass= bitrate= fixed_quant= me_quality= 4mv rc_reaction_delay_factor= rc_averaging_period= rc_buffer= quant_range= min_key_interval= max_key_interval= mpeg_quant mod_quant lumi_mask hintedme hintfile debug keyframe_boost= - kfthreshold= kfreduction=' -- "$cur" ) ) + kfthreshold= kfreduction=' -- "$cur") ) return ;; -divx4opts) - COMPREPLY=( $( compgen -W 'br= key= deinterlace q= min_quant= + COMPREPLY=( $(compgen -W 'br= key= deinterlace q= min_quant= max_quant= rc_period= rc_reaction_period= crispness= - rc_reaction_ratio= pass= vbrpass= help' -- "$cur" ) ) + rc_reaction_ratio= pass= vbrpass= help' -- "$cur") ) return ;; -info) - COMPREPLY=( $( compgen -W 'name= artist= genre= subject= - copyright= srcform= comment= help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'name= artist= genre= subject= + copyright= srcform= comment= help' -- "$cur") ) return ;; -lameopts) - COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= - mode= padding= fast preset= help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= + mode= padding= fast preset= help' -- "$cur") ) return ;; -rawaudio) - COMPREPLY=( $( compgen -W 'on channels= rate= samplesize= format=' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on channels= rate= samplesize= format=' \ + -- "$cur") ) return ;; -rawvideo) - COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= - h= y420 yv12 yuy2 y8 format= size=' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= + h= y420 yv12 yuy2 y8 format= size=' -- "$cur") ) return ;; -aop) - COMPREPLY=( $( compgen -W 'list= delay= format= fout= volume= mul= - softclip' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'list= delay= format= fout= volume= mul= + softclip' -- "$cur") ) return ;; -dxr2) - COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded iec958-decoded + COMPREPLY=( $(compgen -W 'ar-mode= iec958-encoded iec958-decoded mute ucode= 75ire bw color interlaced macrovision= norm= square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot= 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" ) ) + oly-cor= overlay overlay-ratio= update-cache' -- "$cur") ) return ;; -tv) - COMPREPLY=( $( compgen -W 'on noaudio driver= device= input= freq= + COMPREPLY=( $(compgen -W 'on noaudio driver= device= input= freq= outfmt= width= height= buffersize= norm= channel= chanlist= audiorate= forceaudio alsa amode= forcechan= adevice= audioid= volume= bass= treble= balance= fps= channels= immediatemode=' \ - -- "$cur" ) ) + -- "$cur") ) return ;; -mf) - COMPREPLY=( $( compgen -W 'on w= h= fps= type=' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on w= h= fps= type=' -- "$cur") ) return ;; -cdda) - COMPREPLY=( $( compgen -W 'speed= paranoia= generic-dev= + COMPREPLY=( $(compgen -W 'speed= paranoia= generic-dev= sector-size= overlap= toc-bias toc-offset= skip noskip' \ - -- "$cur" ) ) + -- "$cur") ) return ;; -input) - COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate keylist cmdlist - js-dev file' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'conf= ar-delay ar-rate keylist cmdlist + js-dev file' -- "$cur") ) return ;; -af-adv) - COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'force= list=' -- "$cur") ) return ;; -noconfig) - COMPREPLY=( $( compgen -W 'all gui system user' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all gui system user' -- "$cur") ) return ;; -*) @@ -274,13 +272,13 @@ _mplayer() case $cur in -*) - COMPREPLY=( $( compgen -W '$( $cmd -noconfig all -list-options 2>/dev/null | \ + COMPREPLY=( $(compgen -W '$($cmd -noconfig all -list-options 2>/dev/null | \ command sed -ne '1,/^[[:space:]]*Name/d' \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ - -e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) ) + -e "/^-\(Total\|.*\*\)\{0,1\}$/!p")' -- "$cur") ) ;; *) - _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)' + _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|m[eo]d|M[EO]D|xm|XM|it|IT|s[t3]m|S[T3]M|mtm|MTM|w64|W64)?(.@(crdownload|part))' ;; esac diff --git a/completions/mr b/completions/mr index 9229e309..15f634a3 100644 --- a/completions/mr +++ b/completions/mr @@ -37,18 +37,18 @@ _mr() { ;; clean) if [[ "${cur}" == -* ]]; then - COMPREPLY=( $( compgen -W '-f' -- "${cur}" ) ) + COMPREPLY=( $(compgen -W '-f' -- "${cur}") ) fi return ;; commit|ci|record) if [[ "${cur}" == -* ]]; then - COMPREPLY=( $( compgen -W '-m' -- "${cur}" ) ) + COMPREPLY=( $(compgen -W '-m' -- "${cur}") ) fi return ;; run) - COMPREPLY=( $( compgen -c -- "${cur}" ) ) + COMPREPLY=( $(compgen -c -- "${cur}") ) return ;; *) @@ -60,11 +60,11 @@ _mr() { # Complete top-level options and commands. case $prev in - -c|--config) + --config|-!(-*)c) _filedir return ;; - -d|--directory) + --directory|-!(-*)d) _filedir -d return ;; @@ -76,9 +76,9 @@ _mr() { options="${options//-[a-z]$'\n'/}" # Remove deprecated options. options="${options//--path/}" - COMPREPLY=( $( compgen -W "${options}" -- "${cur}" ) ) + COMPREPLY=( $(compgen -W "${options}" -- "${cur}") ) else - COMPREPLY=( $( compgen -W "${commands}" -- "${cur}" ) ) + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) fi } && complete -F _mr mr diff --git a/completions/msynctool b/completions/msynctool index 3eae1dfa..4fd51618 100644 --- a/completions/msynctool +++ b/completions/msynctool @@ -7,35 +7,35 @@ _msynctool() case $words in --configure) - COMPREPLY=( $( compgen -W "$($1 --showgroup \ + COMPREPLY=( $(compgen -W "$($1 --showgroup \ $prev | awk '/^Member/ {print $2}' | command sed \ - -e 's/:$//' )" -- "$cur" ) ) + -e 's/:$//')" -- "$cur") ) return ;; --addmember) - COMPREPLY=( $( compgen -W '$($1 --listplugins \ - | command sed -e '1d' )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --listplugins \ + | command sed -e 1d)' -- "$cur") ) return ;; esac case $prev in --configure|--addgroup|--delgroup|--showgroup|--sync|--addmember) - COMPREPLY=( $( compgen -W '$($1 --listgroups \ - | command sed -e '1d' )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --listgroups \ + | command sed -e 1d)' -- "$cur") ) return ;; --showformats|--filter-objtype|--slow-sync) - COMPREPLY=( $( compgen -W '$($1 --listobjects \ - | command sed -e '1d' )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$($1 --listobjects \ + | command sed -e 1d)' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects + COMPREPLY=( $(compgen -W '--listgroups --listplugins --listobjects --showformats --showgroup --sync --filter-objtype --slow-sync --wait --multi --addgroup --delgroup --addmember --configure --manual - --configdir --conflict' -- "$cur" ) ) + --configdir --conflict' -- "$cur") ) } && complete -F _msynctool msynctool diff --git a/completions/mtx b/completions/mtx index c52c6173..9266687c 100644 --- a/completions/mtx +++ b/completions/mtx @@ -23,10 +23,10 @@ _mtx() if [[ $cword -gt 1 ]]; then case $prev in load) - COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$tapes" -- "$cur") ) ;; unload|first|last|next) - COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$drives" -- "$cur") ) ;; -f) true @@ -36,7 +36,7 @@ _mtx() ;; esac else - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) fi } && complete -F _mtx mtx diff --git a/completions/munin-node-configure b/completions/munin-node-configure index a2021727..1d564d3f 100644 --- a/completions/munin-node-configure +++ b/completions/munin-node-configure @@ -19,13 +19,13 @@ _munin_node_configure() return ;; --snmpversion) - COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '1 2c 3' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _munin_node_configure munin-node-configure diff --git a/completions/munin-run b/completions/munin-run index 72228522..6855e02d 100644 --- a/completions/munin-run +++ b/completions/munin-run @@ -17,10 +17,10 @@ _munin_run() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else - COMPREPLY=( $( compgen -W \ - '$( command ls /etc/munin/plugins 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(command ls /etc/munin/plugins 2>/dev/null)' -- "$cur") ) fi } && complete -F _munin_run munin-run diff --git a/completions/munin-update b/completions/munin-update index ef8bf5b5..ac770a6b 100644 --- a/completions/munin-update +++ b/completions/munin-update @@ -17,9 +17,9 @@ _munin_update() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--force-root --noforce-root --service --host + COMPREPLY=( $(compgen -W '--force-root --noforce-root --service --host --config --help --debug --nodebug --fork --nofork --stdout - --nostdout --timeout' -- "$cur" ) ) + --nostdout --timeout' -- "$cur") ) fi } && complete -F _munin_update munin-update diff --git a/completions/munindoc b/completions/munindoc index f603d87b..a08399ba 100644 --- a/completions/munindoc +++ b/completions/munindoc @@ -5,8 +5,8 @@ _munindoc() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W \ - '$( command ls /usr/share/munin/plugins 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(command ls /usr/share/munin/plugins 2>/dev/null)' -- "$cur") ) } && complete -F _munindoc munindoc diff --git a/completions/mussh b/completions/mussh index 185f9d30..e76817c7 100644 --- a/completions/mussh +++ b/completions/mussh @@ -10,11 +10,11 @@ _mussh() return ;; -d) - COMPREPLY=( $( compgen -W '{0..2}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..2}' -- "$cur") ) return ;; -v) - COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..3}' -- "$cur") ) return ;; -i|-H|-C) @@ -26,7 +26,7 @@ _mussh() return ;; -l|-L) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; -s) @@ -39,13 +39,13 @@ _mussh() ;; -c) compopt -o filenames - COMPREPLY+=( $( compgen -c -- "$cur" ) ) + COMPREPLY+=( $(compgen -c -- "$cur") ) return ;; esac [[ $cur != -* ]] || \ - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _mussh mussh diff --git a/completions/mutt b/completions/mutt index 568479ec..43a8842e 100644 --- a/completions/mutt +++ b/completions/mutt @@ -9,7 +9,7 @@ _muttaddr() _muttaliases "$1" _muttquery "$1" - COMPREPLY+=( $( compgen -u -- "$1" ) ) + COMPREPLY+=( $(compgen -u -- "$1") ) } @@ -78,9 +78,9 @@ _muttaliases() [[ -z $muttrc ]] && return conffiles=( $(eval _muttconffiles $muttrc $muttrc) ) - aliases=( $( command sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ - $(eval echo "${conffiles[@]}") ) ) - COMPREPLY+=( $( compgen -W "${aliases[*]}" -- "$cur" ) ) + aliases=( $(command sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ + $(eval echo "${conffiles[@]}")) ) + COMPREPLY+=( $(compgen -W "${aliases[*]}" -- "$cur") ) } @@ -90,16 +90,16 @@ _muttquery() local cur=$1 querycmd muttcmd=${words[0]} local -a queryresults - querycmd="$( $muttcmd -Q query_command 2>/dev/null | command 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 | \ - command sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) ) + queryresults=( $($querycmd | \ + command sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p') ) fi - COMPREPLY+=( $( compgen -W "${queryresults[*]}" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "${queryresults[*]}" -- "$cur") ) } @@ -110,18 +110,18 @@ _muttfiledir() muttrc=$(_muttrc) if [[ $cur == [=+]* ]]; then - folder="$( $muttcmd -F "$muttrc" -Q folder 2>/dev/null | command 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 # (minus the leading '=' sign). compopt -o filenames - COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) ) + COMPREPLY=( $(compgen -f -- "$folder/${cur:1}") ) COMPREPLY=( ${COMPREPLY[@]#$folder/} ) return elif [[ $cur == !* ]]; then - spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \ - command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )" + spoolfile="$($muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \ + command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|')" [[ ! -z $spoolfile ]] && eval cur="${cur/^!/$spoolfile}" fi _filedir @@ -135,21 +135,21 @@ _mutt() case $cur in -*) - 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" ) ) + 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 ;; *) case $prev in - -a|-f|-F|-H|-i) + -*[afFHi]) _muttfiledir "$cur" return ;; - -A) + -*A) _muttaliases "$cur" return ;; - -e|-m|-Q|-s|-h|-p|-R|-v|-y|-z|-Z) + -*[emQshpRvyzZ]) return ;; *) diff --git a/completions/mypy b/completions/mypy new file mode 100644 index 00000000..82da1f08 --- /dev/null +++ b/completions/mypy @@ -0,0 +1,57 @@ +# mypy completion -*- shell-script -*- + +_mypy() +{ + local cur prev words cword split + _init_completion -s || return + + [[ $cword -gt 2 && ${words[cword-2]} == --shadow-file ]] && \ + prev=--shadow-file # hack; takes two args + + case $prev in + --help|--version|--python-version|--platform|--always-true|\ + --always-false|--find-occurrences|--package|--command|-!(-*)[hVpc]) + return + ;; + --config-file) + _filedir + return + ;; + --follow-imports) + COMPREPLY=( $(compgen -W 'normal silent skip error' -- "$cur") ) + return + ;; + --python-executable) + COMPREPLY=( $(compgen -c -- "${cur:-py}") ) + return + ;; + --*-dir|--*-report) + _filedir -d + return + ;; + --custom-typing|--module|-!(-*)m) + _xfunc python _python_modules + return + ;; + --shadow-file) + _filedir '@(py|pyi)' + return + ;; + --junit-xml) + _filedir xml + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + return + fi + + _filedir '@(py|pyi)' +} && +complete -F _mypy mypy + +# ex: filetype=sh diff --git a/completions/mysql b/completions/mysql index 48fe0e39..ffb4bcd7 100644 --- a/completions/mysql +++ b/completions/mysql @@ -1,31 +1,36 @@ # mysql(1) completion -*- shell-script -*- +_mysql_character_sets() +{ + local IFS=$' \t\n' 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") ) +} + _mysql() { local cur prev words cword split _init_completion -s || return case $prev in - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|-!(-*)u) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -D|--database) - COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) ) + --database|-!(-*)D) + COMPREPLY=( $(compgen -W "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur") ) return ;; - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; --default-character-set) - local IFS=$' \t\n' 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" ) ) + _mysql_character_sets return ;; @@ -33,38 +38,45 @@ _mysql() _filedir -d return ;; - -S|--socket) + --socket|-!(-*)S) _filedir sock return ;; --protocol) - COMPREPLY=( $( compgen -W 'tcp socket pipe memory' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'tcp socket pipe memory' -- "$cur") ) return ;; --defaults-file|--defaults-extra-file|--tee) _filedir return ;; - --default-character-set|-P|--port|--set-variable|\ - --ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|\ - --connect_timeout|--max_allowed_packet|--prompt|\ - --net_buffer_length|--select_limit|--max_join_size|\ - --server-arg|--debug|--delimiter|--execute|-e|--pager) - # Argument required but no completions available + --ssl-ca|--ssl-cert) + _filedir '@(pem|cer|c?(e)rt)' + return + ;; + --ssl-key) + _filedir '@(pem|key)' return ;; - '-?'|-I|--help|-V|--version) - # All other options are noop with these + --port|--set-variable|--ssl-cipher|--connect_timeout|\ + --max_allowed_packet|--prompt|--net_buffer_length|--select_limit|\ + --max_join_size|--server-arg|--debug|--delimiter|--execute|--pager|\ + -!(-*)[Pe]) + return + ;; + --help|--version|-!(-*)[?IV]) return ;; esac + $split && return + case $cur in --*) local help=$(_parse_help "$1") help+=" --skip-comments --skip-ssl" - COMPREPLY=( $( compgen -W "$help" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$help" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return ;; @@ -77,9 +89,9 @@ _mysql() ;; esac - COMPREPLY=( $( compgen -W \ + COMPREPLY=( $(compgen -W \ "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \ - -- "$cur" ) ) + -- "$cur") ) } && complete -F _mysql mysql diff --git a/completions/mysqladmin b/completions/mysqladmin index bb7ba869..1e34a34d 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -6,11 +6,11 @@ _mysqladmin() _init_completion -s || return case $prev in - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|-!(-*)u) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; @@ -18,7 +18,11 @@ _mysqladmin() _filedir -d return ;; - -S|--socket) + --default-character-set) + _xfunc mysql _mysql_character_sets + return + ;; + --socket|-!(-*)S) _filedir sock return ;; @@ -26,26 +30,31 @@ _mysqladmin() _filedir 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 + --ssl-ca|--ssl-cert) + _filedir '@(pem|cer|c?(e)rt)' + return + ;; + --ssl-key) + _filedir '@(pem|key)' + return + ;; + --count|--port|--set-variable|--sleep|--ssl-cipher|--wait|\ + --connect_timeout|--shutdown_timeout|-!(-*)[cPOiw]) return ;; - '-?'|--help|-V|--version) - # All other options are noop with these + --help|--version|-!(-*)[?V]) return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) - COMPREPLY+=( $( compgen -W 'create debug drop extended-status flush-hosts + COMPREPLY+=( $(compgen -W 'create debug drop extended-status flush-hosts flush-logs flush-status flush-tables flush-threads flush-privileges kill password old-password ping processlist reload refresh shutdown - status start-slave stop-slave variables version' -- "$cur" ) ) + status start-slave stop-slave variables version' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && diff --git a/completions/nc b/completions/nc index 63cb9d14..0ba61808 100644 --- a/completions/nc +++ b/completions/nc @@ -3,41 +3,45 @@ _nc() { local cur prev words cword - _init_completion || return + _init_completion -n : || return case $prev in - -h|-I|-i|-O|-P|-p|-V|-w) + -*[hIiMmOPpqVWw]) return ;; - -s) - _ip_addresses + -*s) + if [[ "${words[*]}" == *-6* ]]; then + _ip_addresses -6 + __ltrim_colon_completions "$cur" + else + _ip_addresses + fi return ;; - -T) - COMPREPLY=( $( compgen -W 'critical inetcontrol lowdelay netcontrol - throughput reliability ef af{11..43} cs{0..7}' -- "$cur" ) ) + -*T) + COMPREPLY=( $(compgen -W 'critical inetcontrol lowcost lowdelay + netcontrol throughput reliability ef af{11..43} cs{0..7}' \ + -- "$cur") ) return ;; - -X) - COMPREPLY=( $( compgen -W '4 5 connect' -- "$cur" ) ) + -*X) + COMPREPLY=( $(compgen -W '4 5 connect' -- "$cur") ) return ;; - -x) + -*x) _known_hosts_real -- "$cur" return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi # Complete 1st non-option arg only - local i - for (( i=1; i < cword; i++ )); do - [[ ${words[i]} != -* && ${words[i-1]} != -[IiOPpsTVwXx] ]] && return - done + local args; _count_args "" "-*[IiMmOPpqsTVWwXx]" + [[ $args -eq 1 ]] || return _known_hosts_real -- "$cur" } && diff --git a/completions/ncftp b/completions/ncftp index 4c073ce6..35146f3c 100644 --- a/completions/ncftp +++ b/completions/ncftp @@ -12,13 +12,13 @@ _ncftp() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi if [[ $cword -eq 1 && -f ~/.ncftp/bookmarks ]]; then - COMPREPLY=( $( compgen -W '$( command sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ - ~/.ncftp/bookmarks )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(command sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ + ~/.ncftp/bookmarks)' -- "$cur") ) fi } && diff --git a/completions/nethogs b/completions/nethogs index 8eeb4ff5..85fc1cb4 100644 --- a/completions/nethogs +++ b/completions/nethogs @@ -8,14 +8,14 @@ _nethogs() case "$prev" in -d) # expect integer value - COMPREPLY+=( $( compgen -W '{0..9}' ) ) + COMPREPLY+=( $(compgen -W '{0..9}') ) compopt -o nospace return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" -h)' -- "$cur") ) return fi diff --git a/completions/newlist b/completions/newlist index 04bf17d1..793928c3 100644 --- a/completions/newlist +++ b/completions/newlist @@ -14,7 +14,7 @@ _newlist() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _xfunc list_lists _mailman_lists diff --git a/completions/newusers b/completions/newusers index 068b7a92..b7792b54 100644 --- a/completions/newusers +++ b/completions/newusers @@ -7,8 +7,7 @@ _newusers() case $prev in -c|--crypt) - COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur") ) return ;; -s|--sha-rounds) @@ -19,7 +18,7 @@ _newusers() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/ngrep b/completions/ngrep index bbfbbd2f..65f4dc6d 100644 --- a/completions/ngrep +++ b/completions/ngrep @@ -10,15 +10,16 @@ _ngrep() return ;; -I|-O) - _filedir pcap + _filedir 'pcap?(ng)' return ;; -d) _available_interfaces -a + COMPREPLY+=( $(compgen -W 'any' -- "$cur") ) return ;; -W) - COMPREPLY=( $( compgen -W 'normal byline single none' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'normal byline single none' -- "$cur") ) return ;; -F) @@ -28,7 +29,7 @@ _ngrep() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi } && diff --git a/completions/nmap b/completions/nmap index c56c7210..b4e76baf 100644 --- a/completions/nmap +++ b/completions/nmap @@ -25,7 +25,7 @@ _nmap() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-iL -iR --exclude --excludefile -sL -sP -PN + COMPREPLY=( $(compgen -W '-iL -iR --exclude --excludefile -sL -sP -PN -PS -PA -PU -PY -PE -PP -PM -PO -n -R --dns-servers --system-dns --traceroute -sS -sT -sA -sW -sM -sU -sN -sF -sX --scanflags -sI -sY -sZ -sO -b -p -F -r --top-ports --port-ratio -sV @@ -40,7 +40,7 @@ _nmap() -oA -v -d --reason --open --packet-trace --iflist --log-errors --append-output --resume --stylesheet --webxml --no-stylesheet -6 -A --datadir --send-eth --send-ip --privilege--unprivileged -V - -h' -- "$cur" ) ) + -h' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/nproc b/completions/nproc index 8903940e..84092679 100644 --- a/completions/nproc +++ b/completions/nproc @@ -14,8 +14,10 @@ _nproc() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && complete -F _nproc nproc + +# ex: filetype=sh diff --git a/completions/nslookup b/completions/nslookup index 65770629..267d0c30 100644 --- a/completions/nslookup +++ b/completions/nslookup @@ -2,15 +2,15 @@ _bind_queryclass() { - COMPREPLY+=( $( compgen -W 'IN CH HS ANY' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'IN CH HS ANY' -- "$cur") ) } _bind_querytype() { # http://en.wikipedia.org/wiki/List_of_DNS_record_types - COMPREPLY+=( $( compgen -W 'A AAAA AFSDB APL CERT CNAME DHCID DLV DNAME + COMPREPLY+=( $(compgen -W 'A AAAA AFSDB APL CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR - RRSIG RP SIG SOA SPF SRV SSHFP TXT' -- "$cur" ) ) + RRSIG RP SIG SOA SPF SRV SSHFP TXT' -- "$cur") ) } _nslookup() @@ -35,9 +35,9 @@ _nslookup() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-all -class= -debug -nodebug -d2 -nod2 + COMPREPLY=( $(compgen -W '-all -class= -debug -nodebug -d2 -nod2 -domain= -search -nosearch -port= -querytype= -recurse -norecurse - -retry= -timeout= -vc -novc -fail -nofail' -- "$cur" ) ) + -retry= -timeout= -vc -novc -fail -nofail' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -66,7 +66,7 @@ _host() return ;; -m) - COMPREPLY=( $( compgen -W 'trace record usage' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'trace record usage' -- "$cur") ) return ;; -N|-R|-W) @@ -75,7 +75,7 @@ _host() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/nsupdate b/completions/nsupdate new file mode 100644 index 00000000..ff3b9a47 --- /dev/null +++ b/completions/nsupdate @@ -0,0 +1,40 @@ +# bash completion for nsupdate(1) -*- shell-script -*- + +_nsupdate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[VLprtu]) + return + ;; + -*k) + _filedir key + return + ;; + -*R) + cur=${cur:=/dev/} + _filedir + return + ;; + -*y) + if [[ $cur == h* ]]; then + COMPREPLY=( $(compgen -W "hmac-{md5,sha{1,224,256,384,512}}" \ + -S : -- "$cur") ) + [[ $COMPREPLY == *: ]] && compopt -o nospace + fi + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) + return + fi + + _filedir +} && +complete -F _nsupdate nsupdate + +# ex: filetype=sh diff --git a/completions/ntpdate b/completions/ntpdate index ff0c9f00..5291336c 100644 --- a/completions/ntpdate +++ b/completions/ntpdate @@ -6,26 +6,26 @@ _ntpdate() _init_completion || return case $prev in - -k) + -*k) _filedir return ;; - -U) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + -*U) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -p) - COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) + -*p) + COMPREPLY=( $(compgen -W '{1..8}' -- "$cur") ) return ;; - -a|-e|-o|-t) + -*[aeot]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/oggdec b/completions/oggdec index 0493087d..9bdf5019 100644 --- a/completions/oggdec +++ b/completions/oggdec @@ -6,18 +6,18 @@ _oggdec() _init_completion -s || return case $prev in - --help|-h|--version|-V) + --help|--version|-!(-*)[hV]*) return ;; - --bits|-b) - COMPREPLY=( $( compgen -W "8 16" -- "$cur" ) ) + --bits|-!(-*)b) + COMPREPLY=( $(compgen -W "8 16" -- "$cur") ) return ;; - --endianness|-e|--sign|-s) - COMPREPLY=( $( compgen -W "0 1" -- "$cur" ) ) + --endianness|--sign|-!(-*)[es]) + COMPREPLY=( $(compgen -W "0 1" -- "$cur") ) return ;; - --output|-o) + --output|-!(-*)o) _filedir wav return ;; @@ -26,7 +26,7 @@ _oggdec() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/op b/completions/op new file mode 100644 index 00000000..b99bd2de --- /dev/null +++ b/completions/op @@ -0,0 +1,56 @@ +# op (1Password CLI) completion -*- shell-script -*- + +_op_commands() +{ + "$@" --help | + awk "/^(Available |Sub)commands/{flag=1;next}/^ /&&flag{print \$1}" +} + +_op_command_options() +{ + case $cur in + -*) + for i in "${!words[@]}"; do + [[ ${words[i]} == -* || $i -eq 0 ]] && unset words[i] + done + COMPREPLY=( $(compgen -W \ + '$(_parse_usage "$1" "${words[*]} --help") --help' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + ;; + esac + return 1 +} + +_op() +{ + local cur prev words cword split + _init_completion -s || return + + local command i + for (( i=1; i < cword; i++ )); do + case ${words[i]} in + --help|--version) return ;; + -*) ;; + *) command=${words[i]}; break ;; + esac + done + + if [[ -z $command && $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + [[ $command ]] && _op_command_options "$1" && return + + if [[ -z $command || $command == $prev ]]; then + COMPREPLY=( $(compgen -W '$(_op_commands "$1" $command)' -- "$cur") ) + [[ $COMPREPLY ]] && return + fi + + # TODO specific command and subcommand completions +} && +complete -F _op op + +# ex: filetype=sh diff --git a/completions/openssl b/completions/openssl index 73e56a44..50300a43 100644 --- a/completions/openssl +++ b/completions/openssl @@ -22,8 +22,7 @@ _openssl_sections() [[ ! -f $config ]] && return - COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(awk '/\[.*\]/ {print $2}' $config)" -- "$cur") ) } _openssl_digests() @@ -53,7 +52,7 @@ _openssl() sha224 sha256 sha384 sha512 genpkey pkey pkeyparam pkeyutl' if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) else command=${words[1]} case $prev in @@ -87,7 +86,7 @@ _openssl() formats+=" ENGINE" ;; esac - COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$formats" -- "$cur") ) return ;; -connect) @@ -95,16 +94,15 @@ _openssl() return ;; -starttls) - COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'smtp pop3 imap ftp' -- "$cur") ) return ;; -cipher) - COMPREPLY=( $( IFS=: compgen -W "$( $1 ciphers )" \ - -- "$cur" ) ) + COMPREPLY=( $(IFS=: compgen -W "$($1 ciphers)" -- "$cur") ) return ;; -kdf) - COMPREPLY=( $( compgen -W 'TLS1-PRF HKDF' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'TLS1-PRF HKDF' -- "$cur") ) return ;; esac @@ -137,7 +135,7 @@ _openssl() ;; dgst) options="-c -d -hex -binary -out -sign -verify -prverify - -signature $( _openssl_digests $1 )" + -signature $(_openssl_digests $1)" ;; dsa) options='-inform -outform -in -passin -out -passout -des @@ -189,7 +187,7 @@ _openssl() req) options="-inform -outform -in -passin -out -passout -text -noout -verify -modulus -new -rand -newkey -newkey - -nodes -key -keyform -keyout $( _openssl_digests $1 ) + -nodes -key -keyform -keyout $(_openssl_digests $1) -config -x509 -days -asn1-kludge -newhdr -extensions -reqexts section" ;; @@ -248,19 +246,19 @@ _openssl() -clrtrust -clrreject -addtrust -addreject -setalias -days -set_serial -signkey -x509toreq -req -CA -CAkey -CAcreateserial -CAserial -text -C -clrext - -extfile -extensions -engine $( _openssl_digests $1 )" + -extfile -extensions -engine $(_openssl_digests $1)" ;; md*|sha*|ripemd160) options='-c -d' ;; esac - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else if [[ "$command" == speed ]]; then - COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 + COMPREPLY=( $(compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea - rc2 des rsa blowfish' -- "$cur" ) ) + rc2 des rsa blowfish' -- "$cur") ) else _filedir fi diff --git a/completions/opera b/completions/opera index 26343c62..dc0859ea 100644 --- a/completions/opera +++ b/completions/opera @@ -16,14 +16,14 @@ _opera() return ;; ?(-)-remote) - COMPREPLY=( $( compgen -W 'openURL\\( openFile\\( openM2\\( + COMPREPLY=( $(compgen -W 'openURL\\( openFile\\( openM2\\( openComposer\\( addBookmark\\( raise\\(\\) lower\\(\\)' \ - -- "$cur" ) ) + -- "$cur") ) [[ $COMPREPLY == *\( ]] && compopt -o nospace return ;; ?(-)-windowname) - COMPREPLY=( $( compgen -W 'first last opera{1..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'first last opera{1..9}' -- "$cur") ) return ;; ?(-)-geometry|?(-)-window|?(-)-display|?(-)-urllistloadtimeout|\ @@ -35,7 +35,7 @@ _opera() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/optipng b/completions/optipng index 7c614abe..22889bf4 100644 --- a/completions/optipng +++ b/completions/optipng @@ -10,7 +10,7 @@ _optipng() return ;; -o) - COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..7}' -- "$cur") ) return ;; -out|-log) @@ -22,26 +22,26 @@ _optipng() return ;; -i) - COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 1' -- "$cur") ) return ;; -zc|-zm) - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) return ;; -zw) - COMPREPLY=( $( compgen -W '256 512 1k 2k 4k 8k 16k 32k' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '256 512 1k 2k 4k 8k 16k 32k' \ + -- "$cur") ) return ;; -strip) - COMPREPLY=( $( compgen -W 'all' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'all' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/p4 b/completions/p4 index beea4687..e383c8cf 100644 --- a/completions/p4 +++ b/completions/p4 @@ -9,22 +9,22 @@ _p4() local p4commands p4filetypes # rename isn't really a command - p4commands="$( p4 help commands 2>/dev/null | awk 'NF>3 {print $1}' )" + p4commands="$(p4 help commands 2>/dev/null | awk 'NF>3 {print $1}')" p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \ uresource uxbinary xbinary xltext xtempobj xtext \ text binary resource" if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$p4commands" -- "$cur") ) elif [[ $cword -eq 2 ]]; then case $prev in help) - COMPREPLY=( $( compgen -W "simple commands environment + COMPREPLY=( $(compgen -W "simple commands environment filetypes jobview revisions usage views $p4commands" \ - -- "$cur" ) ) + -- "$cur") ) ;; admin) - COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "checkpoint stop" -- "$cur") ) ;; *) ;; @@ -34,7 +34,7 @@ _p4() -t) case ${words[$cword-2]} in add|edit|reopen) - COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$p4filetypes" -- "$cur") ) ;; *) ;; diff --git a/completions/pack200 b/completions/pack200 index 37c57749..f35840b0 100644 --- a/completions/pack200 +++ b/completions/pack200 @@ -12,19 +12,19 @@ _pack200() return ;; -E|--effort) - COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..9}' -- "$cur") ) return ;; -H|--deflate-hint) - COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'true false keep' -- "$cur") ) return ;; -m|--modification-time) - COMPREPLY=( $( compgen -W 'latest keep' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'latest keep' -- "$cur") ) return ;; -U|--unknown-attribute) - COMPREPLY=( $( compgen -W 'error strip pass' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'error strip pass' -- "$cur") ) return ;; -f|--config-file) @@ -32,7 +32,7 @@ _pack200() return ;; -l|--log-file) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-' -- "$cur") ) _filedir log return ;; @@ -54,13 +54,13 @@ _pack200() done if ! $pack ; then - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '--no-gzip --gzip --strip-debug + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '--no-gzip --gzip --strip-debug --no-keep-file-order --segment-limit= --effort= --deflate-hint= --modification-time= --pass-file= --unknown-attribute= --class-attribute= --field-attribute= --method-attribute= --code-attribute= --config-file= --verbose --quiet --log-file= - --help --version -J --repack' -- "$cur" ) ) + --help --version -J --repack' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir 'pack?(.gz)' diff --git a/completions/passwd b/completions/passwd index ce6d4c0e..5a1e5629 100644 --- a/completions/passwd +++ b/completions/passwd @@ -6,13 +6,14 @@ _passwd() _init_completion || return case $prev in - -n|--minimum|-x|--maximum|-w|--warning|-i|--inactive|-\?|--help|--usage) + --minimum|--maximum|--warning|--inactive|--help|--usage|-!(-*)[nxwi?]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) return fi diff --git a/completions/patch b/completions/patch index 1a9edca1..df85211d 100644 --- a/completions/patch +++ b/completions/patch @@ -6,42 +6,42 @@ _patch() _init_completion -s || return case $prev in - -p|--strip|-D|--ifdef|-B|--prefix|-Y|--basename-prefix|-z|--suffix|\ - -g|--get) + --strip|--ifdef|--prefix|--basename-prefix|--suffix|--get|\ + -!(-*)[pDBYzg]) return ;; - -F|--fuzz) - COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + --fuzz|-!(-*)F) + COMPREPLY=( $(compgen -W '{0..3}' -- "$cur") ) return ;; - -i|--input) + --input|-!(-*)i) _filedir '@(?(d)patch|dif?(f))' return ;; - -o|--output|-r|--reject-file) + --output|--reject-file|-!(-*)[or]) [[ ! $cur || $cur == - ]] && COMPREPLY=( - ) _filedir return ;; --quoting-style) - COMPREPLY=( $( compgen -W 'literal shell shell-always c escape' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'literal shell shell-always c escape' \ + -- "$cur") ) return ;; - -V|--version-control) - COMPREPLY=( $( compgen -W 'simple numbered existing' -- "$cur" ) ) + --version-control|-!(-*)V) + COMPREPLY=( $(compgen -W 'simple numbered existing' -- "$cur") ) return ;; - -d|--directory) + --directory|-!(-*)d) _filedir -d return ;; --reject-format) - COMPREPLY=( $( compgen -W 'context unified' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'context unified' -- "$cur") ) return ;; --read-only) - COMPREPLY=( $( compgen -W 'ignore warn fail' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ignore warn fail' -- "$cur") ) return ;; esac @@ -49,7 +49,7 @@ _patch() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/pdftotext b/completions/pdftotext index aed6b2c2..79c837e0 100644 --- a/completions/pdftotext +++ b/completions/pdftotext @@ -10,24 +10,24 @@ _pdftotext() return ;; -enc) - COMPREPLY=( $( compgen -W '$( "$1" -listenc 2>/dev/null | - command sed -e 1d )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" -listenc 2>/dev/null | + command sed -e 1d)' -- "$cur") ) return ;; -eol) - COMPREPLY=( $( compgen -W "unix dos mac" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "unix dos mac" -- "$cur") ) return ;; esac if [[ $cur == -* && ${prev,,} != *.pdf ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi case ${prev,,} in -|*.txt) ;; - *.pdf) COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) ; _filedir txt ;; + *.pdf) COMPREPLY=( $(compgen -W '-' -- "$cur") ) ; _filedir txt ;; *) _filedir pdf ;; esac } && diff --git a/completions/perl b/completions/perl index 250039ee..98ddb9eb 100644 --- a/completions/perl +++ b/completions/perl @@ -2,9 +2,9 @@ _perl_helper() { - COMPREPLY=( $( compgen -P "$prefix" -W \ - "$( ${2:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl $1 $cur )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -P "$prefix" -W \ + "$(${2:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl $1 $cur)" \ + -- "$cur") ) [[ $1 == functions ]] || __ltrim_colon_completions "$prefix$cur" } @@ -30,35 +30,35 @@ _perl() fi case $prev in - -D|-e|-E|-i|-F|-l) + -*[DeEiFl]) return ;; - -I|-x) + -*[Ix]) local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) + COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") ) return ;; - -m|-M) + -*[mM]) temp="${cur#-}" prefix+="${cur%$temp}" cur="$temp" _perl_helper modules $1 return ;; - -V) + -*V) if [[ $cur == :* ]]; then temp="${cur##+(:)}" prefix+="${cur%$temp}" local IFS=$'\n' - COMPREPLY=( $( compgen -P "$prefix" -W \ - '$( $1 -MConfig -e "print join \"\\n\", - keys %Config::Config" 2>/dev/null )' -- "$temp" ) ) + COMPREPLY=( $(compgen -P "$prefix" -W \ + '$($1 -MConfig -e "print join \"\\n\", + keys %Config::Config" 2>/dev/null)' -- "$temp") ) __ltrim_colon_completions "$prefix$temp" fi return ;; - -d|-dt) + -*d|-*dt) if [[ $cur == :* ]]; then temp="${cur#:}" prefix="$prefix${cur%$temp}" @@ -69,8 +69,8 @@ _perl() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p - -n -a -F -l -0 -I -m -M -P -S -x -i -e' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p + -n -a -F -l -0 -I -m -M -P -S -x -i -e' -- "$cur") ) else _filedir fi @@ -96,31 +96,31 @@ _perldoc() [[ $perl == $1 ]] || ! type $perl &>/dev/null && perl= case $prev in - -h|-V|-n|-o|-M|-w|-L) + -*[hVnoMwL]) return ;; - -d) + -*d) _filedir return ;; - -f) + -*f) _perl_helper functions $perl return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) else # return available modules (unless it is clearly a file) if [[ "$cur" != @(*/|[.~])* ]]; then _perl_helper perldocs $perl if [[ $cur == p* ]]; then - COMPREPLY+=( $( compgen -W \ - '$( PERLDOC_PAGER=cat "$1" -u perl | \ - command sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ - awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' \ - -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + '$(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@([lm]|od)' diff --git a/completions/perlcritic b/completions/perlcritic new file mode 100644 index 00000000..d9a4063d --- /dev/null +++ b/completions/perlcritic @@ -0,0 +1,51 @@ +# perlcritic(1) completion -*- shell-script -*- + +_perlcritic() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version|--top|--include|--exclude|--single-policy|\ + --colo?(u)r-severity-*|--program-extensions|-[?HVs]) + return + ;; + --severity) + COMPREPLY=( $(compgen -W "{1..5} brutal cruel harsh stern gentle" \ + -- "$cur") ) + return + ;; + --profile|-p) + _filedir perlcriticrc + return + ;; + --theme) + COMPREPLY=( $(compgen -W '$("$1" --list-themes 2>/dev/null)' \ + -- "$cur") ) + return + ;; + --profile-strictness) + COMPREPLY=( $(compgen -W 'warn fatal quiet' -- "$cur") ) + return + ;; + --verbose) + COMPREPLY=( $(compgen -W '{1..11}' -- "$cur") ) + return + ;; + --pager) + compopt -o filenames + COMPREPLY=( $(compgen -c -- "$cur") ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) + return + fi + + _filedir 'p[lm]' +} && +complete -F _perlcritic perlcritic + +# ex: filetype=sh diff --git a/completions/perltidy b/completions/perltidy index 10c49cab..ce93b2a5 100644 --- a/completions/perltidy +++ b/completions/perltidy @@ -22,20 +22,20 @@ _perltidy() return ;; -ole=*) - COMPREPLY=( $( compgen -W 'dos win mac unix' -- "${cur#*=}" ) ) + COMPREPLY=( $(compgen -W 'dos win mac unix' -- "${cur#*=}") ) return ;; -bt=*|-pt=*|-sbt=*|-bvt=*|-pvt=*|-sbvt=*|-bvtc=*|-pvtc=*|-sbvtc=*|\ -cti=*|-kbl=*|-vt=*) - COMPREPLY=( $( compgen -W '0 1 2' -- "${cur#*=}" ) ) + COMPREPLY=( $(compgen -W '0 1 2' -- "${cur#*=}") ) return ;; -vtc=*) - COMPREPLY=( $( compgen -W '0 1' -- "${cur#*=}" ) ) + COMPREPLY=( $(compgen -W '0 1' -- "${cur#*=}") ) return ;; -cab=*) - COMPREPLY=( $( compgen -W '0 1 2 3' -- "${cur#*=}" ) ) + COMPREPLY=( $(compgen -W '0 1 2 3' -- "${cur#*=}") ) return ;; -*=) @@ -44,10 +44,12 @@ _perltidy() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir 'p[lm]' fi } && complete -F _perltidy perltidy + +# ex: filetype=sh diff --git a/completions/pgrep b/completions/pgrep index 82985acf..e45d7d7f 100644 --- a/completions/pgrep +++ b/completions/pgrep @@ -6,41 +6,41 @@ _pgrep() _init_completion || return case $prev in - -c|-d|--delimiter|-g|--pgroup|-J|-M|-N|-s|--session|-t|--terminal|-T|-z) + --delimiter|--pgroup|--session|--terminal|-!(-*)[cdgJMNstTz]) return ;; --signal) _signals return ;; - -F|--pidfile) + --pidfile|-!(-*)F) _filedir return ;; - -G|--group) + --group|-!(-*)G) _gids return ;; -j) - COMPREPLY=( $( compgen -W 'any none' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'any none' -- "$cur") ) return ;; - -P|--parent) + --parent|-!(-*)P) _pids return ;; - -u|--euid|-U|--uid) + --euid|--uid|-!(-*)[uU]) _uids return ;; esac if [[ $cur == -* ]]; then - local help='$( _parse_help "$1" )' - [[ $help ]] || help='$( "$1" --usage 2>&1 | + 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" ) ) + _parse_usage -)' + COMPREPLY=( $(compgen -W "$help" -- "$cur") ) [[ $cword -eq 1 && $1 == *pkill ]] && _signals - return fi diff --git a/completions/pidof b/completions/pidof index 223e25d4..9e5c012b 100644 --- a/completions/pidof +++ b/completions/pidof @@ -6,17 +6,17 @@ _pidof() _init_completion || return case $prev in - -h|--help|-V|--version) + --help|-V|--version|-!(-*)[hV]*) return ;; - -o|--omit-pid) + --omit-pid|-!(-*)o) _pids return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/pine b/completions/pine index d99a3808..bf6056e0 100644 --- a/completions/pine +++ b/completions/pine @@ -14,17 +14,17 @@ _pine() return ;; -sort) - COMPREPLY=( $( compgen -W 'arrival subject threaded orderedsubject + 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" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) else - COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \ - 2>/dev/null)' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(awk "{print \$1}" ~/.addressbook \ + 2>/dev/null)' -- "$cur") ) fi } && complete -F _pine pine alpine diff --git a/completions/ping b/completions/ping index cc1bca7a..d611ae87 100644 --- a/completions/ping +++ b/completions/ping @@ -8,54 +8,58 @@ _ping() local ipvx case $prev in - -c|-F|-G|-g|-h|-i|-l|-m|-P|-p|-s|-t|-V|-W|-w|-z) + -*[cFGghilmPpstVWwz]) return ;; - -I) + -*I) _available_interfaces -a return ;; - -M) + -*M) # Path MTU strategy in Linux, mask|time in FreeBSD local opts="do want dont" [[ $OSTYPE == *bsd* ]] && opts="mask time" - COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$opts' -- "$cur") ) return ;; - -N) + -*N) if [[ $cur != *= ]]; then - COMPREPLY=( $( compgen -W 'name ipv6 ipv6-global ipv6-sitelocal + COMPREPLY=( $(compgen -W 'name ipv6 ipv6-global ipv6-sitelocal ipv6-linklocal ipv6-all ipv4 ipv4-all subject-ipv6= - subject-ipv4= subject-name= subject-fqdn=' -- "$cur" ) ) + subject-ipv4= subject-name= subject-fqdn=' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi return ;; - -Q) + -*Q) # TOS in Linux, "somewhat quiet" (no args) in FreeBSD if [[ $OSTYPE != *bsd* ]]; then - COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..7}' -- "$cur") ) return fi ;; - -S) + -*S) # Socket sndbuf in Linux, source IP in FreeBSD [[ $OSTYPE == *bsd* ]] && _ip_addresses return ;; - -T) + -*T) # Timestamp option in Linux, TTL in FreeBSD [[ $OSTYPE == *bsd* ]] || \ - COMPREPLY=( $( compgen -W 'tsonly tsandaddr' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'tsonly tsandaddr' -- "$cur") ) return ;; - -4|-6) - ipvx=$prev + -*4*) + ipvx=-4 + ;; + -*6*) + ipvx=-6 ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) return fi diff --git a/completions/pkg-config b/completions/pkg-config index a537d497..57191370 100644 --- a/completions/pkg-config +++ b/completions/pkg-config @@ -15,9 +15,9 @@ _pkg_config() local i for (( i=1; i < ${#words[@]}; i++ )); do if [[ ${words[i]} != -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( "$1" ${words[i]} --print-variables 2>/dev/null )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" ${words[i]} --print-variables 2>/dev/null)' \ + -- "$cur") ) break fi done @@ -32,11 +32,12 @@ _pkg_config() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W "$( $1 --list-all \ - 2>/dev/null | awk '{print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 --list-all \ + 2>/dev/null | awk '{print $1}')" -- "$cur") ) + _filedir pc fi } && complete -F _pkg_config pkg-config diff --git a/completions/pkg-get b/completions/pkg-get index d5382eb2..ea300b8b 100644 --- a/completions/pkg-get +++ b/completions/pkg-get @@ -38,8 +38,7 @@ _pkg_get() 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]}" == @(-[aDdiUu]|available|describe|download|install|list|updatecatalog|upgrade) ]]; then @@ -58,7 +57,7 @@ _pkg_get() return fi - if [[ ${cur} == -* ]] ; then + if [[ ${cur} == -* ]]; then local opts="-c -d -D -f -i -l -s -S -u -U -v" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return diff --git a/completions/pkg_delete b/completions/pkg_delete index 9125829d..b1a93c20 100644 --- a/completions/pkg_delete +++ b/completions/pkg_delete @@ -11,7 +11,7 @@ _pkg_delete() [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return - COMPREPLY=( $( compgen -d -- "$pkgdir$cur" ) ) + COMPREPLY=( $(compgen -d -- "$pkgdir$cur") ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) } && diff --git a/completions/pkgadd b/completions/pkgadd index 009f3a25..576b4114 100644 --- a/completions/pkgadd +++ b/completions/pkgadd @@ -35,7 +35,7 @@ _pkgadd () -P|-k|-x) ;; *) - if [[ ${cur} == -* ]] ; then + if [[ ${cur} == -* ]]; then local opts="-a -A -d -k -n -M -P -r -R -s -v -V -x" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) else diff --git a/completions/pkgrm b/completions/pkgrm index 891507f8..ef3b2a8d 100644 --- a/completions/pkgrm +++ b/completions/pkgrm @@ -13,7 +13,7 @@ _pkgrm () local spool=/var/sadm/pkg local i=$cword while [[ $((i--)) -gt 0 ]]; do - i=$((i-1)) + (( i-- )) case "${words[$i]}" in -s) spool="${words[$((i+1))]}" diff --git a/completions/pkgtool b/completions/pkgtool index 95d42aaa..8bea9cdd 100644 --- a/completions/pkgtool +++ b/completions/pkgtool @@ -15,7 +15,7 @@ _pkgtool() return ;; --source_device) - COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + COMPREPLY=( $(compgen -f -d -- "${cur:-/dev/}") ) return ;; --tagfile) @@ -25,9 +25,9 @@ _pkgtool() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile + COMPREPLY=( $(compgen -W '--sets --ignore-tagfiles --tagfile --source-mounted --source_dir --target_dir --source_device' \ - -- "$cur" ) ) + -- "$cur") ) fi } && complete -F _pkgtool pkgtool diff --git a/completions/pkgutil b/completions/pkgutil index 4b2fcdcd..bafb9aab 100644 --- a/completions/pkgutil +++ b/completions/pkgutil @@ -66,7 +66,7 @@ _pkgutil() if [[ -n "$command" ]] && [[ ! "$cur" == -* ]]; then local mirrors mirror_url - mirrors=$(awk -F= ' $1 ~ /^ *mirror *$/ { print $2 }' ${configuration_files[@]}) + mirrors=$(awk -F= ' $1 ~ /^ *mirror *$/ { print $2 }' "${configuration_files[@]}") mirrors=${mirrors:-http://mirror.opencsw.org/opencsw/testing} for mirror_url in $mirrors; do local catalog=$(_pkgutil_url2catalog "$mirror_url") diff --git a/completions/plague-client b/completions/plague-client index 6fd22f75..d8b2140e 100644 --- a/completions/plague-client +++ b/completions/plague-client @@ -6,8 +6,8 @@ _plague_client() _init_completion || return [[ $cword -eq 1 ]] && \ - COMPREPLY=( $( compgen -W 'build detail finish help is_paused kill list - list_builders pause requeue unpause update_builders' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'build detail finish help is_paused kill list + list_builders pause requeue unpause update_builders' -- "$cur") ) } && complete -F _plague_client plague-client diff --git a/completions/pm-hibernate b/completions/pm-hibernate index fcabbfaf..1deadd11 100644 --- a/completions/pm-hibernate +++ b/completions/pm-hibernate @@ -5,7 +5,7 @@ _pm_action() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W "--help $( _parse_help "$1" )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "--help $(_parse_help "$1")" -- "$cur") ) } && complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid diff --git a/completions/pm-is-supported b/completions/pm-is-supported index 2eeb634d..6a112aeb 100644 --- a/completions/pm-is-supported +++ b/completions/pm-is-supported @@ -5,8 +5,8 @@ _pm_is_supported() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W '--help --suspend --hibernate --suspend-hybrid' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --suspend --hibernate --suspend-hybrid' \ + -- "$cur") ) } && complete -F _pm_is_supported pm-is-supported diff --git a/completions/pm-powersave b/completions/pm-powersave index f61833cf..06f93de0 100644 --- a/completions/pm-powersave +++ b/completions/pm-powersave @@ -5,7 +5,7 @@ _pm_powersave() local cur prev words cword _init_completion || return - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "true false" -- "$cur") ) } && complete -F _pm_powersave pm-powersave diff --git a/completions/pngfix b/completions/pngfix index b1f630ed..b4b58e83 100644 --- a/completions/pngfix +++ b/completions/pngfix @@ -14,8 +14,9 @@ _pngfix() return ;; --strip) - COMPREPLY=( $( IFS='|' compgen -W '$( "$1" --help 2>&1 | - command sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p" )' -- "$cur" ) ) + COMPREPLY=( $(IFS='|' compgen -W '$("$1" --help 2>&1 | + command sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p")' \ + -- "$cur") ) return ;; esac @@ -23,7 +24,7 @@ _pngfix() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/portinstall b/completions/portinstall index 314e936f..8a70b136 100644 --- a/completions/portinstall +++ b/completions/portinstall @@ -18,10 +18,10 @@ _portinstall() [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return - COMPREPLY=( $( command grep -E "^$cur" 2>/dev/null < $indexfile | \ - cut -d'|' -f1 ) ) - COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" 2>/dev/null \ - < $indexfile | cut -d'|' -f2 ) ) + COMPREPLY=( $(command grep -E "^$cur" 2>/dev/null <$indexfile | \ + cut -d'|' -f1) ) + COMPREPLY2=( $(command grep -E "^[^\|]+\|$portsdir$cur" 2>/dev/null \ + <$indexfile | cut -d'|' -f2) ) COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) COMPREPLY+=( "${COMPREPLY2[@]}" ) diff --git a/completions/portupgrade b/completions/portupgrade index 64d983df..42538077 100644 --- a/completions/portupgrade +++ b/completions/portupgrade @@ -9,7 +9,7 @@ _portupgrade() local pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - COMPREPLY=( $( compgen -d -- "$pkgdir$cur" ) ) + COMPREPLY=( $(compgen -d -- "$pkgdir$cur") ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) COMPREPLY=( ${COMPREPLY[@]%-*} ) diff --git a/completions/postcat b/completions/postcat index 69214354..22006233 100644 --- a/completions/postcat +++ b/completions/postcat @@ -13,7 +13,7 @@ _postcat() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi @@ -23,12 +23,10 @@ _postcat() done if [[ $qfile -eq 1 ]]; then local len=${#cur} pval - idx=0 - for pval in $( mailq 2>/dev/null | \ - command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + for pval in $(mailq 2>/dev/null | \ + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//'); do if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) + COMPREPLY+=( $pval ) fi done return diff --git a/completions/postconf b/completions/postconf index c1f17d9d..45b376be 100644 --- a/completions/postconf +++ b/completions/postconf @@ -23,15 +23,14 @@ _postconf() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi - local len=${#cur} idx=0 pval - for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do + local len=${#cur} pval + for pval in $(/usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1); do if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval$eqext" - idx=$(($idx+1)) + COMPREPLY+=( "$pval$eqext" ) fi done } && diff --git a/completions/postfix b/completions/postfix index 9b116be1..89ff4dd4 100644 --- a/completions/postfix +++ b/completions/postfix @@ -11,18 +11,18 @@ _postfix() return ;; -D) - COMPREPLY=( $( compgen -W 'start' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'start' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -W 'check start stop abort flush reload status - set-permissions upgrade-configuration' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'check start stop abort flush reload status + set-permissions upgrade-configuration' -- "$cur") ) } && complete -F _postfix postfix diff --git a/completions/postmap b/completions/postmap index 1b415f69..66756c1e 100644 --- a/completions/postmap +++ b/completions/postmap @@ -16,24 +16,23 @@ _postmap() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi if [[ "$cur" == *:* ]]; then compopt -o filenames - COMPREPLY=( $( compgen -f -- "${cur#*:}" ) ) + COMPREPLY=( $(compgen -f -- "${cur#*:}") ) else - local len=${#cur} idx=0 pval - for pval in $( /usr/sbin/postconf -m 2>/dev/null ); do + local len=${#cur} pval + for pval in $(/usr/sbin/postconf -m 2>/dev/null); do if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval:" - idx=$(($idx+1)) + COMPREPLY+=( "$pval:" ) fi done - if [[ $idx -eq 0 ]]; then + if [[ ! $COMPREPLY ]]; then compopt -o filenames - COMPREPLY=( $( compgen -f -- "$cur" ) ) + COMPREPLY=( $(compgen -f -- "$cur") ) fi fi } && diff --git a/completions/postsuper b/completions/postsuper index e69cbea0..509d2484 100644 --- a/completions/postsuper +++ b/completions/postsuper @@ -5,7 +5,7 @@ _postsuper() local cur prev words cword _init_completion || return - local pval len idx + local pval len case $prev in -c) @@ -14,36 +14,30 @@ _postsuper() ;; -[dr]) len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + for pval in ALL $(mailq 2>/dev/null | \ + command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//'); do if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) + COMPREPLY+=( $pval ) fi done return ;; -h) len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do + for pval in ALL $(mailq 2>/dev/null | \ + 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)) + COMPREPLY+=( $pval ) fi done return ;; -H) len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do + for pval in ALL $(mailq 2>/dev/null | \ + 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)) + COMPREPLY+=( $pval ) fi done return @@ -51,11 +45,11 @@ _postsuper() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'hold incoming active deferred' -- "$cur") ) } && complete -F _postsuper postsuper diff --git a/completions/povray b/completions/povray index e90279b3..c5af018a 100644 --- a/completions/povray +++ b/completions/povray @@ -21,14 +21,14 @@ _povray() ;; [-+]O*) # guess what output file type user may want - case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${words[*]}" ) ) in + case $(IFS=$'\n'; command grep '^[-+]F' <<<"${words[*]}") in [-+]FN) oext=png ;; [-+]FP) oext=ppm ;; [-+]F[CT]) oext=tga ;; *) oext=$defoext ;; esac # complete filename corresponding to previously specified +I - COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${words[*]}" ) ) ) + COMPREPLY=( $(IFS=$'\n'; command grep '^[-+]I' <<<"${words[*]}") ) COMPREPLY=( ${COMPREPLY[@]#[-+]I} ) COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} ) cur="${povcur#[-+]O}" # to confuse _filedir @@ -44,7 +44,7 @@ _povray() 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[}" ) + COMPREPLY=( "${COMPREPLY[@]/#/${pfx}[}" ) return ;; *) diff --git a/completions/prelink b/completions/prelink index 0db3140c..62580a95 100644 --- a/completions/prelink +++ b/completions/prelink @@ -30,7 +30,7 @@ _prelink() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/protoc b/completions/protoc index 1d4bef16..d4381446 100644 --- a/completions/protoc +++ b/completions/protoc @@ -18,13 +18,13 @@ _protoc() return ;; --error_format) - COMPREPLY=( $( compgen -W 'gcc msvs' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'gcc msvs' -- "$cur") ) return ;; --plugin) if [[ $cur != *=* ]]; then compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) fi return ;; @@ -46,9 +46,9 @@ _protoc() return ;; -*) - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) local i - for i in ${!COMPREPLY[@]}; do + for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} == -oFILE ]] && unset 'COMPREPLY[i]' done [[ $COMPREPLY == *= ]] && compopt -o nospace diff --git a/completions/psql b/completions/psql index 86a66030..ceedf07e 100644 --- a/completions/psql +++ b/completions/psql @@ -4,16 +4,16 @@ _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 -XAtqwlF $'\t' 2>/dev/null | \ - awk 'NF > 1 { print $1 }' )" -- "$cur" ) ) + 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 -XAtqwc 'select usename from pg_user' \ - template1 2>/dev/null )" -- "$cur" ) ) - [[ ${#COMPREPLY[@]} -eq 0 ]] && COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(psql -XAtqwc 'select usename from pg_user' \ + template1 2>/dev/null)" -- "$cur") ) + [[ ${#COMPREPLY[@]} -eq 0 ]] && COMPREPLY=( $(compgen -u -- "$cur") ) } # createdb(1) completion @@ -24,20 +24,15 @@ _createdb() _init_completion -s || return case $prev in - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -U|--username|-O|--owner) + --username|--owner|-!(-*)[UO]) _pg_users return ;; - -p|--port|-D|--tablespace|-E|--encoding|-T|--template) - # argument required but no completions available - return - ;; - --help|--version) - # all other arguments are noop with these + --help|--version|--port|--tablespace|--encoding|--template|-!(-*)[pDET]) return ;; esac @@ -45,7 +40,7 @@ _createdb() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _pg_databases @@ -61,14 +56,14 @@ _createuser() _init_completion -s || return case $prev in - --help|--version|-p|--port|-c|--connection-limit) + --help|--version|--port|--connection-limit|-!(-*)[pc]) return ;; - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -U|--username) + --username|-!(-*)U) _pg_users return ;; @@ -77,7 +72,7 @@ _createuser() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && @@ -91,16 +86,15 @@ _dropdb() _init_completion -s || return case $prev in - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -U|--username) + --username|-!(-*)U) _pg_users return ;; --help|--version) - # all other arguments are noop with these return ;; esac @@ -108,7 +102,7 @@ _dropdb() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _pg_databases @@ -124,14 +118,14 @@ _dropuser() _init_completion -s || return case $prev in - --help|--version|-p|--port) + --help|--version|--port|-!(-*)p) return ;; - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -U|--username) + --username|-!(-*)U) _pg_users return ;; @@ -140,7 +134,7 @@ _dropuser() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _pg_users @@ -156,29 +150,24 @@ _psql() _init_completion -s || return case $prev in - -h|--host) + --host|-!(-*)h) _known_hosts_real -- "$cur" return ;; - -U|--username) + --username|-!(-*)U) _pg_users return ;; - -d|--dbname) + --dbname|-!(-*)d) _pg_databases return ;; - -o|--output|-f|--file|-L|--log-file) + --output|--file|--log-file|-!(-*)[ofL]) _filedir 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 - ;; - -\?|--help|-V|--version) - # all other arguments are noop with these + --help|--version|--command|--field-separator|--port|--pset|\ + --record-separator|--table-attr|--set|--variable|-!(-*)[?VcFpPRTv]) return ;; esac @@ -187,7 +176,7 @@ _psql() if [[ "$cur" == -* ]]; then # return list of available options - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else # return list of available databases diff --git a/completions/puppet b/completions/puppet index 59a477ed..b9e1bcd6 100644 --- a/completions/puppet +++ b/completions/puppet @@ -3,16 +3,16 @@ _puppet_logdest() { if [[ -z $cur ]]; then - COMPREPLY=( $( compgen -W 'syslog console /' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'syslog console /' -- "$cur") ) else - COMPREPLY=( $( compgen -W 'syslog console' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'syslog console' -- "$cur") ) _filedir fi } _puppet_digest() { - COMPREPLY=( $( compgen -W 'MD5 MD2 SHA1 SHA256' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'MD5 MD2 SHA1 SHA256' -- "$cur") ) } _puppet_certs() @@ -22,17 +22,17 @@ _puppet_certs() && puppetca=puppetca if [[ "$1" == --all ]]; then - cert_list=$( $puppetca --list --all | command sed -e 's/^[+-]\{0,1\}\s*\(\S\+\)\s\+.*$/\1/' ) + cert_list=$($puppetca --list --all | command sed -e 's/^[+-]\{0,1\}\s*\(\S\+\)\s\+.*$/\1/') else - cert_list=$( $puppetca --list ) + cert_list=$($puppetca --list) fi - COMPREPLY+=( $( compgen -W "$cert_list" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "$cert_list" -- "$cur") ) } _puppet_types() { - puppet_types=$( puppet describe --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/' ) - COMPREPLY+=( $( compgen -W "$puppet_types" -- "$cur" ) ) + puppet_types=$(puppet describe --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/') + COMPREPLY+=( $(compgen -W "$puppet_types" -- "$cur") ) } _puppet_references() @@ -41,16 +41,16 @@ _puppet_references() PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetdoc &>/dev/null \ && puppetdoc=puppetdoc - puppet_doc_list=$( $puppetdoc --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/' ) - COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) ) + 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" ) ) + COMPREPLY+=( $(compgen -W \ + '$(_parse_usage "$1" "help $2")' -- "$cur") ) } _puppet() @@ -103,9 +103,9 @@ _puppet() subcommand=apply ;; *) - COMPREPLY=( $( compgen -W 'agent apply cert describe doc + COMPREPLY=( $(compgen -W 'agent apply cert describe doc filebucket kick master parser queue resource' \ - -- "$cur" ) ) + -- "$cur") ) return ;; esac @@ -131,24 +131,24 @@ _puppet() return ;; --masterport) - COMPREPLY=( $( compgen -W '8140' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '8140' -- "$cur") ) return ;; -w|--waitforcert) - COMPREPLY=( $( compgen -W '0 15 30 60 120' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 15 30 60 120' -- "$cur") ) return ;; *) _puppet_subcmd_opts "$1" $subcommand # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] - COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '--no-daemonize' -- "$cur") ) return esac ;; apply) case $prev in --catalog) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-' -- "$cur") ) _filedir json return ;; @@ -176,11 +176,11 @@ _puppet() ;; *) action=$prev - COMPREPLY=( $( compgen -W '--digest --debug --help --verbose --version' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--digest --debug --help --verbose --version' \ + -- "$cur") ) case $action in fingerprint|list|verify|--fingerprint|--list|--verify) - COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '--all' -- "$cur") ) _puppet_certs --all return ;; @@ -193,13 +193,13 @@ _puppet() return ;; sign|--sign) - COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '--all' -- "$cur") ) _puppet_certs return ;; *) - COMPREPLY+=( $( compgen -W 'clean fingerprint generate - list print revoke sign verify reinventory' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'clean fingerprint generate + list print revoke sign verify reinventory' -- "$cur") ) return esac esac @@ -218,7 +218,7 @@ _puppet() return ;; -m|--mode) - COMPREPLY=( $( compgen -W 'text trac pdf rdoc' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'text trac pdf rdoc' -- "$cur") ) return ;; -r|--reference) @@ -248,8 +248,8 @@ _puppet() if [[ "$cur" == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else - COMPREPLY=( $( compgen -W 'backup get restore' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'backup get restore' \ + -- "$cur") ) _filedir fi return @@ -285,7 +285,7 @@ _puppet() *) _puppet_subcmd_opts "$1" $subcommand # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] - COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '--no-daemonize' -- "$cur") ) return esac ;; @@ -297,7 +297,7 @@ _puppet() return ;; *) - COMPREPLY=( $( compgen -W 'validate' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'validate' -- "$cur") ) return esac ;; diff --git a/completions/pv b/completions/pv index 28514e7c..007bb36b 100644 --- a/completions/pv +++ b/completions/pv @@ -6,25 +6,26 @@ _pv() _init_completion || return case $prev in - -h|--help|-V|--version|-A|--last-written|-F|--format|-D|--delay-start|\ - -i|--interval|-w|--width|-H|--height|-N|--name|-L|--rate-limit|\ - -B|--buffer-size) + --help|--version|--last-written|--format|--delay-start|--interval|\ + --width|--height|--name|--rate-limit|--buffer-size|-!(-*)[hVAFDiwHNLB]) return ;; - -R|--remote) + --remote|-!(-*)R) _pids return ;; - -P|--pidfile|-d|--watchfd) + --pidfile|--watchfd|-!(-*)[Pd]) _filedir pid return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else _filedir fi } && complete -F _pv pv + +# ex: filetype=sh diff --git a/completions/pwck b/completions/pwck index 468aa7c6..7723f66d 100644 --- a/completions/pwck +++ b/completions/pwck @@ -6,7 +6,7 @@ _pwck() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/pwd b/completions/pwd index f4a558a2..56100173 100644 --- a/completions/pwd +++ b/completions/pwd @@ -11,9 +11,9 @@ _pwd() ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY ]] || \ - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) } && complete -F _pwd pwd diff --git a/completions/pwdx b/completions/pwdx index ed8d3ec2..675c41ff 100644 --- a/completions/pwdx +++ b/completions/pwdx @@ -12,9 +12,9 @@ _pwdx() esac if [[ $cur == -* ]]; then - local help='$( _parse_help "$1" )' + local help='$(_parse_help "$1")' [[ $help ]] || help=-V - COMPREPLY=( $( compgen -W "$help" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$help" -- "$cur") ) else _pids fi diff --git a/completions/pwgen b/completions/pwgen index d30526e9..8781cb9a 100644 --- a/completions/pwgen +++ b/completions/pwgen @@ -6,10 +6,10 @@ _pwgen() _init_completion -s || return case $prev in - -N|--num-passwords|-h|--help) + --num-passwords|--help|-!(-*)[Nh]) return ;; - -H|--sha1) + --sha1|-!(-*)H) _filedir return ;; @@ -18,7 +18,7 @@ _pwgen() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/py.test b/completions/py.test deleted file mode 100644 index 6362bf0a..00000000 --- a/completions/py.test +++ /dev/null @@ -1,71 +0,0 @@ -# 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/pycodestyle b/completions/pycodestyle index 7a62ac07..2eac748c 100644 --- a/completions/pycodestyle +++ b/completions/pycodestyle @@ -10,7 +10,7 @@ _pycodestyle() return ;; --format) - COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'default pylint' -- "$cur") ) return ;; --config) @@ -22,7 +22,7 @@ _pycodestyle() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/pydoc b/completions/pydoc index 0e750cbb..1e904885 100644 --- a/completions/pydoc +++ b/completions/pydoc @@ -16,21 +16,23 @@ _pydoc() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( "$1" | command sed -e "s/^pydoc3\{0,1\} //" | _parse_help - )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" | command sed -e "s/^pydoc3\{0,1\} //" | _parse_help -)' \ + -- "$cur") ) return fi - COMPREPLY=( $( compgen -W 'keywords topics modules' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'keywords topics modules' -- "$cur") ) - local python=python; [[ $1 == *3* ]] && python=python3 - _xfunc python _python_modules $python + if [[ $cur != @(.|*/)* ]]; then + local python=python; [[ ${1##*/} == *3* ]] && python=python3 + _xfunc python _python_modules $python + fi # 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 | command sed -e /^Here/d )' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + '$($1 keywords topics | command sed -e /^Here/d)' -- "$cur") ) _filedir py } && diff --git a/completions/pydocstyle b/completions/pydocstyle new file mode 100644 index 00000000..eb858901 --- /dev/null +++ b/completions/pydocstyle @@ -0,0 +1,35 @@ +# bash completion for pydocstyle -*- shell-script -*- + +_pydocstyle() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--version|--match|--ignore-decorators|--select|--ignore|\ + --add-select|--add-ignore|-!(-*)h) + return + ;; + --config) + _filedir xml + return + ;; + --convention) + COMPREPLY=( $(compgen -W "pep257 numpy" -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _pydocstyle pydocstyle + +# ex: filetype=sh diff --git a/completions/pyflakes b/completions/pyflakes index 05025263..4a982784 100644 --- a/completions/pyflakes +++ b/completions/pyflakes @@ -12,7 +12,7 @@ _pyflakes() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/pylint b/completions/pylint index b1d80918..35655964 100644 --- a/completions/pylint +++ b/completions/pylint @@ -5,12 +5,12 @@ _pylint() local cur prev words cword split _init_completion -s || return - local python=python; [[ $1 == *3* ]] && python=python3 + local python=python; [[ ${1##*/} == *3* ]] && python=python3 case $prev in - --version|-h|--help|--long-help|--help-msg|--init-hook|--ignore|-e|\ - --enable|-d|--disable|--evaluation|--max-line-length|\ - --max-module-lines|--indent-string|--min-similarity-lines|--max-args|\ + --version|--help|--long-help|--help-msg|--init-hook|--ignore|--enable|\ + --evaluation|--max-line-length|--max-module-lines|\ + --indent-string|--min-similarity-lines|--max-args|\ --ignored-argument-names|--max-locals|--max-returns|--max-branchs|\ --max-statements|--max-parents|--max-attributes|--min-public-methods|\ --max-public-methods|--required-attributes|--bad-functions|\ @@ -20,17 +20,22 @@ _pylint() --additional-builtins|--notes|--ignored-classes|--generated-members|\ --overgeneral-exceptions|--ignore-iface-methods|\ --defining-attr-methods|--valid-classmethod-first-arg|\ - --valid-metaclass-classmethod-first-arg) + --valid-metaclass-classmethod-first-arg|-!(-*)[he]) + return + ;; + --disable|-!(-*)d) + COMPREPLY=( $(compgen -W 'all' -- "$cur") ) return ;; --rcfile) _filedir return ;; - --persistent|-i|--include-ids|-s|--symbols|--files-output|-r|\ - --reports|--comment|--ignore-comments|--ignore-docstrings|\ - --ignore-imports|--init-import|--ignore-mixin-members|--zope) - COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) ) + --persistent|--include-ids|--symbols|--files-output|--reports|\ + --comment|--ignore-comments|--ignore-docstrings|--ignore-imports|\ + --init-import|--ignore-mixin-members|--zope|--suggestion-mode|\ + -!(-*)[isr]) + COMPREPLY=( $(compgen -W 'yes no' -- "$cur") ) return ;; --load-plugins|--deprecated-modules) @@ -40,9 +45,20 @@ _pylint() [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; - -f|--format) - COMPREPLY=( $( compgen -W 'text parseable colorized msvs html' \ - -- "$cur" ) ) + --jobs|-!(-*)j) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)}" -- "$cur") ) + return + ;; + --confidence) + local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," + COMPREPLY=( $(compgen -W "HIGH INFERENCE INFERENCE_FAILURE + UNDEFINED" -- "${cur##*,}") ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) + return + ;; + --format|-!(-*)f) + COMPREPLY=( $(compgen -W 'text parseable colorized json msvs' \ + -- "$cur") ) return ;; --import-graph|--ext-import-graph|--int-import-graph) @@ -54,13 +70,13 @@ _pylint() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( _parse_help "$1" --long-help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(_parse_help "$1" --long-help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - _xfunc python _python_modules $python + [[ $cur == @(.|*/)* ]] || _xfunc python _python_modules $python _filedir py } && complete -F _pylint pylint pylint-2 pylint-3 diff --git a/completions/pytest b/completions/pytest new file mode 100644 index 00000000..9239766c --- /dev/null +++ b/completions/pytest @@ -0,0 +1,86 @@ +# bash completion for pytest(1) -*- shell-script -*- + +_pytest() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|--maxfail|--report|--junit-prefix|--doctest-glob|-!(-*)[hkmrp]) + 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|--rsyncdir) + _filedir -d + return + ;; + --assert) + COMPREPLY=( $(compgen -W "plain reinterp rewrite" -- "$cur") ) + return + ;; + --genscript) + _filedir py + return + ;; + --pythonwarnings|-!(-*)W) + _xfunc python _python_warning_actions + return + ;; + --numprocesses|-!(-*)n) + COMPREPLY=( $(compgen -W "{1..$(_ncpus)} auto" -- "$cur") ) + return + ;; + --dist) + local modes=$("$1" --dist=nonexistent-distmode 2>&1 | \ + command sed -e 's/[^[:space:][:alnum:]-]\{1,\}//g' \ + -ne 's/.*choose from //p') + COMPREPLY=( $(compgen -W '$modes' -- "$cur") ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _pytest pytest pytest-2 pytest-3 py.test py.test-2 py.test-3 + +# ex: filetype=sh diff --git a/completions/python b/completions/python index f8ef6d0c..5e69ff12 100644 --- a/completions/python +++ b/completions/python @@ -2,9 +2,15 @@ _python_modules() { - COMPREPLY+=( $( compgen -W \ - "$( ${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python $cur \ - 2>/dev/null )" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "$(${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python $cur \ + 2>/dev/null)" -- "$cur") ) +} + +_python_warning_actions() +{ + COMPREPLY+=( $(compgen -W "ignore default all module once error" \ + ${prefix:+-P "$prefix"} -- "$cur") ) } _python() @@ -21,26 +27,25 @@ _python() esac case $prev in - -'?'|-h|--help|-V|--version|-c|-X) + --help|--version|-!(-*)[?hVcX]) return ;; - -m) + -!(-*)m) _python_modules "$1" return ;; - -Q) - COMPREPLY=( $( compgen -W "old new warn warnall" -P "$prefix" \ - -- "$cur" ) ) + -!(-*)Q) + COMPREPLY=( $(compgen -W "old new warn warnall" -P "$prefix" \ + -- "$cur") ) return ;; - -W) - COMPREPLY=( $( compgen -W "ignore default all module once error" \ - -P "$prefix" -- "$cur" ) ) + -!(-*)W) + _python_warning_actions return ;; --jit) # TODO: quite a few others, parse from "--jit help" output? - COMPREPLY=( $( compgen -W "help off" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "help off" -- "$cur") ) return ;; !(?(*/)python*([0-9.])|?(*/)pypy*([0-9.])|-?)) @@ -50,12 +55,12 @@ _python() # if -c or -m is already given, complete all kind of files. - if [[ "${words[@]::$cword}" == *\ -[cm]\ * ]]; then + if [[ "${words[*]::$cword}" == *\ -[cm]\ * ]]; then _filedir elif [[ "$cur" != -* ]]; then _filedir 'py?([cowz])' else - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) fi } && complete -F _python python python2 python3 pypy pypy3 micropython diff --git a/completions/pyvenv b/completions/pyvenv index 8e366a01..d5135e87 100644 --- a/completions/pyvenv +++ b/completions/pyvenv @@ -20,6 +20,6 @@ _pyvenv() _filedir -d } && -complete -F _pyvenv pyvenv pyvenv-3.{4..5} +complete -F _pyvenv pyvenv pyvenv-3.{4..8} # ex: filetype=sh diff --git a/completions/qdbus b/completions/qdbus index dee0760a..9a22e800 100644 --- a/completions/qdbus +++ b/completions/qdbus @@ -6,8 +6,8 @@ _qdbus() _init_completion || return [[ -n $cur ]] && unset "words[$((${#words[@]}-1))]" - COMPREPLY=( $( compgen -W '$( command ${words[@]} 2>/dev/null | \ - command sed "s/(.*)//" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(command ${words[@]} 2>/dev/null | \ + command sed "s/(.*)//")' -- "$cur") ) } && complete -F _qdbus qdbus dcop diff --git a/completions/qemu b/completions/qemu index 724e7a5f..8602cebd 100644 --- a/completions/qemu +++ b/completions/qemu @@ -16,79 +16,78 @@ _qemu() return ;; -boot) - COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'a c d n' -- "$cur") ) return ;; -k) - COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja mk no pt-br + 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" ) ) + it lv nl-be pt sl tr' -- "$cur") ) return ;; -soundhw) - COMPREPLY=( $( compgen -W "$( $1 -soundhw ? | awk \ - '/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 -soundhw ? | awk \ + '/^[[:lower:]]/ {print $1}') all" -- "$cur") ) return ;; -M) - COMPREPLY=( $( compgen -W "$( $1 -M ? | awk \ - '/^[[:lower:]]/ {print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 -M ? | awk \ + '/^[[:lower:]]/ {print $1}')" -- "$cur") ) return ;; -cpu) - COMPREPLY=( $( compgen -W "$( $1 -cpu ? | awk \ - '{print $2}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 -cpu ? | awk '{print $2}')" \ + -- "$cur") ) return ;; -usbdevice) - COMPREPLY=( $( compgen -W 'mouse tablet disk: host: serial: braille - net' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'mouse tablet disk: host: serial: braille + net' -- "$cur") ) return ;; -net) - COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'nic user tap socket vde none dump' \ + -- "$cur") ) return ;; -serial|-parallel|-monitor) - COMPREPLY=( $( compgen -W 'vc pty none null /dev/ file: stdio pipe: - COM udp: tcp: telnet: unix: mon: braille' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'vc pty none null /dev/ file: stdio pipe: + COM udp: tcp: telnet: unix: mon: braille' -- "$cur") ) return ;; -redir) - COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) ) + COMPREPLY=( $(compgen -S":" -W 'tcp udp' -- "$cur") ) return ;; -bt) - COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'hci vhci device' -- "$cur") ) return ;; -vga) - COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'cirrus std vmware xenfb none' -- "$cur") ) return ;; -drive) - COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media cyls - snapshot cache format serial addr' -- "$cur" ) ) + COMPREPLY=( $(compgen -S"=" -W 'file if bus unit index media cyls + snapshot cache format serial addr' -- "$cur") ) return ;; -balloon) - COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'none virtio' -- "$cur") ) return ;; -smbios) - COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'file type' -- "$cur") ) return ;; -watchdog) - COMPREPLY=( $( compgen -W "$( $1 -watchdog ? 2>&1 | \ - awk '{print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 -watchdog ? 2>&1 | \ + awk '{print $1}')" -- "$cur") ) return ;; -watchdog-action) - COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause debug - none' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'reset shutdown poweroff pause debug + none' -- "$cur") ) return ;; -runas) @@ -99,8 +98,8 @@ _qemu() if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help ) -fd{a,b} - -hd{a..d}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help) -fd{a,b} + -hd{a..d}' -- "$cur") ) else _filedir fi diff --git a/completions/qrunner b/completions/qrunner index 4e02a175..b0421a09 100644 --- a/completions/qrunner +++ b/completions/qrunner @@ -8,8 +8,8 @@ _qrunner() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--runner --once --list --verbose --subproc - --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--runner --once --list --verbose --subproc + --help' -- "$cur") ) fi } && diff --git a/completions/querybts b/completions/querybts index e08c905c..69c5aa08 100644 --- a/completions/querybts +++ b/completions/querybts @@ -6,27 +6,34 @@ _querybts() _init_completion -s || return case $prev in - -B|--bts) - COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \ - -- "$cur" ) ) + --bts|-!(-*)B) + COMPREPLY=( $(compgen -W "debian guug kde mandrake help" \ + -- "$cur") ) return ;; - -u|--ui|--interface) - COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) ) + --ui|--interface|-!(-*)u) + COMPREPLY=( $(compgen -W "newt text gnome" -- "$cur") ) + return + ;; + --mbox-reader-cmd) + compopt -o filenames + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; esac $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 - --interface \ - wnpp boot-floppies kernel bugs.debian.org cdimage.debian.org general - installation-reports listarchives lists.debian.org mirrors - nm.debian.org press project qa.debian.org release-notes - security.debian.org tech-ctte upgrade-reports www.debian.org' \ - -- "$cur" ) $( apt-cache pkgnames -- "$cur" 2> /dev/null ) ) + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + COMPREPLY=( $(compgen -W 'wnpp boot-floppies kernel bugs.debian.org + cdimage.debian.org general installation-reports listarchives + lists.debian.org mirrors nm.debian.org press project qa.debian.org + release-notes security.debian.org tech-ctte upgrade-reports + www.debian.org $(apt-cache pkgnames 2>/dev/null)' -- "$cur") ) + fi } && complete -F _querybts querybts diff --git a/completions/quota b/completions/quota index c1604f8e..bf7319bc 100644 --- a/completions/quota +++ b/completions/quota @@ -7,34 +7,33 @@ _user_or_group() # complete on groups if -g was given for (( i=1; i < cword; i++ )); do if [[ "${words[i]}" == -@(g|-group) ]]; then - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) return fi done # otherwise complete on users - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } _quota_parse_help() { - local opts=$( _parse_help "$1" ) - [[ $opts ]] || opts=$( _parse_usage "$1" ) # non-GNU? - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace } _quota_formats() { - COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur") ) } _filesystems() { # Only list filesystems starting with "/", otherwise we also get #+ "binfmt_misc", "proc", "tmpfs", ... - COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \ + -- "$cur") ) } _quota() @@ -171,7 +170,7 @@ _quotaon() return ;; -x|--xfs-command) - COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'delete enforce' -- "$cur") ) return ;; -h|--help|-V|--version) diff --git a/completions/radvdump b/completions/radvdump index 7280a7a1..469c8f12 100644 --- a/completions/radvdump +++ b/completions/radvdump @@ -10,12 +10,12 @@ _radvdump() return ;; -d|--debug) - COMPREPLY=( $( compgen -W '{1..4}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..4}' -- "$cur") ) return ;; esac - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) } && complete -F _radvdump radvdump diff --git a/completions/rcs b/completions/rcs index d63fe170..cfad0211 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]##*/} @@ -21,7 +21,7 @@ _rcs() COMPREPLY[$i]=$dir$file done - COMPREPLY+=( $( compgen -G "$dir/$file*,v" ) ) + COMPREPLY+=( $(compgen -G "$dir/$file*,v") ) for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do COMPREPLY[$i]=${COMPREPLY[$i]%,v} @@ -29,7 +29,7 @@ _rcs() # default to files if nothing returned and we're checking in. # otherwise, default to directories - [[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d + [[ ${#COMPREPLY[@]} -eq 0 && $1 == *ci ]] && _filedir || _filedir -d } && complete -F _rcs ci co rlog rcs rcsdiff diff --git a/completions/rdesktop b/completions/rdesktop index 1ad6978d..5226a123 100644 --- a/completions/rdesktop +++ b/completions/rdesktop @@ -6,47 +6,47 @@ _rdesktop() _init_completion -n : || return case $prev in - -k) - COMPREPLY=( $( command ls \ + -*k) + COMPREPLY=( $(command ls \ /usr/share/rdesktop/keymaps 2>/dev/null | \ - command grep -E -v '(common|modifiers)' ) ) - COMPREPLY+=( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) ) - COMPREPLY+=( $( command ls ./keymaps 2>/dev/null ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + command grep -E -v '(common|modifiers)') ) + COMPREPLY+=( $(command ls $HOME/.rdesktop/keymaps 2>/dev/null) ) + COMPREPLY+=( $(command ls ./keymaps 2>/dev/null) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) return ;; - -a) - COMPREPLY=( $( compgen -W '8 15 16 24' -- "$cur" ) ) + -*a) + COMPREPLY=( $(compgen -W '8 15 16 24' -- "$cur") ) return ;; - -x) - COMPREPLY=( $( compgen -W 'broadband modem lan' -- "$cur" ) ) + -*x) + COMPREPLY=( $(compgen -W 'broadband modem lan' -- "$cur") ) return ;; - -r) + -*r) case $cur in sound:*) - COMPREPLY=( $( compgen -W 'local off remote' \ - -- "${cur#sound:}" ) ) + COMPREPLY=( $(compgen -W 'local off remote' \ + -- "${cur#sound:}") ) ;; *:*) ;; *) - COMPREPLY=( $( compgen -W 'comport: disk: lptport: - printer: sound: lspci scard' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'comport: disk: lptport: + printer: sound: lspci scard' -- "$cur") ) [[ $COMPREPLY == *: ]] && compopt -o nospace ;; esac return ;; - -u|-d|-s|-c|-p|-n|-g|-S|-T|-X) + -*[udscpngSTX]) return ;; esac if [[ "$cur" == -* ]]; then - local opts=( $( _parse_help "$1" ) ) - COMPREPLY=( $( compgen -W '${opts[@]%:}' -- "$cur" ) ) + local opts=( $(_parse_help "$1") ) + COMPREPLY=( $(compgen -W '${opts[@]%:}' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/remove_members b/completions/remove_members index 66dbfda6..c22286f1 100644 --- a/completions/remove_members +++ b/completions/remove_members @@ -15,8 +15,8 @@ _remove_members() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--file --all --fromall --nouserack - --noadminack --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--file --all --fromall --nouserack + --noadminack --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/removepkg b/completions/removepkg index eaeb70a7..77f414f6 100644 --- a/completions/removepkg +++ b/completions/removepkg @@ -5,7 +5,7 @@ _removepkg() local cur prev words cword _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-copy -keep -preserve -warn' -- "$cur") ) return fi @@ -15,8 +15,8 @@ _removepkg() fi local root=${ROOT:-/} - COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1; \ - compgen -f -- "$cur" ) ) + COMPREPLY=( $(cd "$root/var/log/packages" 2>/dev/null || return 1; \ + compgen -f -- "$cur") ) } && complete -F _removepkg removepkg diff --git a/completions/reportbug b/completions/reportbug index c13cc627..f5eaadf3 100644 --- a/completions/reportbug +++ b/completions/reportbug @@ -6,70 +6,91 @@ _reportbug() _init_completion -s || return case $prev in - -f|--filename|-i|--include|--mta|-o|--output|-A|--attach) + --class|--header|--pseudo-header|--mirror|--list-cc|--subject|\ + --http_proxy|--proxy|--email|--realname|--smtpuser|--smtppasswd|\ + --replyto|--reply-to|--justification|--package-version|--body|\ + --body-file|--timeout|--max-attachment-size|--envelope-from|\ + -!(-*)[CHPsjV]) + return + ;; + --filename|--include|--mta|--output|--attach|-[fioA]) _filedir return ;; - -B|--bts) - COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ - "$cur" ) ) + --keyid|-!(-*)K) + COMPREPLY=( $(compgen -W '$(IFS=: ; \ + gpg --list-keys --with-colons 2>/dev/null \ + | while read -ra row ; do + [[ "${row[0]}" == [ps]ub && ${row[11]} == *s* ]] && \ + printf "%s\n" "${row[4]}" + done)' -- "$cur") ) + return + ;; + --bts|-!(-*)B) + COMPREPLY=( $(compgen -W "debian guug kde mandrake help" -- \ + "$cur") ) return ;; - -e|--editor|--mua) + --editor|--mua|--mbox-reader-cmd|-!(-*)e) words=( words[0] "$cur" ) cword=1 _command return ;; --mode) - COMPREPLY=( $( compgen -W "novice standard expert" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "novice standard expert" -- "$cur") ) return ;; - -S|--severity) - COMPREPLY=( $( compgen -W "grave serious important normal minor - wishlist" -- "$cur" ) ) + --severity|-!(-*)S) + COMPREPLY=( $(compgen -W "grave serious important normal minor + wishlist" -- "$cur") ) return ;; - -u|--ui|--interface) - COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) ) + --ui|--interface|-!(-*)u) + COMPREPLY=( $(compgen -W "newt text gnome" -- "$cur") ) return ;; - -t|--type) - COMPREPLY=( $( compgen -W "gnats debbugs" -- "$cur" ) ) + --type|-!(-*)t) + COMPREPLY=( $(compgen -W "gnats debbugs" -- "$cur") ) return ;; - -T|--tag) - COMPREPLY=( $( compgen -W "none woody potato sarge sarge-ignore + --tag|-!(-*)T) + COMPREPLY=( $(compgen -W "none woody potato sarge sarge-ignore etch etch-ignore lenny lenny-ignore sid experimental confirmed d-i fixed fixed-in-experimental fixed-upstream help l10n moreinfo patch pending security unreproducible upstream wontfix - ipv6 lfs" -- "$cur" ) ) + ipv6 lfs" -- "$cur") ) return ;; --from-buildd) - COMPREPLY=( $( compgen -S "_" -W '$( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " )' )) + COMPREPLY=( $(compgen -S "_" -W '$(apt-cache dumpavail | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" ")') ) return ;; - *) + --smtphost) + _known_hosts_real -- "$cur" + return + ;; + --draftpath) + _filedir -d + return ;; esac $split && return - COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) - wnpp boot-floppies kernel bugs.debian.org - cdimage.debian.org general installation-reports - listarchives lists.debian.org mirrors nm.debian.org - press project qa.debian.org release-notes - security.debian.org tech-ctte upgrade-reports - www.debian.org' -- "$cur" ) - $( apt-cache pkgnames -- "$cur" 2>/dev/null ) ) - if [[ $COMPREPLY == -*= ]]; then - compopt -o nospace - else - _filedir + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == -*= ]] && compopt -o nospace + return fi + + COMPREPLY=( $(compgen -W 'wnpp boot-floppies kernel bugs.debian.org + cdimage.debian.org general installation-reports listarchives + lists.debian.org mirrors nm.debian.org press project qa.debian.org + release-notes security.debian.org tech-ctte upgrade-reports + www.debian.org $(apt-cache pkgnames 2>/dev/null)' -- "$cur") ) + _filedir } && complete -F _reportbug reportbug diff --git a/completions/resolvconf b/completions/resolvconf index 1902e7d1..b4659612 100644 --- a/completions/resolvconf +++ b/completions/resolvconf @@ -13,7 +13,7 @@ _resolvconf() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a -d -u' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-a -d -u' -- "$cur") ) fi } && complete -F _resolvconf resolvconf diff --git a/completions/ri b/completions/ri index ba4dbe51..8f331419 100644 --- a/completions/ri +++ b/completions/ri @@ -15,20 +15,20 @@ _ri_get_methods() fi COMPREPLY+=( \ - "$( ri ${classes[@]} 2>/dev/null | ruby -ane \ + "$(ri "${classes[@]}" 2>/dev/null | ruby -ane \ 'if /^'"$regex"' methods:/.../^------------------|^$/ and \ /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \ - end' 2>/dev/null | sort -u )" ) + end' 2>/dev/null | sort -u)" ) else # older versions of ri didn't distinguish between class/module and # instance methods COMPREPLY+=( \ - "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \ + "$(ruby -W0 $ri_path "${classes[@]}" | ruby -ane \ 'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \ print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \ - end' | sort -u )" ) + end' | sort -u)" ) fi - COMPREPLY=( $( compgen $prefix -W '${COMPREPLY[@]}' -- $method ) ) + COMPREPLY=( $(compgen $prefix -W '${COMPREPLY[@]}' -- $method) ) } # needs at least Ruby 1.8.0 in order to use -W0 @@ -38,14 +38,14 @@ _ri() _init_completion -s -n : || return case $prev in - -h|--help|-w|--width) + --help|--width|-!(-*)[hw]) return ;; - -f|--format) - COMPREPLY=( $( compgen -W 'ansi bs html rdoc' -- "$cur" ) ) + --format|-!(-*)f) + COMPREPLY=( $(compgen -W 'ansi bs html rdoc' -- "$cur") ) return ;; - -d|--doc-dir) + --doc-dir|-!(-*)d) _filedir -d return ;; @@ -58,7 +58,7 @@ _ri() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -89,21 +89,21 @@ _ri() 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 ) ) + 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 ) ) + classes=( $(ri -l 2>/dev/null) ) elif [[ $ri_version == "ri 1.8a" ]]; then - classes=( $( ruby -W0 $ri_path | \ + classes=( $(ruby -W0 $ri_path | \ ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ - if /^ .*[A-Z]/ then print; end; end' )) + if /^ .*[A-Z]/ then print; end; end') ) else - classes=( $( ruby -W0 $ri_path | \ + classes=( $(ruby -W0 $ri_path | \ ruby -ne 'if /^I have/..$stdin.eof then \ - if /^ .*[A-Z]/ then print; end; end' )) + if /^ .*[A-Z]/ then print; end; end') ) fi - COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${classes[@]}' -- "$cur") ) __ltrim_colon_completions "$cur" if [[ "$cur" == [A-Z]* ]]; then diff --git a/completions/rmlist b/completions/rmlist index ff827473..d096352c 100644 --- a/completions/rmlist +++ b/completions/rmlist @@ -6,7 +6,7 @@ _rmlist() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--archives --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/rmmod b/completions/rmmod index 9868c79a..12f2334e 100644 --- a/completions/rmmod +++ b/completions/rmmod @@ -13,7 +13,7 @@ _rmmod() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/route b/completions/route index 128ebc16..a7c06d6d 100644 --- a/completions/route +++ b/completions/route @@ -23,7 +23,7 @@ _route() $found || COMPREPLY[${#COMPREPLY[@]}]="$opt" done - COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '"${COMPREPLY[@]}"' -- "$cur") ) } && complete -F _route route diff --git a/completions/rpcdebug b/completions/rpcdebug index 4eb332fd..ce4f9372 100644 --- a/completions/rpcdebug +++ b/completions/rpcdebug @@ -12,8 +12,8 @@ _rpcdebug_flags() done if [[ -n $module ]]; then - COMPREPLY=( $( compgen -W "$( rpcdebug -vh 2>&1 | \ - command sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(rpcdebug -vh 2>&1 | \ + command sed -ne 's/^'$module'[[:space:]]\{1,\}//p')" -- "$cur") ) fi } @@ -23,23 +23,22 @@ _rpcdebug() _init_completion || return case $prev in - -s) + -*s) _rpcdebug_flags return ;; - -c) + -*c) _rpcdebug_flags return ;; - -m) - COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) ) + -*m) + COMPREPLY=( $(compgen -W 'rpc nfs nfsd nlm' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h ) -s -c' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" -h) -s -c' -- "$cur") ) fi } && complete -F _rpcdebug rpcdebug diff --git a/completions/rpm b/completions/rpm index 6b4e66fa..b797e9fb 100644 --- a/completions/rpm +++ b/completions/rpm @@ -7,38 +7,38 @@ _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 "$( command sed -ne \ + COMPREPLY=( $(compgen -W "$(command sed -ne \ 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \ - /var/log/rpmpkgs )" -- "$cur" ) ) + /var/log/rpmpkgs)" -- "$cur") ) elif type rpmqpack &>/dev/null ; then # SUSE's rpmqpack is faster than rpm -qa - COMPREPLY=( $( compgen -W '$( rpmqpack )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(rpmqpack)' -- "$cur") ) else - COMPREPLY=( $( ${1:-rpm} -qa --nodigest --nosignature \ - --queryformat='%{NAME} ' "$cur*" 2>/dev/null ) ) + COMPREPLY=( $(${1:-rpm} -qa --nodigest --nosignature \ + --queryformat='%{NAME} ' "$cur*" 2>/dev/null) ) fi } _rpm_groups() { local IFS=$'\n' - COMPREPLY=( $( compgen -W "$( ${1:-rpm} -qa --nodigest --nosignature \ - --queryformat='%{GROUP}\n' 2>/dev/null )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(${1:-rpm} -qa --nodigest --nosignature \ + --queryformat='%{GROUP}\n' 2>/dev/null)" -- "$cur") ) } _rpm_macros() { # get a list of macros - COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | command sed -ne \ - 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \ - -- "$cur" ) ) + 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 | command sed -ne \ - 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(${1:-rpm} --showrc | command sed -ne \ + 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p')" \ + -- "$cur") ) } # rpm(8) completion @@ -52,32 +52,31 @@ _rpm() # first parameter on line case $cur in --*) - COMPREPLY=( $( compgen -W '--help --version --initdb + COMPREPLY=( $(compgen -W '--help --version --initdb --checksig --addsign --delsign --rebuilddb --showrc --setperms --setugids --eval --install --upgrade --query --freshen --erase --verify --querytags --import' \ - -- "$cur" ) ) + -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W '-e -E -F -i -q -t -U -V' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-e -E -F -i -q -t -U -V' -- "$cur") ) ;; esac return fi case $prev in - --dbpath|--excludepath|--prefix|--relocate|--root|-r) + --dbpath|--excludepath|--prefix|--relocate|--root|-!(-*)r) _filedir -d return ;; - --eval|-E) + --eval|-!(-*)E) _rpm_macros $1 return ;; --pipe) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; --rcfile) @@ -104,13 +103,13 @@ _rpm() *suggests) fmt=SUGGESTNAME ;; *supplements) fmt=SUPPLEMENTNAME ;; esac - COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \ + COMPREPLY=( $(compgen -W "$($1 -qa --nodigest --nosignature \ --queryformat=\"%{$fmt}\\n\" 2>/dev/null | - command grep -vF '(none)' )" -- "$cur" ) ) + command grep -vF '(none)')" -- "$cur") ) fi return ;; - --define|-D|--fileid|--hdrid|--pkgid) + --define|--fileid|--hdrid|--pkgid|-!(-*)D) # argument required but no completions available return ;; @@ -125,21 +124,21 @@ _rpm() case ${words[1]} in -[iFU]*|--install|--freshen|--upgrade) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --percent --force --test + COMPREPLY=( $(compgen -W "$opts --percent --force --test --replacepkgs --replacefiles --root --excludedocs --includedocs --noscripts --ignorearch --dbpath --prefix= --ignoreos --nodeps --allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport --noorder --relocate= --badreloc --notriggers --excludepath= --ignoresize --oldpackage --queryformat --repackage - --nosuggests" -- "$cur" ) ) + --nosuggests" -- "$cur") ) else _filedir '[rs]pm' fi ;; -e|--erase) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --allmatches --noscripts - --notriggers --nodeps --test --repackage" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts --allmatches --noscripts + --notriggers --nodeps --test --repackage" -- "$cur") ) else _rpm_installed_packages $1 fi @@ -151,64 +150,64 @@ _rpm() --fileprovide --filerequire --filesbypkg --info --list --obsoletes --pipe --provides --queryformat= --requires --scripts --suggests --triggers --xml --recommends - --supplements --filetriggers" + --supplements --filetriggers --licensefiles" - if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then + if [[ "${words[*]}" == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext - --last --root --state" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts --dbpath --fscontext + --last --root --state" -- "$cur") ) else _filedir fi - elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then + elif [[ "${words[*]}" == *\ -@(*([^ -])g|-group )* ]]; then # -qg completion _rpm_groups $1 - elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then + elif [[ "${words[*]}" == *\ -@(*([^ -])p|-package )* ]]; then # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy - --httpport --httpproxy --nomanifest" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts --ftpport --ftpproxy + --httpport --httpproxy --nomanifest" -- "$cur") ) else _filedir '[rs]pm' fi else # -q; installed package completion if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --all --file --fileid + COMPREPLY=( $(compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last --package --pkgid --root= --specfile --state --triggeredby --whatenhances --whatprovides --whatrecommends --whatrequires --whatsuggests --whatsupplements" \ - -- "$cur" ) ) - elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then + -- "$cur") ) + elif [[ "${words[*]}" != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages $1 fi fi ;; -K*|--checksig) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts --nopgp --nogpg --nomd5" \ + -- "$cur") ) else _filedir '[rs]pm' fi ;; -[Vy]*|--verify) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps + COMPREPLY=( $(compgen -W "$opts --root= --dbpath --nodeps --nogroup --nolinkto --nomode --nomtime --nordev --nouser --nofiles --noscripts --nomd5 --querytags --specfile --whatenhances --whatprovides --whatrecommends --whatrequires --whatsuggests --whatsupplements" \ - -- "$cur" ) ) + -- "$cur") ) # check whether we're doing file completion - elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then + elif [[ "${words[*]}" == *\ -@(*([^ -])f|-file )* ]]; then _filedir - elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then + elif [[ "${words[*]}" == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups $1 - elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then + elif [[ "${words[*]}" == *\ -@(*([^ -])p|-package )* ]]; then _filedir '[rs]pm' else _rpm_installed_packages $1 @@ -222,8 +221,8 @@ _rpm() ;; --import|--dbpath|--root) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--import --dbpath --root=' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--import --dbpath --root=' \ + -- "$cur") ) else _filedir fi @@ -242,7 +241,7 @@ _rpmbuild() [[ $rpm == $1 ]] || ! type $rpm &>/dev/null && rpm= case $prev in - --buildroot|--root|-r|--dbpath) + --buildroot|--root|--dbpath|-!(-*)r) _filedir -d return ;; @@ -250,7 +249,7 @@ _rpmbuild() _rpm_buildarchs return ;; - --eval|-E) + --eval|-!(-*)E) _rpm_macros $rpm return ;; @@ -259,13 +258,13 @@ _rpmbuild() return ;; --buildpolicy) - local cfgdir=$( $rpm --eval '%{_rpmconfigdir}' 2>/dev/null ) + local cfgdir=$($rpm --eval '%{_rpmconfigdir}' 2>/dev/null) if [[ $cfgdir ]]; then - COMPREPLY=( $( compgen -W "$( command ls $cfgdir 2>/dev/null \ - | command sed -ne 's/^brp-//p' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(command ls $cfgdir 2>/dev/null \ + | command sed -ne 's/^brp-//p')" -- "$cur") ) fi ;; - --define|-D|--with|--without) + --define|--with|--without|-!(-*)D) return ;; esac @@ -273,14 +272,14 @@ _rpmbuild() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(_parse_help "$1")" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi # Figure out file extensions to complete local word ext - for word in ${words[@]}; do + for word in "${words[@]}"; do case $word in -b?|--clean|--nobuild) ext=spec diff --git a/completions/rpm2tgz b/completions/rpm2tgz index abdf321b..da4b7e5e 100644 --- a/completions/rpm2tgz +++ b/completions/rpm2tgz @@ -6,7 +6,7 @@ _rpm2tgz() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-s -S -n -r -d -c' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-s -S -n -r -d -c' -- "$cur") ) return fi diff --git a/completions/rpmcheck b/completions/rpmcheck index 565f1313..f8577c4e 100644 --- a/completions/rpmcheck +++ b/completions/rpmcheck @@ -13,8 +13,8 @@ _rpmcheck() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-explain -failures -successes -dump - -dump-all -base -help -compressed-input' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-explain -failures -successes -dump + -dump-all -base -help -compressed-input' -- "$cur") ) else _filedir fi diff --git a/completions/rrdtool b/completions/rrdtool index 705be0d0..c8214a49 100644 --- a/completions/rrdtool +++ b/completions/rrdtool @@ -6,8 +6,8 @@ _rrdtool () _init_completion || return if [[ ${#words[@]} -eq 2 ]]; then - COMPREPLY=( $( compgen -W 'create update updatev graph dump restore - last lastupdate first info fetch tune resize xport' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'create update updatev graph dump restore + last lastupdate first info fetch tune resize xport' -- "$cur") ) else _filedir rrd fi diff --git a/completions/rsync b/completions/rsync index 22593577..03495244 100644 --- a/completions/rsync +++ b/completions/rsync @@ -12,20 +12,20 @@ _rsync() _filedir return ;; - -T|--temp-dir|--compare-dest|--backup-dir|--partial-dir|--copy-dest|\ - --link-dest) + --temp-dir|--compare-dest|--backup-dir|--partial-dir|--copy-dest|\ + --link-dest|-!(-*)T) compopt +o nospace _filedir -d return ;; - -e|--rsh) + --rsh|-!(-*)e) compopt +o nospace - COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'rsh ssh' -- "$cur") ) return ;; --compress-level) compopt +o nospace - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) return ;; esac @@ -36,7 +36,7 @@ _rsync() case $cur in -*) - COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum + COMPREPLY=( $(compgen -W '--verbose --quiet --no-motd --checksum --archive --recursive --relative --no-implied-dirs --backup --backup-dir= --suffix= --update --inplace --append --append-verify --dirs --old-dirs --links --copy-links @@ -61,7 +61,7 @@ _rsync() --out-format= --log-file= --log-file-format= --password-file= --list-only --bwlimit= --write-batch= --only-write-batch= --read-batch= --protocol= --iconv= --ipv4 --ipv6 --version - --help --daemon --config= --no-detach' -- "$cur" ) ) + --help --daemon --config= --no-detach' -- "$cur") ) [[ $COMPREPLY == *= ]] || compopt +o nospace ;; *:*) diff --git a/completions/sbcl b/completions/sbcl index 3db4a39a..a8dd5345 100644 --- a/completions/sbcl +++ b/completions/sbcl @@ -9,9 +9,9 @@ _sbcl() # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--core --noinform --help --version + COMPREPLY=( $(compgen -W '--core --noinform --help --version --sysinit --userinit --eval --noprint --disable-debugger - --end-runtime-options --end-toplevel-options ' -- "$cur" ) ) + --end-runtime-options --end-toplevel-options ' -- "$cur") ) else _filedir fi diff --git a/completions/sbopkg b/completions/sbopkg index e5742af6..1504a54e 100644 --- a/completions/sbopkg +++ b/completions/sbopkg @@ -6,13 +6,13 @@ _sbopkg() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) [[ $COMPREPLY ]] && return fi case "$prev" in -e) - COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ask continue stop' -- "$cur") ) return ;; -f) @@ -24,8 +24,8 @@ _sbopkg() return ;; -V) - COMPREPLY=( $( compgen -W "? - $( sbopkg -V ? 2>&1 | cut -s -f1 )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "? + $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur") ) return ;; -i|-b) @@ -61,9 +61,9 @@ _sbopkg() done [[ -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]] || return - 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" ) ) + 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 diff --git a/completions/screen b/completions/screen index 6b5c319f..3b9fb272 100644 --- a/completions/screen +++ b/completions/screen @@ -2,22 +2,22 @@ _screen_sessions() { - local sessions=( $( command screen -ls | command sed -ne \ - 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' ) ) + 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 - COMPREPLY=( $( compgen -W '${sessions[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${sessions[@]}' -- "$cur") ) else # Create unique completions, dropping pids where possible local -A res local i tmp - for i in ${sessions[@]}; do + for i in "${sessions[@]}"; do res[${i/#+([0-9])./}]+=" $i" done - for i in ${!res[@]}; do + for i in "${!res[@]}"; do [[ ${res[$i]} == \ *\ * ]] && tmp+=" ${res[$i]}" || tmp+=" $i" done - COMPREPLY=( $( compgen -W '$tmp' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$tmp' -- "$cur") ) fi } && _screen() @@ -27,7 +27,7 @@ _screen() if ((cword > 2)); then case ${words[cword-2]} in - -[dD]) + -*[dD]) _screen_sessions return ;; @@ -37,7 +37,7 @@ _screen() local i for (( i=1; i <= cword; i++ )); do case ${words[i]} in - -r|-R|-d|-D|-x|-s|-c|-T|-e|-h|-p|-S|-t) + -*[rRdDxscTehpSt]) (( i++ )) continue ;; @@ -51,26 +51,26 @@ _screen() done case $prev in - -[rR]) + -*[rR]) # list detached _screen_sessions 'Detached' return ;; - -[dD]) + -*[dD]) # list attached _screen_sessions 'Attached' return ;; - -x) + -*x) # list both _screen_sessions return ;; - -s) + -*s) _shells return ;; - -c) + -*c) _filedir return ;; @@ -78,15 +78,15 @@ _screen() _terms return ;; - -e|-h|-p|-S|-t) + -*[ehpSt]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln -list + COMPREPLY=( $(compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln -list -L -m -O -p -q -r -R -s -S -t -T -U -v -wipe -x -X --help - --version' -- "$cur" ) ) + --version' -- "$cur") ) fi } && complete -F _screen screen diff --git a/completions/scrub b/completions/scrub new file mode 100644 index 00000000..7fca6077 --- /dev/null +++ b/completions/scrub @@ -0,0 +1,36 @@ +# scrub(1) completion -*- shell-script -*- + +_scrub() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --version|--help|--blocksize|--device-size|--dirent|-!(-*)[vhbsD]) + return + ;; + --pattern|-!(-*)p) + COMPREPLY=( $(compgen -W '$("$1" --help 2>&1 | + awk "/^Available/{flag=1;next}/^ /&&flag{print \$1}")' \ + -- "$cur") ) + return + ;; + --freespace|-!(-*)X) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _scrub scrub + +# ex: filetype=sh diff --git a/completions/sh b/completions/sh index fd785a6d..93f00952 100644 --- a/completions/sh +++ b/completions/sh @@ -10,24 +10,24 @@ _sh() return ;; -o|+o) - COMPREPLY=( $( compgen -W 'allexport errexit ignoreeof monitor + COMPREPLY=( $(compgen -W 'allexport errexit ignoreeof monitor noclobber noglob noexec nolog notify nounset verbose vi - xtrace' -- "$cur" ) ) + xtrace' -- "$cur") ) 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" ) ) + COMPREPLY=( $(compgen -W "$opts -c -s" -- "$cur") ) return elif [[ "$cur" == +* ]]; then - COMPREPLY=( $( compgen -W "${opts//-/+}" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "${opts//-/+}" -- "$cur") ) return fi local args ext= - _count_args + _count_args "" "@(-c|[-+]o)" [[ $args -eq 1 ]] && ext=sh _filedir $ext } && diff --git a/completions/shellcheck b/completions/shellcheck new file mode 100644 index 00000000..197c1811 --- /dev/null +++ b/completions/shellcheck @@ -0,0 +1,51 @@ +# bash completion for shellcheck(1) -*- shell-script -*- + +_shellcheck_optarg() +{ + local args=$("$1" --help 2>&1 | \ + command sed -e 's/,/ /g' -ne 's/^.*'$2'\>.*(\([^)]*\)).*/\1/p') + COMPREPLY+=( $(compgen -W '$args' -- "$cur") ) +} + +_shellcheck() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --version|-!(-*)V*) + return + ;; + --exclude|-!(-*)e) + return + ;; + --format|-!(-*)f) + local args=$("$1" --format=nonexistent-format /dev/null 2>&1 | \ + command sed -ne '/^Supported formats/,//p' | \ + command sed -ne '/^[[:space:]]/p') + COMPREPLY=( $(compgen -W '$args' -- "$cur") ) + return + ;; + --color|-!(-*)C) + _shellcheck_optarg "$1" --color + return + ;; + --shell|-!(-*)s) + _shellcheck_optarg "$1" --shell + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir +} && +complete -F _shellcheck shellcheck + +# ex: filetype=sh diff --git a/completions/sitecopy b/completions/sitecopy index ef1310df..dae0548d 100644 --- a/completions/sitecopy +++ b/completions/sitecopy @@ -9,17 +9,17 @@ _sitecopy() _init_completion -s || return case $prev in - --debug|-d) - COMPREPLY=( $( compgen -W "socket files rcfile ftp http httpbody - rsh sftp xml xmlparse cleartext" -- "$cur" ) ) + --debug|-!(-*)d) + COMPREPLY=( $(compgen -W "socket files rcfile ftp http httpbody + rsh sftp xml xmlparse cleartext" -- "$cur") ) compopt -o nospace return ;; - --logfile|-g|--rcfile|-r) + --logfile|--rcfile|-!(-*)[gr]) _filedir return ;; - --storepath|-p) + --storepath|-!(-*)p) _filedir -d return ;; @@ -27,7 +27,7 @@ _sitecopy() case $cur in --*) - COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(_parse_help $1)" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return ;; @@ -41,8 +41,8 @@ _sitecopy() esac if [[ -r ~/.sitecopyrc ]]; then - COMPREPLY=( $( compgen -W "$($1 -v | \ - command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 -v | \ + command sed -n '/^Site:/s/Site: //p')" -- "$cur") ) fi } && complete -F _sitecopy -o default sitecopy diff --git a/completions/slackpkg b/completions/slackpkg index 83396a4e..a1d500dc 100644 --- a/completions/slackpkg +++ b/completions/slackpkg @@ -16,11 +16,11 @@ _slackpkg() case "$prev" in -delall|-checkmd5|-checkgpg|-checksize|-postinst|-onoff|-download_all|\ -dialog|-batch|-only_new_dotnew|-use_includes|-spinning) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; -default_answer) - COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'yes no' -- "$cur") ) return ;; -dialog_maxargs|-mirror) @@ -33,10 +33,10 @@ _slackpkg() if [[ "$cur" == -* ]]; then compopt -o nospace - COMPREPLY=( $( compgen -W '-delall= -checkmd5= -checkgpg= + COMPREPLY=( $(compgen -W '-delall= -checkmd5= -checkgpg= -checksize= -postinst= -onoff= -download_all= -dialog= -dialog_maxargs= -batch= -only_new_dotnew= -use_includes= - -spinning= -default_answer= -mirror=' -- "$cur" ) ) + -spinning= -default_answer= -mirror=' -- "$cur") ) return fi @@ -61,42 +61,42 @@ _slackpkg() ;; install-template|remove-template) if [[ -e $confdir/templates ]]; then - COMPREPLY=( $( cd "$confdir/templates"; \ - compgen -f -X "!*.template" -- "$cur" ) ) + COMPREPLY=( $(cd "$confdir/templates"; \ + compgen -f -X "!*.template" -- "$cur") ) COMPREPLY=( ${COMPREPLY[@]%.template} ) fi return ;; remove) _filedir - COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x - xap xfce y' -- "$cur" ) ) - COMPREPLY+=( $( cd /var/log/packages; compgen -f -- "$cur" ) ) + COMPREPLY+=( $(compgen -W 'a ap d e f k kde kdei l n t tcl x + xap xfce y' -- "$cur") ) + COMPREPLY+=( $(cd /var/log/packages; compgen -f -- "$cur") ) return ;; install|reinstall|upgrade|blacklist|download) _filedir - 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 | \ - command grep "^$cur" ) ) + 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 | \ + command grep "^$cur") ) return ;; info) - COMPREPLY=( $( cut -f 6 -d\ "${WORKDIR}/pkglist" 2> /dev/null | \ - command grep "^$cur" ) ) + COMPREPLY=( $(cut -f 6 -d\ "${WORKDIR}/pkglist" 2>/dev/null | \ + command grep "^$cur") ) return ;; update) # we should complete the same as the next `list` + "gpg" - COMPREPLY=( $( compgen -W 'gpg' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'gpg' -- "$cur") ) ;& *) - COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove + COMPREPLY+=( $(compgen -W 'install reinstall upgrade remove blacklist download update install-new upgrade-all clean-system new-config check-updates help generate-template install-template remove-template search file-search info' -- \ - "$cur" ) ) + "$cur") ) return ;; esac diff --git a/completions/slapt-get b/completions/slapt-get index 512981b6..9b249f19 100644 --- a/completions/slapt-get +++ b/completions/slapt-get @@ -17,7 +17,7 @@ _slapt_get() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return fi @@ -56,22 +56,22 @@ _slapt_get() # slapt-get will fail to search for "^name-version" # it can search for names only local name=${cur%%-*} - COMPREPLY=( $( LC_ALL=C "$1" -c "$config" --search "^$name" 2> \ - /dev/null | LC_ALL=C command 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=( $( LC_ALL=C "$1" -c "$config" --available 2> \ - /dev/null | LC_ALL=C command 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 - COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) ) + COMPREPLY=( $(cd /var/log/packages; compgen -f -- "$cur") ) return ;; set) # --install-set - COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x - xap xfce y' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'a ap d e f k kde kdei l n t tcl x + xap xfce y' -- "$cur") ) return ;; esac diff --git a/completions/slapt-src b/completions/slapt-src index 2f65415f..64458bab 100644 --- a/completions/slapt-src +++ b/completions/slapt-src @@ -19,7 +19,7 @@ _slapt_src() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return fi @@ -54,12 +54,12 @@ _slapt_src() if [[ "$cur" == *:* ]]; then local name=${cur%:*} local version=${cur##*:} - COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$name" 2> \ - /dev/null | LC_ALL=C command 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=( $( LC_ALL=C "$1" --config "$config" --search "^$cur" 2> \ - /dev/null | LC_ALL=C command 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 diff --git a/completions/smartctl b/completions/smartctl index 3e952aa2..c34ca598 100644 --- a/completions/smartctl +++ b/completions/smartctl @@ -2,23 +2,23 @@ _smartctl_quietmode() { - COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'errorsonly silent noserial' -- "$cur") ) } _smartctl_device() { case $cur in areca*|3ware*|megaraid*|cciss*) COMPREPLY+=( ${cur%%,*},{0..31} ) - COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '"${COMPREPLY[@]}"' -- "$cur") ) ;; hpt*) COMPREPLY+=( hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5} ) - COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '"${COMPREPLY[@]}"' -- "$cur") ) ;; *) - COMPREPLY=( $( compgen -W "ata scsi sat usbcypress usbjmicron + COMPREPLY=( $(compgen -W "ata scsi sat usbcypress usbjmicron usbsunplus marvell areca 3ware hpt megaraid cciss auto test" \ - -- "$cur" ) ) + -- "$cur") ) case "${COMPREPLY[@]}" in areca|3ware|hpt|megaraid|cciss) compopt -o nospace @@ -29,59 +29,59 @@ _smartctl_device() } _smartctl_tolerance() { - COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'normal conservative permissive verypermissive' \ + -- "$cur") ) } _smartctl_badsum() { - COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'warn exit ignore' -- "$cur") ) } _smartctl_report() { - COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'ioctl ataioctl scsiioctl' -- "$cur") ) } _smartctl_powermode() { - COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'never sleep standby idle' -- "$cur") ) } _smartctl_feature() { - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) } _smartctl_log() { - COMPREPLY=( $( compgen -W 'error selftest selective directory background + COMPREPLY=( $(compgen -W 'error selftest selective directory background sasphy sasphy,reset sataphy sataphy,reset scttemp scttempsts - scttemphist scterc gplog smartlog xerror xselftest' -- "$cur" ) ) + scttemphist scterc gplog smartlog xerror xselftest' -- "$cur") ) } _smartctl_vendorattribute() { - COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes 9,temp + COMPREPLY=( $(compgen -W 'help 9,minutes 9,seconds 9,halfminutes 9,temp 192,emergencyretractcyclect 193,loadunload 194,10xCelsius 194,unknown 198,offlinescanuncsectorct 200,writeerrorcount 201,detectedtacount - 220,temp' -- "$cur" ) ) + 220,temp' -- "$cur") ) } _smartctl_firmwarebug() { - COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'none samsung samsung2 samsung3 swapid' \ + -- "$cur") ) } _smartctl_presets() { - COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'use ignore show showall' -- "$cur") ) } _smartctl_test() { [[ $cur == @(pending|scttempint|vendor), ]] && return - COMPREPLY=( $( compgen -W 'offline short long conveyance select, + COMPREPLY=( $(compgen -W 'offline short long conveyance select, select,redo select,next afterselect,on afterselect,off pending, - scttempint, vendor,' -- "$cur" ) ) + scttempint, vendor,' -- "$cur") ) [[ $COMPREPLY == *, ]] && compopt -o nospace } _smartctl_drivedb() { local prefix= - if [[ $cur == +* ]] ; then + if [[ $cur == +* ]]; then prefix=+ cur="${cur#+}" fi @@ -95,54 +95,54 @@ _smartctl() _init_completion -s || return case $prev in - -q|--quietmode) + --quietmode|-!(-*)q) _smartctl_quietmode ;; - -d|--device) + --device|-!(-*)d) _smartctl_device return ;; - -T|--tolerance) + --tolerance|-!(-*)T) _smartctl_tolerance return ;; - -b|--badsum) + --badsum|-!(-*)b) _smartctl_badsum return ;; - -r|--report) + --report|-!(-*)r) _smartctl_report return ;; - -n|--nocheck) + --nocheck|-!(-*)n) _smartctl_powermode return ;; - -s|--smart|-o|--offlineauto|-S|--saveauto) + --smart|--offlineauto|--saveauto|-!(-*)[soS]) _smartctl_feature return ;; - -l|--log) + --log|-!(-*)l) _smartctl_log return ;; - -v|--vendorattribute) + --vendorattribute|-!(-*)v) _smartctl_vendorattribute return ;; - -F|--firmwarebug) + --firmwarebug|-!(-*)F) _smartctl_firmwarebug return ;; - -P|--presets) + --presets|-!(-*)P) _smartctl_presets return ;; - -B|--drivedb) + --drivedb|-!(-*)B) _smartctl_drivedb return ;; - -t|--test) + --test|-!(-*)t) _smartctl_test return ;; @@ -151,12 +151,12 @@ _smartctl() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version --info --all --xall + COMPREPLY=( $(compgen -W '--help --version --info --all --xall --scan --scan-open --quietmode= --device= --tolerance= --badsum= --report= --nocheck= --smart= --offlineauto= --saveauto= --health --capabilities --attributes --log= --vendorattribute= --firmwarebug= --presets= --drivedb= --test= --captive --abort' \ - -- "$cur" ) ) + -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else cur=${cur:=/dev/} diff --git a/completions/smbclient b/completions/smbclient index 3a5616cd..c896ce42 100644 --- a/completions/smbclient +++ b/completions/smbclient @@ -2,40 +2,40 @@ _samba_resolve_order() { - COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'lmhosts host wins bcast' -- "$cur") ) } _samba_domains() { if [[ -n ${COMP_SAMBA_SCAN:-} ]]; then - COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(smbtree -N -D)' -- "$cur") ) fi } _samba_hosts() { if [[ -n ${COMP_SAMBA_SCAN:-} ]]; then - COMPREPLY=( $( compgen -W "$( smbtree -N -S | \ + COMPREPLY=( $(compgen -W "$(smbtree -N -S | \ command sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \ - )" -- "$cur" ) ) + )" -- "$cur") ) fi } _samba_debuglevel() { - COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..10}' -- "$cur") ) } _samba_sockopts() { - COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST + COMPREPLY=( $(compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF - SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) ) + SO_SNDLOWAT SO_RCVLOWAT' -- "$cur") ) } _samba_signing() { - COMPREPLY=( $( compgen -W 'on off required' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off required' -- "$cur") ) } _smbclient() @@ -44,54 +44,52 @@ _smbclient() _init_completion -s || return case $prev in - -R|--name-resolve) + --name-resolve|-!(-*)R) _samba_resolve_order return ;; - -t) - COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \ - -- "$cur" ) ) + -!(-*)t) + COMPREPLY=( $(compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \ + -- "$cur") ) return ;; - -s|--configfile|-A|--authentication-file) + --configfile|--authentication-file|-!(-*)[sA]) _filedir return ;; - -l|--log-basename|-D|--directory) + --log-basename|--directory|-!(-*)[lD]) _filedir -d return ;; - -O|--socket-options) + --socket-options|-!(-*)O) _samba_sockopts return ;; - -T) - COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) ) + -!(-*)T) + COMPREPLY=( $(compgen -W 'c x I X F b g q r N a' -- "$cur") ) return ;; - -W|--workgroup) + --workgroup|-!(-*)W) _samba_domains return ;; - -d|--debuglevel) + --debuglevel|-!(-*)d) _samba_debuglevel return ;; - -L|--list) + --list|-!(-*)L) _samba_hosts return ;; - -S|--signing) + --signing|-!(-*)S) _samba_signing 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 + --port|--message|--ip-address|--send-buffer|--user|--netbiosname|\ + --scope|--tar|--command|--max-protocol|-!(-*)[pMIbUniTcm]) return ;; - -\?|--help|-V|--version) - # all other arguments are noop with these + --help|--version|-!(-*)[?V]) return ;; esac @@ -99,7 +97,7 @@ _smbclient() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && @@ -111,19 +109,19 @@ _smbget() _init_completion -s || return case $prev in - -o|--outputfile|-f|--rcfile) + --outputfile|--rcfile|-!(-*)[of]) _filedir return ;; - -d|--debuglevel) + --debuglevel|-!(-*)d) _samba_debuglevel return ;; - -w|--workgroup) + --workgroup|-!(-*)w) _samba_domains return ;; - -u|--username|-p|--password|-b|--blocksize) + --username|--password|--blocksize|-!(-*)[upb]) return ;; esac @@ -131,7 +129,7 @@ _smbget() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && @@ -143,15 +141,15 @@ _smbcacls() _init_completion -s || return case $prev in - -s|--configfile|-A|--authentication-file) + --configfile|--authentication-file|-!(-*)[As]) _filedir return ;; - -l|--log-basename) + --log-basename|-!(-*)l) _filedir -d return ;; - -d|--debuglevel) + --debuglevel|-!(-*)d) _samba_debuglevel return ;; @@ -159,16 +157,16 @@ _smbcacls() _samba_signing return ;; - -O|--socket-options) + --socket-options|-!(-*)O) _samba_sockopts return ;; - -W|--workgroup) + --workgroup|-!(-*)W) _samba_domains return ;; - -\?|--help|--usage|-D|--delete|-M|--modify|-a|--add|-S|--set|-C|\ - --chown|-G|--chgrp|-n|--netbiosname|-i|--scope|-U|--user) + --help|--usage|--delete|--modify|--add|--set|--chown|--chgrp|\ + --netbiosname|--scope|--user|-!(-*)[?DMaSCGniU]) return ;; esac @@ -176,7 +174,7 @@ _smbcacls() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && @@ -188,15 +186,15 @@ _smbcquotas() _init_completion -s || return case $prev in - -s|--configfile|-A|--authentication-file) + --configfile|--authentication-file|-!(-*)[sA]) _filedir return ;; - -l|--log-basename) + --log-basename|-!(-*)l) _filedir -d return ;; - -d|--debuglevel) + --debuglevel|-!(-*)d) _samba_debuglevel return ;; @@ -204,7 +202,7 @@ _smbcquotas() _samba_signing return ;; - -\?|--help|--usage|-U|-u|--user|-S|--set) + --help|--usage|--user|--set|-!(-*)[?UuS]) return ;; esac @@ -212,7 +210,7 @@ _smbcquotas() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && @@ -224,29 +222,29 @@ _smbpasswd() _init_completion || return case $prev in - -r) + -*r) _samba_hosts return ;; - -R) + -*R) _samba_resolve_order return ;; - -c) + -*c) _filedir return ;; - -D) + -*D) _samba_debuglevel return ;; - -U|-h|-w) + -*[Uhw]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) fi } && complete -F _smbpasswd smbpasswd @@ -257,29 +255,29 @@ _smbtar() _init_completion || return case $prev in - -r|-t) + -*[rt]) _filedir tar return ;; - -s) + -*s) _samba_hosts return ;; - -l) + -*l) _samba_debuglevel return ;; - -N) + -*N) _filedir return ;; - -p|-x|-b|-d|-u) + -*[pxbdu]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _smbtar smbtar @@ -290,23 +288,23 @@ _smbtree() _init_completion -s || return case $prev in - -s|--configfile|-A|--authentication-file) + --configfile|--authentication-file|-!(-*)[sA]) _filedir return ;; - -l|--log-basename) + --log-basename|-!(-*)l) _filedir -d return ;; - -d|--debuglevel) + --debuglevel|-!(-*)d) _samba_debuglevel return ;; - -S|--signing) + --signing|-!(-*)S) _samba_signing return ;; - -\?|--help|--usage|-U|--user) + --help|--usage|--user|-!(-*)[?U]) return ;; esac @@ -314,7 +312,7 @@ _smbtree() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/snownews b/completions/snownews index b5b070da..3938454f 100644 --- a/completions/snownews +++ b/completions/snownews @@ -7,7 +7,7 @@ _snownews() if [[ "$cur" == -* ]]; then # return list of available options - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) fi } && complete -F _snownews snownews diff --git a/completions/sqlite3 b/completions/sqlite3 index 37d78a01..a7005489 100644 --- a/completions/sqlite3 +++ b/completions/sqlite3 @@ -8,17 +8,26 @@ _sqlite3() local dbexts='@(sqlite?(3)|?(s?(3))db)' case $prev in - -help|-version|-separator|-nullvalue|*.$dbexts) + -help|-version|-lookaside|-mmap|-newline|-nullvalue|-pagecache|\ + -scratch|-separator|*.$dbexts) return ;; -init) _filedir return ;; + -cmd) + compopt -o filenames + COMPREPLY=( $(compgen -c -- "$cur") ) + return + ;; esac + [[ $cword -gt 2 && ${words[cword-2]} == -@(lookaside|pagecache|scratch) ]] \ + && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) return fi diff --git a/completions/ss b/completions/ss index b240c5e0..05e4e4b2 100644 --- a/completions/ss +++ b/completions/ss @@ -6,23 +6,23 @@ _ss() _init_completion -s || return case $prev in - -h|--help|-V|--version) + --help|--version|-!(-*)[hV]) return ;; - -f|--family) - COMPREPLY=( $( compgen -W 'unix inet inet6 link netlink' \ - -- "$cur" ) ) + --family|-!(-*)f) + COMPREPLY=( $(compgen -W 'unix inet inet6 link netlink' \ + -- "$cur") ) return ;; - -A|--query) + --query|-!(-*)A) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -W '$( "$1" --help | \ - command sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p" )' \ - -- "${cur##*,}" ) ) + COMPREPLY=( $(compgen -W '$("$1" --help | \ + command sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p")' \ + -- "${cur##*,}") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; - -D|--diag|-F|--filter) + --diag|--filter|-!(-*)[DF]) _filedir return ;; @@ -31,7 +31,7 @@ _ss() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/ssh b/completions/ssh index ba3d4b45..aaa10346 100644 --- a/completions/ssh +++ b/completions/ssh @@ -2,8 +2,9 @@ _ssh_queries() { - COMPREPLY+=( $( compgen -W \ - "cipher cipher-auth mac kex key protocol-version" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W \ + "cipher cipher-auth mac kex key key-cert key-plain protocol-version" \ + -- "$cur") ) } _ssh_query() @@ -13,44 +14,61 @@ _ssh_query() _ssh_ciphers() { - local ciphers='$( _ssh_query "$1" cipher )' + 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" - COMPREPLY+=( $( compgen -W "$ciphers" -- "$cur" ) ) + COMPREPLY+=( $(compgen -W "$ciphers" -- "$cur") ) } _ssh_macs() { - local macs='$( _ssh_query "$1" mac )' + 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" ) ) + COMPREPLY+=( $(compgen -W "$macs" -- "$cur") ) } _ssh_options() { - compopt -o nospace - COMPREPLY=( $( compgen -S = -W 'AddressFamily BatchMode BindAddress - ChallengeResponseAuthentication CheckHostIP Cipher Ciphers - ClearAllForwardings Compression CompressionLevel ConnectionAttempts - ConnectTimeout ControlMaster ControlPath ControlPersist DynamicForward - EnableSSHKeysign EscapeChar ExitOnForwardFailure ForwardAgent - ForwardX11 ForwardX11Timeout ForwardX11Trusted GatewayPorts - GlobalKnownHostsFile GSSAPIAuthentication GSSAPIClientIdentity - GSSAPIDelegateCredentials GSSAPIKeyExchange GSSAPIRenewalForcesRekey - GSSAPIServerIdentity GSSAPITrustDns HashKnownHosts Host - HostbasedAuthentication HostKeyAlgorithms HostKeyAlias HostName - IdentityFile IdentitiesOnly IPQoS KbdInteractiveDevices KexAlgorithms + local opts=( + AddKeysToAgent AddressFamily BatchMode BindAddress CanonicalDomains + CanonicalizeFallbackLocal CanonicalizeHostname CanonicalizeMaxDots + CanonicalizePermittedCNAMEs CertificateFile + ChallengeResponseAuthentication CheckHostIP Ciphers ClearAllForwardings + Compression ConnectionAttempts ConnectTimeout ControlMaster ControlPath + ControlPersist DynamicForward EnableSSHKeysign EscapeChar + ExitOnForwardFailure FingerprintHash ForwardAgent ForwardX11 + ForwardX11Timeout ForwardX11Trusted GatewayPorts GlobalKnownHostsFile + GSSAPIAuthentication GSSAPIClientIdentity GSSAPIDelegateCredentials + GSSAPIKeyExchange GSSAPIRenewalForcesRekey GSSAPIServerIdentity + GSSAPITrustDns HashKnownHosts Host HostbasedAuthentication + HostbasedKeyTypes HostKeyAlgorithms HostKeyAlias HostName + IdentitiesOnly IdentityAgent IdentityFile IgnoreUnknown Include IPQoS + KbdInteractiveAuthentication KbdInteractiveDevices KexAlgorithms LocalCommand LocalForward LogLevel MACs - NoHostAuthenticationForLocalhost NumberOfPasswordPrompts ProxyJump + NoHostAuthenticationForLocalhost NumberOfPasswordPrompts PasswordAuthentication PermitLocalCommand PKCS11Provider Port - PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication - RekeyLimit RemoteForward RequestTTY RhostsRSAAuthentication - RSAAuthentication SendEnv ServerAliveCountMax ServerAliveInterval - SmartcardDevice StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice - UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS - VisualHostKey XAuthLocation' -- "$cur" ) ) + PreferredAuthentications ProxyCommand ProxyJump ProxyUseFdpass + PubkeyAcceptedKeyTypes PubkeyAuthentication RekeyLimit RemoteCommand + RemoteForward RequestTTY RevokedHostKeys SendEnv ServerAliveCountMax + ServerAliveInterval SmartcardDevice StreamLocalBindMask + StreamLocalBindUnlink StrictHostKeyChecking SyslogFacility TCPKeepAlive + Tunnel TunnelDevice UpdateHostKeys UsePrivilegedPort User + UserKnownHostsFile VerifyHostKeyDNS VisualHostKey XAuthLocation ) + local protocols=$(_ssh_query "$1" protocol-version) + if [[ -z $protocols || $protocols == *1* ]]; then + opts+=( Cipher CompressionLevel Protocol RhostsRSAAuthentication + RSAAuthentication ) + fi + + compopt -o nospace + local IFS=$' \t\n' reset=$(shopt -p nocasematch); shopt -s nocasematch + local option + COMPREPLY=( $(for option in "${opts[@]}"; do + [[ $option == "$cur"* ]] && printf '%s=\n' "$option" + done) ) + $reset } # Complete a ssh suboption (like ForwardAgent=y<tab>) @@ -63,61 +81,90 @@ _ssh_suboption() # Split into subopt and subval local prev=${1%%=*} cur=${1#*=} - case $prev in - BatchMode|ChallengeResponseAuthentication|CheckHostIP|\ - ClearAllForwardings|ControlPersist|Compression|EnableSSHKeysign|\ - ExitOnForwardFailure|ForwardAgent|ForwardX11|ForwardX11Trusted|\ - GatewayPorts|GSSAPIAuthentication|GSSAPIKeyExchange|\ - GSSAPIDelegateCredentials|GSSAPIRenewalForcesRekey|GSSAPITrustDns|\ - HashKnownHosts|HostbasedAuthentication|IdentitiesOnly|\ - KbdInteractiveAuthentication|KbdInteractiveDevices|\ - NoHostAuthenticationForLocalhost|PasswordAuthentication|\ - PubkeyAuthentication|RhostsRSAAuthentication|RSAAuthentication|\ - StrictHostKeyChecking|TCPKeepAlive|UsePrivilegedPort|\ - VerifyHostKeyDNS|VisualHostKey) - COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) ) - ;; - AddressFamily) - COMPREPLY=( $( compgen -W 'any inet inet6' -- "$cur" ) ) - ;; - BindAddress) + case ${prev,,} in + batchmode|canonicaldomains|canonicalizefallbacklocal|\ + challengeresponseauthentication|checkhostip|\ + clearallforwardings|controlpersist|compression|enablesshkeysign|\ + exitonforwardfailure|forwardagent|forwardx11|forwardx11trusted|\ + gatewayports|gssapiauthentication|gssapikeyexchange|\ + gssapidelegatecredentials|gssapirenewalforcesrekey|gssapitrustdns|\ + hashknownhosts|hostbasedauthentication|identitiesonly|\ + kbdinteractiveauthentication|kbdinteractivedevices|\ + nohostauthenticationforlocalhost|passwordauthentication|\ + proxyusefdpass|pubkeyauthentication|rhostsrsaauthentication|\ + rsaauthentication|stricthostkeychecking|streamlocalbindunlink|\ + tcpkeepalive|useprivilegedport|verifyhostkeydns|visualhostkey) + COMPREPLY=( $(compgen -W 'yes no' -- "$cur") ) + ;; + addkeystoagent) + COMPREPLY=( $(compgen -W 'yes ask confirm no' -- "$cur") ) + ;; + addressfamily) + COMPREPLY=( $(compgen -W 'any inet inet6' -- "$cur") ) + ;; + bindaddress) _ip_addresses ;; - Cipher) - COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) ) + canonicalizehostname) + COMPREPLY=( $(compgen -W 'yes no always' -- "$cur") ) ;; - ProxyJump) - _known_hosts_real -a -F "$configfile" -- "$cur" + *file|identityagent|include) + _filedir ;; - IPQoS) - COMPREPLY=( $( compgen -W 'af1{1..4} af2{2..3} af3{1..3} af4{1..3} - cs{0..7} ef lowdelay throughput reliability' -- "$cur" ) ) + cipher) + COMPREPLY=( $(compgen -W 'blowfish des 3des' -- "$cur") ) ;; - HostbasedKeyTypes|HostKeyAlgorithms) - COMPREPLY=( $( compgen -W '$( _ssh_query "$2" key )' -- "$cur" ) ) + ciphers) + _ssh_ciphers "$2" ;; - KexAlgorithms) - COMPREPLY=( $( compgen -W '$( _ssh_query "$2" kex )' -- "$cur" ) ) + compressionlevel) + COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") ) ;; - Protocol) - COMPREPLY=( $( compgen -W '1 2 1,2 2,1' -- "$cur" ) ) + fingerprinthash) + COMPREPLY=( $(compgen -W 'md5 sha256' -- "$cur") ) ;; - RequestTTY) - COMPREPLY=( $( compgen -W 'no yes force auto' -- "$cur" ) ) + ipqos) + COMPREPLY=( $(compgen -W 'af1{1..4} af2{2..3} af3{1..3} af4{1..3} + cs{0..7} ef lowdelay throughput reliability' -- "$cur") ) ;; - Tunnel) - COMPREPLY=( $( compgen -W 'yes no point-to-point ethernet' \ - -- "$cur" ) ) + hostbasedkeytypes|hostkeyalgorithms) + COMPREPLY=( $(compgen -W '$(_ssh_query "$2" key)' -- "$cur") ) ;; - PreferredAuthentications) - COMPREPLY=( $( compgen -W 'gssapi-with-mic host-based publickey - keyboard-interactive password' -- "$cur" ) ) + kexalgorithms) + COMPREPLY=( $(compgen -W '$(_ssh_query "$2" kex)' -- "$cur") ) ;; - MACs) + macs) _ssh_macs "$2" ;; - Ciphers) - _ssh_ciphers "$2" + preferredauthentications) + COMPREPLY=( $(compgen -W 'gssapi-with-mic host-based publickey + keyboard-interactive password' -- "$cur") ) + ;; + protocol) + local protocols=( $(_ssh_query "$2" protocol-version) ) + [[ $protocols ]] || protocols=(1 2) + if [[ ${#protocols[@]} -gt 1 ]]; then + COMPREPLY=( $(compgen -W '${protocols[@]}' -- "$cur") ) + fi + ;; + proxyjump) + _known_hosts_real -a -F "$configfile" -- "$cur" + ;; + pubkeyacceptedkeytypes) + COMPREPLY=( $(compgen -W '$(_ssh_query "$2" key)' -- "$cur") ) + ;; + requesttty) + COMPREPLY=( $(compgen -W 'no yes force auto' -- "$cur") ) + ;; + syslogfacility) + COMPREPLY=( $(compgen -W 'DAEMON USER AUTH LOCAL{0..7}' -- "$cur") ) + ;; + tunnel) + COMPREPLY=( $(compgen -W 'yes no point-to-point ethernet' \ + -- "$cur") ) + ;; + updatehostkeys) + COMPREPLY=( $(compgen -W 'yes no ask' -- "$cur") ) ;; esac return 0 @@ -130,7 +177,7 @@ _ssh_suboption_check() { # Get prev and cur words without splitting on = local cureq=`_get_cword :=` preveq=`_get_pword :=` - if [[ $cureq == *=* && $preveq == -o ]]; then + if [[ $cureq == *=* && $preveq == -*o ]]; then _ssh_suboption $cureq "$1" return $? fi @@ -170,55 +217,58 @@ _ssh() local ipvx case $prev in - -F|-i|-S) - _filedir - return + -*4*) + ipvx=-4 ;; - -I) - _filedir so + -*6*) + ipvx=-6 + ;; + -*b) + _ip_addresses return ;; - -c) + -*c) _ssh_ciphers "$1" return ;; - -J) - _known_hosts_real -a -F "$configfile" -- "$cur" + -*[DeLpRW]) return ;; - -m) - _ssh_macs "$1" + -*[EFiS]) + _filedir return ;; - -l) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + -*I) + _filedir so return ;; - -O) - COMPREPLY=( $( compgen -W 'check forward exit stop' -- "$cur" ) ) + -*J) + _known_hosts_real -a -F "$configfile" -- "$cur" return ;; - -o) - _ssh_options + -*l) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -Q) - _ssh_queries "$1" + -*m) + _ssh_macs "$1" return ;; - -w) - _available_interfaces + -*O) + COMPREPLY=( $(compgen -W 'check forward exit stop' -- "$cur") ) return ;; - -b) - _ip_addresses + -*o) + _ssh_options "$1" return ;; - -D|-e|-L|-p|-R|-W) + -*Q) + _ssh_queries "$1" return ;; - -4|-6) - ipvx=$prev + -*w) + _available_interfaces + return ;; esac @@ -229,7 +279,7 @@ _ssh() COMPREPLY=( "${COMPREPLY[@]/#/-F}" ) cur=-F$cur # Restore cur elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real $ipvx -a -F "$configfile" -- "$cur" @@ -237,7 +287,7 @@ _ssh() _count_args if [[ $args -gt 1 ]]; then compopt -o filenames - COMPREPLY+=( $( compgen -c -- "$cur" ) ) + COMPREPLY+=( $(compgen -c -- "$cur") ) fi fi } && @@ -258,28 +308,31 @@ _sftp() local ipvx case $prev in - -b|-F|-i) - _filedir + -*4*) + ipvx=-4 + ;; + -*6*) + ipvx=-6 + ;; + -*[BDlPRs]) return ;; - -o) - _ssh_options + -*[bFi]) + _filedir return ;; - -c) + -*c) _ssh_ciphers return ;; - -S) - _command + -*o) + _ssh_options return ;; - -B|-D|-l|-P|-R|-s) + -*S) + _command return ;; - -4|-6) - ipvx=$prev - ;; esac if [[ "$cur" == -F* ]]; then @@ -289,7 +342,7 @@ _sftp() COMPREPLY=( "${COMPREPLY[@]/#/-F}" ) cur=-F$cur # Restore cur elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real $ipvx -a -F "$configfile" -- "$cur" fi @@ -312,7 +365,7 @@ _scp_remote_files() local path=${cur#*:} # unescape (3 backslashes to 1 for chars we escaped) - path=$( command 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 @@ -322,16 +375,16 @@ _scp_remote_files() local files if [[ $1 == -d ]]; then # escape problematic characters; remove non-dirs - files=$( ssh -o 'Batchmode yes' $userhost \ + files=$(ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | \ - command 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 \ + files=$(ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | \ command sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \ - -e 's/[^\/]$/& /g' ) + -e 's/[^\/]$/& /g') fi COMPREPLY+=( $files ) } @@ -351,10 +404,10 @@ _scp_local_files() fi if $dirsonly ; then - COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ + COMPREPLY+=( $(command ls -aF1dL $cur* 2>/dev/null | \ command sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") ) else - COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ + COMPREPLY+=( $(command ls -aF1dL $cur* 2>/dev/null | \ command sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' -e "s/^/$1/") ) fi @@ -378,31 +431,34 @@ _scp() local ipvx case $prev in - -l|-P) + -*4*) + ipvx=-4 + ;; + -*6*) + ipvx=-6 + ;; + -*c) + _ssh_ciphers + COMPREPLY=( "${COMPREPLY[@]/%/ }" ) return ;; - -F|-i) + -*[Fi]) _filedir compopt +o nospace return ;; - -c) - _ssh_ciphers - COMPREPLY=( "${COMPREPLY[@]/%/ }" ) + -*[lP]) return ;; - -o) + -*o) _ssh_options return ;; - -S) + -*S) _command compopt +o nospace return ;; - -4|-6) - ipvx=$prev - ;; esac _expand || return @@ -420,8 +476,8 @@ _scp() else case $cur in -*) - COMPREPLY=( $( compgen -W '$( _parse_usage "${words[0]}" )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "${words[0]}")' \ + -- "$cur") ) COMPREPLY=( "${COMPREPLY[@]/%/ }" ) return ;; diff --git a/completions/ssh-add b/completions/ssh-add index 4d47c0d0..d9157893 100644 --- a/completions/ssh-add +++ b/completions/ssh-add @@ -6,17 +6,17 @@ _ssh_add() _init_completion || return case $prev in - -t) + -*[tE]) return ;; - -s|-e) + -*[se]) _filedir so return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" "-\?" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" "-\?")' -- "$cur") ) return fi diff --git a/completions/ssh-copy-id b/completions/ssh-copy-id index 1e81172c..cb4cf920 100644 --- a/completions/ssh-copy-id +++ b/completions/ssh-copy-id @@ -5,15 +5,24 @@ _ssh_copy_id() local cur prev words cword _init_completion || return + _xfunc ssh _ssh_suboption_check "$1" && return + case $prev in -i) _filedir pub return ;; + -p) + return + ;; + -o) + _xfunc ssh _ssh_options + return + ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) else _known_hosts_real -a -- "$cur" fi diff --git a/completions/ssh-keygen b/completions/ssh-keygen index d1eafa9e..5c449fc0 100644 --- a/completions/ssh-keygen +++ b/completions/ssh-keygen @@ -6,51 +6,51 @@ _ssh_keygen() _init_completion -n = || return case $prev in - -a|-b|-C|-I|-J|-j|-M|-N|-n|-r|-P|-S|-V|-W|-z) + -*[abCIJjMNnrPSVWz]) return ;; - -E) - COMPREPLY=( $( compgen -W 'md5 sha256' -- "$cur" ) ) + -*E) + COMPREPLY=( $(compgen -W 'md5 sha256' -- "$cur") ) return ;; - -F|-R) + -*[FR]) # TODO: trim this down to actual entries in known hosts files _known_hosts_real -- "$cur" return ;; - -D) + -*D) _filedir so return ;; - -f|-G|-K|-s|-T) + -*[fGKsT]) _filedir return ;; - -m) - COMPREPLY=( $( compgen -W 'PEM PKCS8 RFC4716' -- "$cur" ) ) + -*m) + COMPREPLY=( $(compgen -W 'PEM PKCS8 RFC4716' -- "$cur") ) return ;; - -O) + -*O) if [[ $cur != *=* ]]; then - COMPREPLY=( $( compgen -W 'clear force-command= + 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" ) ) + permit-x11-forwarding source-address=' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi return ;; - -t) - COMPREPLY=( $( compgen -W 'dsa ecdsa ed25519 rsa rsa1' -- "$cur" ) ) + -*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" ) ) + 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 diff --git a/completions/sshmitm b/completions/sshmitm index 192835c0..8b320fa8 100644 --- a/completions/sshmitm +++ b/completions/sshmitm @@ -6,7 +6,7 @@ _sshmitm() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/sshow b/completions/sshow index 8c3cdc4c..e9ea9c2d 100644 --- a/completions/sshow +++ b/completions/sshow @@ -6,14 +6,18 @@ _sshow() _init_completion || return case $prev in - -i) + -*i) _available_interfaces -a return ;; + -*p) + _filedir pcap + return + ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/strace b/completions/strace index eae169b4..339780b6 100644 --- a/completions/strace +++ b/completions/strace @@ -10,7 +10,7 @@ _strace() for (( i=1; i <= cword; i++ )); do case ${words[$i]} in -o|-e|-p) - i=$((i+1)) + (( i++ )) continue ;; -*) @@ -26,7 +26,7 @@ _strace() else case $prev in - -e) + -*e) if [[ "$cur" == *=* ]]; then prev=${cur/=*/} cur=${cur/*=/} @@ -41,9 +41,9 @@ _strace() [[ $define == "#define" && \ $syscall =~ ^__NR_(.+) ]] && \ syscalls[${BASH_REMATCH[1]}]=1 - done 2>/dev/null < /usr/include/asm/unistd.h + done 2>/dev/null </usr/include/asm/unistd.h if [[ ! $syscalls ]]; then - local unistd arch=$( command uname -m ) + local unistd arch=$(command uname -m) if [[ "$arch" == *86 ]]; then unistd=/usr/include/asm/unistd_32.h else @@ -53,46 +53,44 @@ _strace() [[ $define == "#define" && \ $syscall =~ ^__NR_(.+) ]] && \ syscalls[${BASH_REMATCH[1]}]=1 - done 2>/dev/null < $unistd + done 2>/dev/null <$unistd fi - COMPREPLY=( $( compgen -W '${!syscalls[@]} file + COMPREPLY=( $(compgen -W '${!syscalls[@]} file process network signal ipc desc all none' \ - -- "$cur" ) ) + -- "$cur") ) return ;; esac else compopt -o nospace - COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw - signal read write' -- "$cur" ) ) + COMPREPLY=( $(compgen -S"=" -W 'trace abbrev verbose raw + signal read write' -- "$cur") ) fi return ;; - -o) + -*o) _filedir return ;; - -p) + -*p) _pids return ;; - -S) - COMPREPLY=( $( compgen -W 'time calls name nothing' \ - -- "$cur" ) ) + -*S) + COMPREPLY=( $(compgen -W 'time calls name nothing' -- "$cur") ) return ;; - -u) + -*u) _allowed_users return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c -d -f -ff -F --help -i -q -r -t -tt - -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) else - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) fi fi } && diff --git a/completions/strings b/completions/strings index 27c00497..b4e13ab6 100644 --- a/completions/strings +++ b/completions/strings @@ -6,20 +6,21 @@ _strings() _init_completion -s || return case $prev in - -h|--help|-v|-V|--version|-n|--bytes) + --help|--version|--bytes|-!(-*)[hvVn]) return ;; - -t|--radix) - COMPREPLY=( $( compgen -W 'o d x' -- "$cur" ) ) + --radix|-!(-*)t) + COMPREPLY=( $(compgen -W 'o d x' -- "$cur") ) return ;; - -T|--target) - COMPREPLY=( $( compgen -W '$( LC_ALL=C "$1" --help 2>/dev/null | \ - command sed -ne "s/: supported targets: \(.*\)/\1/p" )' -- "$cur" ) ) + --target|-!(-*)T) + COMPREPLY=( $(compgen -W '$(LC_ALL=C "$1" --help 2>/dev/null | \ + command sed -ne "s/: supported targets: \(.*\)/\1/p")' \ + -- "$cur") ) return ;; - -e|--encoding) - COMPREPLY=( $( compgen -W 's S b l B L' -- "$cur" ) ) + --encoding|-!(-*)e) + COMPREPLY=( $(compgen -W 's S b l B L' -- "$cur") ) return ;; esac @@ -27,7 +28,7 @@ _strings() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return elif [[ $cur == @* ]]; then diff --git a/completions/sudo b/completions/sudo index 2fe1c001..1b8e508f 100644 --- a/completions/sudo +++ b/completions/sudo @@ -2,45 +2,49 @@ _sudo() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return local i mode=normal [[ $1 == *sudoedit ]] && mode=edit [[ $mode == normal ]] && - for (( i=1; i <= COMP_CWORD; i++ )); do - if [[ ${COMP_WORDS[i]} != -* ]]; then + for (( i=1; i <= cword; i++ )); do + if [[ ${words[i]} != -* ]]; then local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin - local root_command=${COMP_WORDS[i]} + local root_command=${words[i]} _command_offset $i return fi - if [[ ${COMP_WORDS[i]} == -e ]]; then + if [[ ${words[i]} == -@(!(-*)e*|-edit) ]]; then mode=edit break fi - [[ ${COMP_WORDS[i]} == -[uUgCp] ]] && ((i++)) + [[ ${words[i]} == \ + -@(user|other-user|group|close-from|prompt|!(-*)[uUgCp]) ]] \ + && ((i++)) done case "$prev" in - -u|-U) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + --user|--other-user|-!(-*)[uU]) + COMPREPLY=( $(compgen -u -- "$cur") ) return ;; - -g) - COMPREPLY=( $( compgen -g -- "$cur" ) ) + --group|-!(-*)g) + COMPREPLY=( $(compgen -g -- "$cur") ) return ;; - -C|-p) - # argument required but no completions available + --close-from|--prompt|-!(-*)[Cp]) return ;; esac + $split && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A -b -C -E -e -g -H -h -i -K -k -L -l -ll - -n -P -p -S -s -U -u -V -v' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi if [[ $mode == edit ]]; then diff --git a/completions/svk b/completions/svk index d78d3557..f94356e1 100644 --- a/completions/svk +++ b/completions/svk @@ -14,11 +14,11 @@ _svk() propget pg pget proplist pl plist propset ps pset pull push resolved revert smerge sm status st stat switch sw sync sy update up verify' - if [[ $cword -eq 1 ]] ; then + if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--version' -- "$cur") ) else - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands" -- "$cur") ) fi else case $prev in @@ -27,8 +27,7 @@ _svk() return ;; --encoding) - COMPREPLY=( $( compgen -W \ - '$( iconv --list | command sed -e "s@//@@;" )' -- "$cur" ) ) + _xfunc iconv _iconv_charsets return ;; esac @@ -173,26 +172,26 @@ _svk() esac options+=" --help -h" - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$options" -- "$cur") ) else case $command in help|h|\?) - COMPREPLY=( $( compgen -W "$commands environment commands - intro" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$commands environment commands + intro" -- "$cur") ) ;; admin) - COMPREPLY=( $( compgen -W 'help deltify dump hotcopy + COMPREPLY=( $(compgen -W 'help deltify dump hotcopy list-dblogs list-unused-dblogs load lstxns recover - rmtxns setlog verify rmcache' -- "$cur" ) ) + rmtxns setlog verify rmcache' -- "$cur") ) ;; patch) - COMPREPLY=( $( compgen -W '--ls --list --cat --view + COMPREPLY=( $(compgen -W '--ls --list --cat --view --regen --regenerate --up --update --apply --rm - --delete' -- "$cur" ) ) + --delete' -- "$cur") ) ;; sync) - COMPREPLY=( $( compgen -W "$( $1 mirror --list \ - 2>/dev/null | awk '/^\//{print $1}' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 mirror --list \ + 2>/dev/null | awk '/^\//{print $1}')" -- "$cur") ) ;; co|checkout|push|pull) if [[ "$cur" == //*/* ]]; then @@ -200,8 +199,8 @@ _svk() else path=// fi - COMPREPLY=( $( compgen -W "$( $1 list $path 2>/dev/null | \ - command sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 list $path 2>/dev/null | \ + command sed -e 's|\(.*\)|'$path'\1|')" -- "$cur") ) ;; *) _filedir diff --git a/completions/sync_members b/completions/sync_members index 2fe50eaf..653c0ea9 100644 --- a/completions/sync_members +++ b/completions/sync_members @@ -7,7 +7,7 @@ _sync_members() case $prev in -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) return ;; -d|--file) @@ -19,8 +19,8 @@ _sync_members() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--no-change --welcome-msg --goodbye-msg - --digest --notifyadmin --file --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--no-change --welcome-msg --goodbye-msg + --digest --notifyadmin --file --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/synclient b/completions/synclient index b7ebf026..e7371cb7 100644 --- a/completions/synclient +++ b/completions/synclient @@ -2,7 +2,7 @@ _synclient() { - local cur prev words cword split + local cur prev words cword _init_completion -n = || return case $prev in @@ -12,10 +12,10 @@ _synclient() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) elif [[ $cur != *=?* ]]; then - COMPREPLY=( $( compgen -S = -W '$( $1 -l 2>/dev/null | \ - awk "/^[ \t]/ { print \$1 }" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -S = -W '$($1 -l 2>/dev/null | \ + awk "/^[ \t]/ { print \$1 }")' -- "$cur") ) compopt -o nospace fi } && diff --git a/completions/sysbench b/completions/sysbench index 3d2b7b1e..fc942048 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -11,80 +11,79 @@ _sysbench() return ;; --init-rng|--debug|--validate) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; --test) - COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'fileio cpu memory threads mutex oltp' \ + -- "$cur") ) return ;; --cpu-max-prime) return ;; --file-test-mode) - COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ + -- "$cur") ) return ;; --file-io-mode) - COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'sync async fastmmap slowmmap' -- "$cur") ) return ;; --file-extra-flags) - COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'sync dsync direct' -- "$cur") ) return ;; --file-fsync-all|--file-fsync-end) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; --file-fsync-mode) - COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'fsync fdatasync' -- "$cur") ) return ;; --memory-scope) - COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'global local' -- "$cur") ) return ;; --memory-hugetlb) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; --memory-oper) - COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'read write none' -- "$cur") ) return ;; --memory-access-mode) - COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'seq rnd' -- "$cur") ) return ;; --oltp-test-mode) - COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'simple complex nontrx sp' -- "$cur") ) return ;; --oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; --oltp-nontrx-mode) - COMPREPLY=( $( compgen -W 'select update_key update_nokey insert - delete' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'select update_key update_nokey insert + delete' -- "$cur") ) return ;; --oltp-dist-type) - COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'uniform gaussian special' -- "$cur") ) return ;; --db-driver) - COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null | + COMPREPLY=( $(compgen -W "$($1 --test=oltp help 2>/dev/null | command sed -e '/^.*database drivers:/,/^$/!d' \ - -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) ) + -ne 's/^ *\([^ ]*\) .*/\1/p')" -- "$cur") ) return ;; --db-ps-mode) - COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'auto disable' -- "$cur") ) return ;; --mysql-socket) @@ -92,12 +91,12 @@ _sysbench() return ;; --mysql-table-engine) - COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster - federated' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'myisam innodb bdb heap ndbcluster + federated' -- "$cur") ) return ;; --mysql-engine-trx) - COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'yes no auto' -- "$cur") ) return ;; --*) @@ -114,18 +113,17 @@ _sysbench() fi done - local opts=$( _parse_help "$1" ) + local opts=$(_parse_help "$1") if [[ $test ]]; then - local help=( $( _parse_help "$1" "--test=$test help" ) ) + local help=( $(_parse_help "$1" "--test=$test help") ) opts="${opts[@]/--test=/} ${help[@]} prepare run cleanup help version" fi if [[ "$cur" == -* || ! $test ]]; then - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W "prepare run cleanup help version" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "prepare run cleanup help version" -- "$cur") ) fi } && complete -F _sysbench sysbench diff --git a/completions/sysctl b/completions/sysctl index 8216f989..e683977b 100644 --- a/completions/sysctl +++ b/completions/sysctl @@ -6,24 +6,23 @@ _sysctl() _init_completion || return case $prev in - --help|--version) + --help|--version|--pattern|-!(-*)[hVr]) return ;; - -p) + --load|-!(-*)[pf]) _filedir conf return ;; esac if [[ $cur == -* ]]; then - local opts="$( _parse_help "$1" )" - [[ $opts ]] || opts="$( _parse_usage "$1" )" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts="$(_parse_help "$1")" + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) else local suffix= - [[ $prev == -w ]] && suffix== - COMPREPLY=( $( compgen -S "$suffix" -W \ - "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) ) + [[ $prev == -w ]] && suffix="=" + COMPREPLY=( $(compgen -S "$suffix" -W \ + "$(PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null)" -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/tar b/completions/tar index 2886f745..2ed98e78 100644 --- a/completions/tar +++ b/completions/tar @@ -57,7 +57,7 @@ __gtar_parse_help_opt() separator= ;; *) - echo >&2 "not an option $opt" + echo "bash_completion: $FUNCNAME: unknown option $opt" >&2 return 1 ;; esac @@ -136,11 +136,11 @@ __gnu_tar_parse_help() __gtar_parse_warnings() { local line - while IFS= read line; do + LC_ALL=C tar --warning= 2>&1 | 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)" + done } @@ -313,7 +313,7 @@ __tar_complete_mode() generated+=" $cur$c" done - COMPREPLY=( $( compgen -W "$generated" ) ) + COMPREPLY=( $(compgen -W "$generated") ) return 0 } @@ -322,7 +322,7 @@ __tar_complete_mode() __gtar_complete_lopts() { local rv - COMPREPLY=( $( compgen -W "$long_opts" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$long_opts" -- "$cur") ) rv=$? [[ $COMPREPLY == *= ]] && compopt -o nospace return $rv @@ -341,7 +341,7 @@ __gtar_complete_sopts() generated+=" $cur$c" done - COMPREPLY=( $( compgen -W "$generated" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$generated" -- "$cur") ) } @@ -426,16 +426,16 @@ __tar_try_list_archive() __tar_cleanup_prev() { if [[ "$prev" =~ ^-[a-zA-Z0-9?]*$ ]]; then - # transformate '-caf' ~> '-f' + # transform '-caf' ~> '-f' prev="-$(__tar_last_char "$prev")" fi } __tar_detect_ext() { - local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)))|t@([abglx]z|b?(z)2))' + local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)|zst))|t@([abglx]z|b?(z)2|zst))' ext="$tars" - regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' + regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\|zst\)\)\?\|t\([abglx]z\|bz\?2\|zst\)\)' case "$tar_mode_arg" in --*) @@ -452,8 +452,7 @@ __tar_detect_ext() esac ;; +([^ZzJjy])f) - ext="$tars" - regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' + # Pass through using defaults above ;; *[Zz]*f) ext='@(@(t?(ar.)|gem.|spkg.)@(gz|Z)|taz)' @@ -513,53 +512,53 @@ _gtar() # 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) + --directory|-!(-*)C) _filedir -d break ;; --atime-preserve) - COMPREPLY=( $( compgen -W 'replace system' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'replace system' -- "$cur") ) break ;; --group) - COMPREPLY=( $( compgen -g -- "$cur" ) ) + COMPREPLY=( $(compgen -g -- "$cur") ) break ;; --owner) - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) break ;; - -F|--info-script|--new-volume-script|--rmt-command|--rsh-command|\ - -I|--use-compress-program) + --info-script|--new-volume-script|--rmt-command|--rsh-command|\ + --use-compress-program|-!(-*)[FI]) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) break ;; - --volno-file|--add-file|-T|--files-from|-X|--exclude-from|\ - --index-file|--listed-incremental|-g) + --volno-file|--add-file|--files-from|--exclude-from|\ + --index-file|--listed-incremental|-!(-*)[TXg]) _filedir break ;; - -H|--format) - COMPREPLY=( $( compgen -W 'gnu oldgnu pax posix ustar v7' \ - -- "$cur" ) ) + --format|-!(-*)H) + 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" ) ) + 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" ) ) + COMPREPLY=( $(compgen -W 'SIGHUP SIGQUIT SIGINT SIGUSR1 SIGUSR2' \ + -- "$cur") ) break ;; --warning) - COMPREPLY=( $( compgen -W "$(__gtar_parse_warnings)" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(__gtar_parse_warnings)" -- "$cur") ) break ;; - --file|-f|-!(-*)f) + --file|-!(-*)f) __tar_file_option "$ext" break ;; @@ -579,7 +578,7 @@ _gtar() # Most probably, when code goes here, the PREV variable contains # some string from "$long_arg_none" and we want continue. ;; - -[a-zA-Z0-9?]) + -!(-*)[a-zA-Z0-9?]) # argument required but no completion yet [[ "$short_arg_req" =~ ${prev##-} ]] && break ;; @@ -695,7 +694,7 @@ _posix_tar() _tar() { local cmd=${COMP_WORDS[0]} func line - read line <<<"$($cmd --version 2>/dev/null)" + line="$($cmd --version 2>/dev/null)" case "$line" in *GNU*) func=_gtar diff --git a/completions/tcpdump b/completions/tcpdump index 44b0afa7..d93c8795 100644 --- a/completions/tcpdump +++ b/completions/tcpdump @@ -2,43 +2,60 @@ _tcpdump() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return case $prev in - -r|-w|-F) + -!(-*)[rwFV]) _filedir return ;; - -i) + --interface|-!(-*)i) _available_interfaces -a return ;; - -m) + -!(-*)m) _filedir mib return ;; - -T) - COMPREPLY=( $( compgen -W 'aodv cnfp rpc rtp rtcp snmp tftp vat - wb' -- "$cur" ) ) + -!(-*)T) + COMPREPLY=( $(compgen -W 'aodv carp cnfp lmp pgm pgm_zmtp1 radius + resp rpc rtcp rtp rtcp snmp tftp vat vxlan wb zmtp1' \ + -- "$cur") ) return ;; - -z) + -!(-*)z) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; - -Z) + --relinquish-privileges|-!(-*)Z) _allowed_users return ;; - -B|-c|-C|-D|-E|-G|-M|-s|-W|-y) + -!(-*)[BcCDEGMsWy]) + return + ;; + --time-stamp-type|-!(-*)j) + COMPREPLY=( $(compgen -W 'host host_lowprec host_hiprec adapter + adapter_unsynced' -- "$cur") ) + return + ;; + --direction|-!(-*)Q) + COMPREPLY=( $(compgen -W 'in out inout' -- "$cur") ) + return + ;; + --time-stamp-precision) + COMPREPLY=( $(compgen -W 'micro nano' -- "$cur") ) return ;; esac + $split && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) + [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/tcpkill b/completions/tcpkill index a25fedae..200cfc38 100644 --- a/completions/tcpkill +++ b/completions/tcpkill @@ -6,14 +6,14 @@ _tcpkill() _init_completion || return case $prev in - -i) + -*i) _available_interfaces -a return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur") ) fi } && diff --git a/completions/tcpnice b/completions/tcpnice index 9fdae9ba..0302d46d 100644 --- a/completions/tcpnice +++ b/completions/tcpnice @@ -6,14 +6,14 @@ _tcpnice() _init_completion || return case $prev in - -i) + -*i) _available_interfaces -a return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/timeout b/completions/timeout index ccc66ae7..b5851baa 100644 --- a/completions/timeout +++ b/completions/timeout @@ -13,14 +13,14 @@ _timeout() fi found=true fi - [[ ${COMP_WORDS[i]} == -@(k|-kill-after|s|-signal) ]] && ((i++)) + [[ ${COMP_WORDS[i]} == -@(-kill-after|-signal|!(-*)[ks]) ]] && ((i++)) done case $prev in - --help|--version|-k|--kill-after) + --help|--version|--kill-after|-!(-*)k) return ;; - -s|--signal) + --signal|-!(-*)s) _signals return ;; @@ -29,7 +29,7 @@ _timeout() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && diff --git a/completions/tipc b/completions/tipc index 3523a295..d85f5e9c 100644 --- a/completions/tipc +++ b/completions/tipc @@ -4,10 +4,10 @@ _tipc_media() { local optind=$1 if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'media' -- $cur) ) + COMPREPLY=( $(compgen -W 'media' -- $cur) ) return 0 elif [[ $cword -eq $optind+1 ]]; then - COMPREPLY=( $( compgen -W 'udp eth ib' -- $cur) ) + COMPREPLY=( $(compgen -W 'udp eth ib' -- $cur) ) return 0 fi @@ -31,28 +31,28 @@ _tipc_bearer() { if [[ $cword -eq $optind+2 ]]; then case "$media" in "udp") - COMPREPLY=( $( compgen -W 'name' -- $cur) ) + COMPREPLY=( $(compgen -W 'name' -- $cur) ) ;; "eth" | "ib") - COMPREPLY=( $( compgen -W 'device' -- $cur) ) + 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) ) + COMPREPLY=( $(compgen -W '$names' -- $cur) ) ;; "eth") local interfaces=$(command ls /sys/class/net/) - COMPREPLY=( $( compgen -W '$interfaces' -- $cur ) ) + COMPREPLY=( $(compgen -W '$interfaces' -- $cur) ) ;; esac fi } _tipc_link_opts() { - COMPREPLY=( $( compgen -W 'priority tolerance window' -- $cur) ) + COMPREPLY=( $(compgen -W 'priority tolerance window' -- $cur) ) } _tipc_link() { @@ -60,7 +60,7 @@ _tipc_link() { local filter=$2 if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'link' -- $cur) ) + 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 | \ @@ -68,7 +68,7 @@ _tipc_link() { if [[ $filter == "peers" ]]; then links=$(command sed '/broadcast-link/d' <<<"$links") fi - COMPREPLY=( $( compgen -W '$links' -- $cur ) ) + COMPREPLY=( $(compgen -W '$links' -- $cur) ) fi } @@ -83,29 +83,29 @@ _tipc() # Flags can be placed anywhere in the commandline case "$cur" in -*) - COMPREPLY=( $( compgen -W '-h --help' -- $cur ) ) + COMPREPLY=( $(compgen -W '-h --help' -- $cur) ) return ;; esac if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'bearer link media nametable node socket' -- $cur ) ) + COMPREPLY=( $(compgen -W 'bearer link media nametable node socket' -- $cur) ) return fi case "${words[$optind]}" in bearer) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'enable disable set get list' -- $cur ) ) + COMPREPLY=( $(compgen -W 'enable disable set get list' -- $cur) ) return fi case "${words[$optind]}" in enable) local media params - let optind++ + (( optind++ )) if [[ $cword -lt $optind+4 ]]; then _tipc_bearer $optind @@ -133,30 +133,30 @@ _tipc() # 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 + 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 + 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) ) + COMPREPLY=( $(compgen -W '${params[@]}' -- $cur) ) ;; disable) - let optind++ + (( optind++ )) _tipc_bearer $optind ;; get) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -165,7 +165,7 @@ _tipc() fi ;; set) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -176,16 +176,16 @@ _tipc() esac ;; link) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'get set list statistics' -- $cur ) ) + COMPREPLY=( $(compgen -W 'get set list statistics' -- $cur) ) return fi case "${words[$optind]}" in get) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -194,7 +194,7 @@ _tipc() fi ;; set) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -203,10 +203,10 @@ _tipc() fi ;; statistics) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'show reset' -- $cur) ) + COMPREPLY=( $(compgen -W 'show reset' -- $cur) ) return fi @@ -219,16 +219,16 @@ _tipc() esac ;; media) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'get set list' -- $cur ) ) + COMPREPLY=( $(compgen -W 'get set list' -- $cur) ) return fi case "${words[$optind]}" in get) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -237,7 +237,7 @@ _tipc() fi ;; set) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then _tipc_link_opts @@ -248,34 +248,34 @@ _tipc() esac ;; nametable) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'show' -- $cur ) ) + COMPREPLY=( $(compgen -W 'show' -- $cur) ) fi ;; node) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'list get set' -- $cur ) ) + COMPREPLY=( $(compgen -W 'list get set' -- $cur) ) return fi case "${words[$optind]}" in get|set) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'address netid' -- $cur ) ) + COMPREPLY=( $(compgen -W 'address netid' -- $cur) ) fi esac ;; socket) - let optind++ + (( optind++ )) if [[ $cword -eq $optind ]]; then - COMPREPLY=( $( compgen -W 'list' -- $cur ) ) + COMPREPLY=( $(compgen -W 'list' -- $cur) ) fi ;; esac diff --git a/completions/tox b/completions/tox index 5812fcbf..a6418aca 100644 --- a/completions/tox +++ b/completions/tox @@ -6,10 +6,10 @@ _tox() _init_completion || return case $prev in - -h|--help|--version|-n|--num|-i|--index-url|--hashseed|--force-dep) + --help|--version|--num|--index-url|--hashseed|--force-dep|-!(-*)[hni]) return ;; - -c) + -!(-*)c) _filedir ini return ;; @@ -17,18 +17,21 @@ _tox() _filedir return ;; - -e) - local envs=$( "$1" --listenvs-all 2>/dev/null ) + -!(-*)e) + local envs=$( + { "$1" --listenvs-all || "$1" --listenvs; } 2>/dev/null ) local prefix=""; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -W "$envs ALL" -- "${cur##*,}" ) ) + COMPREPLY=( $(compgen -W "$envs ALL" -- "${cur##*,}") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi } && complete -F _tox tox + +# ex: filetype=sh diff --git a/completions/tracepath b/completions/tracepath index bd2f3ea3..29dec3e8 100644 --- a/completions/tracepath +++ b/completions/tracepath @@ -6,13 +6,14 @@ _tracepath() _init_completion || return case $prev in - -l) + -*[lmp]) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + local opts=$(_parse_help "$1") + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) return fi diff --git a/completions/tshark b/completions/tshark index bd795c24..2f18d0a3 100644 --- a/completions/tshark +++ b/completions/tshark @@ -2,18 +2,46 @@ _tshark() { - local cur prev words cword + local cur prev words cword prefix _init_completion -n : || return - case $prev in - -f|-s|-B|-D|-L|-c|-R|-N|-d|-C|-e|-E|-z|-h|-v|-o|-K) + case $cur in + -o*) + prefix=-o + ;; + -X*) + prefix=-X + ;; + esac + + case ${prefix:-$prev} in + --*) + # Fallback to completion of long options below. + ;; + -o*) + if [[ $cur == *:* ]]; then + cur=${cur#*:} + _filedir + else + [ -n "$_tshark_prefs" ] || + _tshark_prefs="$("$1" -G defaultprefs 2>/dev/null | command\ + sed -ne 's/^#\{0,1\}\([a-z0-9_.-]\{1,\}:\).*/\1/p' | + tr '\n' ' ')" + COMPREPLY=( $(compgen -P "$prefix" -W "$_tshark_prefs" \ + -- "${cur:${#prefix}}") ) + [[ $COMPREPLY == *: ]] && compopt -o nospace + fi + return + ;; + -*[fsBDLcRNdCeEzhvoK]) return ;; - -i) - _available_interfaces -a + -*i) + COMPREPLY=( $(compgen -W \ + "$("$1" -D 2>/dev/null | awk '{print $2}')" -- "$cur") ) return ;; - -y) + -*y) local opts i for (( i=${#words[@]}-1; i > 0; i-- )); do if [[ ${words[i]} == -i ]]; then @@ -21,82 +49,87 @@ _tshark() break fi done - COMPREPLY=( $( compgen -W "$( "$1" $opts -L 2>&1 | \ - awk '/^ / { print $1 }' )" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$("$1" $opts -L 2>/dev/null | \ + awk '/^ / { print $1 }')" -- "$cur") ) return ;; - -a|-b) - COMPREPLY=( $( compgen -W 'duration: filesize: files:' \ - -- "$cur" ) ) + -*[ab]) + COMPREPLY=( $(compgen -W 'duration: filesize: files:' -- "$cur") ) [[ $COMPREPLY == *: ]] && compopt -o nospace return ;; - -r) - _filedir pcap + -*r) + _filedir '@(pcap?(ng)|cap)?(.gz)' return ;; - -H) + -*H) _filedir return ;; - -w) + -*w) _filedir [[ $cur == @(|-) ]] && COMPREPLY+=( - ) return ;; - -F) - COMPREPLY=( $( compgen -W "$( "$1" -F 2>&1 | \ - awk '/^ / { print $1 }' )" -- "$cur" ) ) + -*F) + COMPREPLY=( $(compgen -W "$("$1" -F 2>&1 | \ + awk '/^ / { print $1 }')" -- "$cur") ) return ;; - -O) + -*O) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -W "$( "$1" -G protocols 2>&1 | cut -f 3 )" \ - -- "${cur##*,}" ) ) + [ -n "$_tshark_protocols" ] || + _tshark_protocols="$("$1" -G protocols 2>/dev/null | + cut -f 3 | tr '\n' ' ')" + COMPREPLY=( $(compgen -W "$_tshark_protocols" -- "${cur##*,}") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; - -T) - # TODO: could be parsed from "-T ." output - COMPREPLY=( $( compgen -W 'ps text pdml psml fields' -- "$cur" ) ) + -*T) + # Parse from: tshark -T . 2>&1 | awk -F \" '/^\t*"/ { print $2 }' + COMPREPLY=( $(compgen -W \ + 'pdml ps psml json jsonraw ek tabs text fields' -- "$cur") ) return ;; - -t) - # TODO: could be parsed from "-t ." output - COMPREPLY=( $( compgen -W 'ad a r d dd e' -- "$cur" ) ) + -*t) + # Parse from: tshark -t . 2>&1 | awk -F \" '/^\t*"/ { print $2 }' + COMPREPLY=( $(compgen -W \ + 'a ad adoy d dd e r u ud udoy' -- "$cur") ) return ;; - -u) + -*u) # TODO: could be parsed from "-u ." output - COMPREPLY=( $( compgen -W 's hms' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 's hms' -- "$cur") ) return ;; - -W) - COMPREPLY=( $( compgen -W 'n' -- "$cur" ) ) + -*W) + COMPREPLY=( $(compgen -W 'n' -- "$cur") ) return ;; - -X) - if [[ $cur == lua_script:* ]]; then + -*X) + if [[ ${cur:${#prefix}} == lua_script:* ]]; then cur=${cur#*:} _filedir lua else - COMPREPLY=( $( compgen -W 'lua_script:' -- "$cur" ) ) + COMPREPLY=( $(compgen -P "$prefix" -W 'lua_script:' -- \ + "${cur:${#prefix}}") ) [[ $COMPREPLY == *: ]] && compopt -o nospace fi return ;; - -G) - COMPREPLY=( $( compgen -W "$( "$1" -G ? 2>/dev/null | \ + -*G) + COMPREPLY=( $(compgen -W "$("$1" -G \? 2>/dev/null | \ awk '/^[ \t]*-G / \ - { sub("^[[]","",$2); sub("[]]$","",$2); print $2 }' )" \ - -- "$cur" ) ) + { sub("^[[]","",$2); sub("[]]$","",$2); print $2 }')" \ + -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h 2>/dev/null)' \ + -- "$cur") ) return fi } && diff --git a/completions/tune2fs b/completions/tune2fs index 3695fea1..ab79cd51 100644 --- a/completions/tune2fs +++ b/completions/tune2fs @@ -6,48 +6,50 @@ _tune2fs() _init_completion || return case $prev in - -c|-C|-E|-i|-J|-L|-m|-r|-T) + -*[cCEiJLmrT]) return ;; - -e) - COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) ) + -*e) + COMPREPLY=( $(compgen -W 'continue remount-ro panic' -- "$cur") ) return ;; - -g) + -*g) _gids - COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -g -W '${COMPREPLY[@]}' -- "$cur") ) return ;; - -M) + -*M) _filedir -d return ;; - -o) + -*o) local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 - ^journal_data ^journal_data_ordered ^journal_data_writeback) - COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + ^journal_data ^journal_data_ordered ^journal_data_writeback + ^nobarrier ^block_validity ^discard ^nodelalloc) + COMPREPLY=( $(compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur") ) return ;; - -O) - local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype - ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode + -*O) + local -a opts=(^dir_index ^dir_nlink ^encrypt ^extent ^extra_isize + ^filetype ^flex_bg ^has_journal ^huge_file ^large_file + ^metadata_csum ^mmp ^project ^quota ^read-only ^resize_inode ^sparse_super ^uninit_bg) - COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur") ) return ;; - -u) + -*u) _uids - COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -u -W '${COMPREPLY[@]}' -- "$cur") ) return ;; - -U) - COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) ) + -*U) + COMPREPLY=( $(compgen -W 'clear random time' -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/ulimit b/completions/ulimit new file mode 100644 index 00000000..3887cdf5 --- /dev/null +++ b/completions/ulimit @@ -0,0 +1,42 @@ +# bash completion for ulimit -*- shell-script -*- + +_ulimit() +{ + local cur prev words cword + _init_completion || return + + # TODO combined option support (-aH, -Sc etc) + + local mode + case $prev in + -a) + COMPREPLY=( $(compgen -W "-S -H" -- "$cur") ) + return + ;; + -[SH]) + ;; + -*) + mode=$prev + ;; + esac + + if [[ -z "$mode" ]]; then + local word + for word in "${words[@]}"; do + [[ $word == -*a* ]] && return + done + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) + return + fi + fi + + local args + _count_args + [[ $args -eq 1 ]] && \ + COMPREPLY=( $(compgen -W "soft hard unlimited" -- "$cur") ) +} && +complete -F _ulimit ulimit + +# ex: filetype=sh diff --git a/completions/umount b/completions/umount deleted file mode 100644 index 6d4b3c8f..00000000 --- a/completions/umount +++ /dev/null @@ -1,21 +0,0 @@ -# umount(8) completion -*- shell-script -*- - -if [[ $OSTYPE == *linux* ]]; then - . "$BASH_SOURCE.linux" - return -fi - -# umount(8) completion. This relies on the mount point being the third -# space-delimited field in the output of mount(8) -# -_umount() -{ - local cur prev words cword - _init_completion || return - - local IFS=$'\n' - COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) ) -} && -complete -F _umount -o dirnames umount - -# ex: filetype=sh diff --git a/completions/umount.linux b/completions/umount.linux deleted file mode 100644 index 28bfc9c9..00000000 --- a/completions/umount.linux +++ /dev/null @@ -1,140 +0,0 @@ -# umount(8) completion -*- shell-script -*- - -# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better! -# -# This will correctly escape special characters in COMPREPLY. -_reply_compgen_array() -{ - # Create the argument for compgen -W by escaping twice. - # - # One round of escape is because we want to reply with escaped arguments. A - # second round is required because compgen -W will helpfully expand it's - # argument. - local i wlist - for i in ${!COMPREPLY[*]}; do - local q=$(quote "$(printf %q "${COMPREPLY[$i]}")") - wlist+=$q$'\n' - done - - # We also have to add another round of escaping to $cur. - local ecur="$cur" - ecur=${ecur//\\/\\\\} - ecur=${ecur//\'/\\\'} - - # Actually generate completions. - local oldifs=$IFS - IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)' - IFS=$oldifs -} - -# Unescape strings in the linux fstab(5) format (with octal escapes). -__linux_fstab_unescape() { - eval $1="'${!1//\'/\\047}'" - eval $1="'${!1/%\\/\\\\}'" - eval "$1=$'${!1}'" -} - -# Complete linux fstab entries. -# -# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab -# and /proc/mounts. -_linux_fstab() -{ - COMPREPLY=() - - # Read and unescape values into COMPREPLY - 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 [[ $1 == -L ]]; then - local fs_label=${fs_spec/#LABEL=} - if [[ $fs_label != "$fs_spec" ]]; then - __linux_fstab_unescape fs_label - IFS=$'\0' - COMPREPLY+=("$fs_label") - IFS=$oldifs - fi - else - __linux_fstab_unescape fs_spec - __linux_fstab_unescape fs_file - IFS=$'\0' - [[ $fs_spec == */* ]] && COMPREPLY+=("$fs_spec") - [[ $fs_file == */* ]] && COMPREPLY+=("$fs_file") - IFS=$oldifs - fi - done - - # Add relative paths to COMPREPLY - if [[ $cur && $cur != /* ]]; then - local realcur - [[ $cur == */ ]] && # don't let readlink drop last / from path - realcur="$( readlink -f "$cur." 2> /dev/null )/" || - realcur=$( readlink -f "$cur" 2> /dev/null ) - if [[ $realcur ]]; then - local dirrealcur= dircur= basecur - if [[ $cur == */* ]]; then - dirrealcur="${realcur%/*}/" - dircur="${cur%/*}/" - fi - basecur=${cur#"$dircur"} - local i n=${#COMPREPLY[@]} - for (( i=0; i < $n; i++ )); do - [[ "${COMPREPLY[i]}" == "$realcur"* ]] && - COMPREPLY+=( $( cd "$dircur" 2> /dev/null && - compgen -f -d -P "$dircur" \ - -X "!${COMPREPLY[i]##"$dirrealcur"}" -- "$basecur" ) ) - done - fi - fi - - _reply_compgen_array -} - -_umount() -{ - local cur prev words cword - _init_completion || return - - case "$prev" in - -t) - # FIXME: no<fstype> - local split=false - if [[ "$cur" == ?*,* ]]; then - prev="${cur%,*}" - cur="${cur##*,}" - split=true - fi - COMPREPLY=( $( compgen -W 'adfs affs autofs btrfs cifs coda - cramfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs - iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 - ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs - umsdos usbfs vfat xfs' -- "$cur" ) ) - _fstypes - $split && COMPREPLY=( ${COMPREPLY[@]/#/$prev,} ) - return - ;; - -O) - # argument required but no completions available - return - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-V -h -v -n -r -d -i -a -t -O -f -l - --no-canonicalize --fake' -- "$cur" ) ) - [[ $COMPREPLY ]] && return - fi - - if [[ -r /proc/mounts ]]; then - # Linux /proc/mounts is properly quoted. This is important when - # unmounting usb devices with pretty names. - _linux_fstab < /proc/mounts - else - local IFS=$'\n' - COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) ) - fi -} && -complete -F _umount -o dirnames umount - -# ex: filetype=sh diff --git a/completions/unace b/completions/unace index 0f8963e0..a58bd6f0 100644 --- a/completions/unace +++ b/completions/unace @@ -6,10 +6,10 @@ _unace() _init_completion || return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur") ) else if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'e l t v x' -- "$cur") ) else _filedir ace fi diff --git a/completions/unpack200 b/completions/unpack200 index 1c97ecbe..393df04d 100644 --- a/completions/unpack200 +++ b/completions/unpack200 @@ -6,15 +6,15 @@ _unpack200() _init_completion -s || return case $prev in - '-?'|-h|--help|-V|--version|-J) + --help|--version|-!(-*)[?hVJ]) return ;; - -H|--deflate-hint) - COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) + --deflate-hint|-!(-*)H) + COMPREPLY=( $(compgen -W 'true false keep' -- "$cur") ) return ;; - -l|--log-file) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + --log-file|-!(-*)l) + COMPREPLY=( $(compgen -W '-' -- "$cur") ) _filedir log return ;; @@ -32,9 +32,9 @@ _unpack200() done if ! $pack ; then - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '--deflate-hint= --remove-pack-file - --verbose --quiet --log-file= --help --version' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '--deflate-hint= --remove-pack-file + --verbose --quiet --log-file= --help --version' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir 'pack?(.gz)' diff --git a/completions/unrar b/completions/unrar index 3340d24c..5381876f 100644 --- a/completions/unrar +++ b/completions/unrar @@ -6,12 +6,12 @@ _unrar() _init_completion || return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu -dh -ep -f + COMPREPLY=( $(compgen -W '-ad -ap -av- -c- -cfg- -cl -cu -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta -tb -tn -to -u -v - -ver -vp -x -x@ -y' -- "$cur" ) ) + -ver -vp -x -x@ -y' -- "$cur") ) else if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'e l lb lt p t v vb vt x' -- "$cur") ) else _filedir rar fi diff --git a/completions/unshunt b/completions/unshunt index 8815f843..214fa423 100644 --- a/completions/unshunt +++ b/completions/unshunt @@ -6,7 +6,7 @@ _unshunt() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else _filedir -d fi diff --git a/completions/update-alternatives b/completions/update-alternatives index 43cc3229..e9ba476b 100644 --- a/completions/update-alternatives +++ b/completions/update-alternatives @@ -13,7 +13,7 @@ _installed_alternatives() break fi done - COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(command ls $admindir)' -- "$cur") ) } _update_alternatives() @@ -60,7 +60,7 @@ _update_alternatives() _filedir ;; 1) - COMPREPLY=( $( compgen -W '--slave' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--slave' -- "$cur") ) ;; 3) _installed_alternatives @@ -82,9 +82,9 @@ _update_alternatives() _installed_alternatives ;; *) - COMPREPLY=( $( compgen -W '--verbose --quiet --help --version + COMPREPLY=( $(compgen -W '--verbose --quiet --help --version --altdir --admindir --install --remove --auto --display - --config --set' -- "$cur" ) ) + --config --set' -- "$cur") ) esac } && complete -F _update_alternatives update-alternatives alternatives diff --git a/completions/update-rc.d b/completions/update-rc.d index 85c9a5a4..384b8dd4 100644 --- a/completions/update-rc.d +++ b/completions/update-rc.d @@ -17,15 +17,15 @@ _update_rc_d() options=( -f -n ) if [[ $cword -eq 1 || "$prev" == -* ]]; then - valid_options=( $( \ - tr " " "\n" <<<"${words[@]} ${options[@]}" \ - | command sed -ne "/$( command sed "s/ /\\|/g" <<<"${options[@]}" )/p" \ + valid_options=( $(\ + tr " " "\n" <<<"${words[*]} ${options[*]}" \ + | command sed -ne "/$(command sed "s/ /\\|/g" <<<"${options[*]}")/p" \ | sort | uniq -u \ ) ) - COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \ - -X '$( tr " " "|" <<<${words[@]} )' -- "$cur" ) ) - elif [[ "$prev" == ?($( tr " " "|" <<<${services[@]} )) ]]; then - COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${options[@]} ${services[@]}' \ + -X '$(tr " " "|" <<<${words[@]})' -- "$cur") ) + elif [[ "$prev" == ?($(tr " " "|" <<<"${services[*]}")) ]]; then + COMPREPLY=( $(compgen -W 'remove defaults start stop' -- "$cur") ) elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then @@ -53,7 +53,7 @@ _update_rc_d() COMPREPLY=() fi elif [[ "$prev" == "." ]]; then - COMPREPLY=( $( compgen -W "start stop" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "start stop" -- "$cur") ) else COMPREPLY=() fi diff --git a/completions/upgradepkg b/completions/upgradepkg index 2a4b9845..7b775769 100644 --- a/completions/upgradepkg +++ b/completions/upgradepkg @@ -6,8 +6,8 @@ _upgradepkg() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall - --verbose' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--dry-run --install-new --reinstall + --verbose' -- "$cur") ) return fi @@ -16,9 +16,9 @@ _upgradepkg() cur="${cur#*%}" local nofiles IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur" ) ) + COMPREPLY=( $(compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur") ) [[ $COMPREPLY ]] || nofiles=1 - COMPREPLY+=( $( compgen -P "$prev%" -S '/' -d -- "$cur" ) ) + COMPREPLY+=( $(compgen -P "$prev%" -S '/' -d -- "$cur") ) [[ $nofiles ]] && compopt -o nospace return fi diff --git a/completions/urlsnarf b/completions/urlsnarf index b6bf069c..d3581c5f 100644 --- a/completions/urlsnarf +++ b/completions/urlsnarf @@ -6,14 +6,18 @@ _urlsnarf() _init_completion || return case $prev in - -i) + -*i) _available_interfaces -a return ;; + -*p) + _filedir pcap + return + ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && diff --git a/completions/uscan b/completions/uscan index aafc1dfd..de0e7174 100644 --- a/completions/uscan +++ b/completions/uscan @@ -7,7 +7,7 @@ _uscan() case $prev in --package) - COMPREPLY=( $( _xfunc apt-cache _apt_cache_src_packages )) + COMPREPLY=( $(_xfunc apt-cache _apt_cache_src_packages)) return ;; --watchfile) @@ -26,13 +26,7 @@ _uscan() $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" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _uscan uscan diff --git a/completions/useradd b/completions/useradd index fa8e58cc..8e095441 100644 --- a/completions/useradd +++ b/completions/useradd @@ -9,27 +9,27 @@ _useradd() # with -u/--uid case $prev in - -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-K|--key|\ - -p|--password|-u|--uid|-Z|--selinux-user) + --comment|--help|--expiredate|--inactive|--key|--password|--uid|\ + --selinux-user|-!(-*)[chefKpuZ]) return ;; - -b|--base-dir|-d|--home-dir|-k|--skel|-R|--root) + --base-dir|--home-dir|--skel|--root|-!(-*)[bdkR]) _filedir -d return ;; - -g|--gid) + --gid|-!(-*)g) _gids - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} $(compgen -g)' \ + -- "$cur") ) return ;; - -G|--groups) + --groups|-!(-*)G) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -g -- "${cur##*,}" ) ) + COMPREPLY=( $(compgen -g -- "${cur##*,}") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; - -s|--shell) + --shell|-!(-*)s) _shells return ;; @@ -38,7 +38,7 @@ _useradd() $split && return [[ "$cur" == -* ]] && \ - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _useradd useradd diff --git a/completions/userdel b/completions/userdel index 05bc2f75..7d637d2e 100644 --- a/completions/userdel +++ b/completions/userdel @@ -6,21 +6,21 @@ _userdel() _init_completion || return case $prev in - -h|--help) + --help|-!(-*)h) return ;; - -R|--root) + --root|-!(-*)R) _filedir -d return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _userdel userdel diff --git a/completions/usermod b/completions/usermod index 9d478c3a..3d0efdbd 100644 --- a/completions/usermod +++ b/completions/usermod @@ -9,27 +9,27 @@ _usermod() # with -u/--uid case $prev in - -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\ - -l|--login|-p|--password|-u|--uid|-Z|--selinux-user) + --comment|--home|--expiredate|--inactive|--help|--login|--password|\ + --uid|--selinux-user|-!(-*)[cdefhlpuZ]) return ;; - -g|--gid) + --gid|-!(-*)g) _gids - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]} $(compgen -g)' \ + -- "$cur") ) return ;; - -G|--groups) + --groups|-!(-*)G) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -g -- "${cur##*,}" ) ) + COMPREPLY=( $(compgen -g -- "${cur##*,}") ) [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; - -R|--root) + --root|-!(-*)R) _filedir -d return ;; - -s|--shell) + --shell|-!(-*)s) _shells return ;; @@ -39,11 +39,11 @@ _usermod() if [[ "$cur" == -* ]]; then # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $(compgen -u -- "$cur") ) } && complete -F _usermod usermod diff --git a/completions/valgrind b/completions/valgrind index 97e4cc59..2df09707 100644 --- a/completions/valgrind +++ b/completions/valgrind @@ -31,24 +31,24 @@ _valgrind() --tool) # Tools seem to be named e.g. like memcheck-amd64-linux from which # we want to grab memcheck. - COMPREPLY=( $( compgen -W '$( - for f in /usr{,/local}/lib{,64}/valgrind/*; do - [[ $f != *.so && -x $f ]] && - command sed -ne "s/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f - done )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$( + for f in /usr{,/local}/lib{,64,exec}/valgrind/*; do + [[ $f != *.so && -x $f && $f =~ ^.*/(.*)-[^-]+-[^-]+ ]] && + printf "%s\n" "${BASH_REMATCH[1]}" + done)' -- "$cur") ) return ;; --sim-hints) - COMPREPLY=( $( compgen -W 'lax-ioctls enable-outer' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'lax-ioctls enable-outer' -- "$cur") ) return ;; --soname-synonyms) - COMPREPLY=( $( compgen -W 'somalloc' -S = -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'somalloc' -S = -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return ;; --kernel-variant) - COMPREPLY=( $( compgen -W 'bproc' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'bproc' -- "$cur") ) return ;; # callgrind: @@ -58,19 +58,19 @@ _valgrind() ;; # exp-dhat: --sort-by) - COMPREPLY=( $( compgen -W 'max-bytes-live tot-bytes-allocd - max-blocks-live' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'max-bytes-live tot-bytes-allocd + max-blocks-live' -- "$cur") ) return ;; # massif: --time-unit) - COMPREPLY=( $( compgen -W 'i ms B' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'i ms B' -- "$cur") ) return ;; # generic cases parsed from --help output --+([-A-Za-z0-9_])) - local value=$( $1 --help-debug $tool 2>/dev/null | \ - command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p" ) + local value=$($1 --help-debug $tool 2>/dev/null | \ + command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p") case $value in \<file*\>) _filedir @@ -78,18 +78,18 @@ _valgrind() ;; \<command\>) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; \<+([0-9])..+([0-9])\>) - COMPREPLY=( $( compgen -W "{${value:1:((${#value}-2))}}" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "{${value:1:((${#value}-2))}}" \ + -- "$cur") ) return ;; # "yes", "yes|no", etc (but not "string", "STR", # "hint1,hint2,...") yes|+([-a-z0-9])\|+([-a-z0-9\|])) - COMPREPLY=( $( IFS='|' compgen -W '$value' -- "$cur" ) ) + COMPREPLY=( $(IFS='|' compgen -W '$value' -- "$cur") ) return ;; esac @@ -99,8 +99,8 @@ _valgrind() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $tool" )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" "--help $tool")' \ + -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/vipw b/completions/vipw index cb54a840..46771a0a 100644 --- a/completions/vipw +++ b/completions/vipw @@ -6,16 +6,16 @@ _vipw() _init_completion || return case $prev in - -h|--help) + --help|-!(-*)h) return ;; - -R|--root) + --root|-!(-*)R) _filedir -d return ;; esac - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) } && complete -F _vipw vipw vigr diff --git a/completions/vmstat b/completions/vmstat index 769620a7..f15d4089 100644 --- a/completions/vmstat +++ b/completions/vmstat @@ -6,20 +6,20 @@ _vmstat() _init_completion || return case $prev in - -h|--help|-V|--version|-c|-M|-N|-n|-w|-p|--partition) + --help|--version|--partition|-!(-*)[hVcMNnwp]) return ;; - -S|--unit) + --unit|-!(-*)S) [[ $OSTYPE == *linux* ]] && \ - COMPREPLY=( $( compgen -W 'k K m M' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'k K m M' -- "$cur") ) return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY ]] || \ - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) fi } && complete -F _vmstat vmstat diff --git a/completions/vncviewer b/completions/vncviewer index 9b307331..000ba1a8 100644 --- a/completions/vncviewer +++ b/completions/vncviewer @@ -27,8 +27,8 @@ _tightvncviewer() return ;; -encodings) - COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib corre rre - raw' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'copyrect tight hextile zlib corre rre + raw' -- "$cur") ) return ;; -via) @@ -39,10 +39,10 @@ _tightvncviewer() if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-help -listen -via -shared -noshared + COMPREPLY=( $(compgen -W '-help -listen -via -shared -noshared -viewonly -fullscreen -noraiseonbeep -passwd -encodings -bgr233 -owncmap -truecolour -truecolor -depth -compresslevel -quality - -nojpeg -nocursorshape -x11cursor' -- "$cur" ) ) + -nojpeg -nocursorshape -x11cursor' -- "$cur") ) else _known_hosts_real -- "$cur" fi @@ -52,26 +52,24 @@ complete -F _tightvncviewer tightvncviewer # NOTE: - VNC Viewer options are case insensitive. # Preferred case is taken from -help. -# - Both single dash (-) and double dash (--) are allowed as option prefix _xvnc4viewer() { local cur prev words cword _init_completion || return - # Convert double dash to single dash - case ${prev/#--/-} in + # Both single dash (-) and double dash (--) are allowed as option prefix + local opt=${prev/#--/-} + case ${opt,,} in # -passwd, -PasswordFile - -[pP][aA][sS][sS][wW][dD]|-[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE]) + -passwd|-passwordfile) _filedir 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" ) ) + -preferredencoding) + COMPREPLY=( $(compgen -W 'zrle hextile raw' -- "$cur") ) return ;; - # -via - -[vV][iI][aA]) + -via) _known_hosts_real -- "$cur" return ;; @@ -87,11 +85,11 @@ _xvnc4viewer() WMDecorationWidth ZlibLevel ) [[ "$cur" == --* ]] && dash=-- || dash=- - local IFS=$' \t\n' reset=$( shopt -p nocasematch ); shopt -s nocasematch + local IFS=$' \t\n' reset=$(shopt -p nocasematch); shopt -s nocasematch local option - COMPREPLY=( $( for option in "${options[@]}"; do + COMPREPLY=( $(for option in "${options[@]}"; do [[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option - done ) ) + done) ) $reset else _known_hosts_real -- "$cur" diff --git a/completions/vpnc b/completions/vpnc index b7b8c14a..5eb5be71 100644 --- a/completions/vpnc +++ b/completions/vpnc @@ -16,12 +16,12 @@ _vpnc() return ;; --vendor) - COMPREPLY=( $( compgen -W 'cisco netscreen' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'cisco netscreen' -- "$cur") ) return ;; --natt-mode) - COMPREPLY=( $( compgen -W 'natt none force-natt cisco-udp' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'natt none force-natt cisco-udp' \ + -- "$cur") ) return ;; --script|--pid-file|--ca-file) @@ -29,23 +29,23 @@ _vpnc() return ;; --dh) - COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'dh1 dh2 dh5' -- "$cur") ) return ;; --pfs) - COMPREPLY=( $( compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur") ) return ;; --ifmode) - COMPREPLY=( $( compgen -W 'tun tap' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'tun tap' -- "$cur") ) return ;; --debug) - COMPREPLY=( $( compgen -W '0 1 2 3 99' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '0 1 2 3 99' -- "$cur") ) return ;; --auth-mode) - COMPREPLY=( $( compgen -W 'psk cert hybrid' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'psk cert hybrid' -- "$cur") ) return ;; --ca-dir) @@ -54,14 +54,13 @@ _vpnc() ;; --password-helper) compopt -o filenames - COMPREPLY=( $( compgen -c -- "$cur" ) ) + COMPREPLY=( $(compgen -c -- "$cur") ) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --long-help)' -- "$cur") ) elif [[ "$cur" == */* ]]; then # explicit filename _filedir conf @@ -74,7 +73,7 @@ _vpnc() $reset IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -W '${configs[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${configs[@]}' -- "$cur") ) fi } && complete -F _vpnc vpnc diff --git a/completions/watch b/completions/watch index bcc356f8..eb04df89 100644 --- a/completions/watch +++ b/completions/watch @@ -10,10 +10,10 @@ _watch() local offset=0 i for (( i=1; i <= cword; i++ )); do case ${words[i]} in - -h|--help|--version) + --help|--version|-!(-*)h) return ;; - -n|--interval) + --interval|-!(-*)n) (( i++ )) continue ;; @@ -31,12 +31,12 @@ _watch() fi case $prev in - -d|--differences) + --differences|-!(-*)d) [[ $cur != -* ]] && \ - COMPREPLY=( $( compgen -W 'cumulative' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'cumulative' -- "$cur") ) return ;; - -n|--interval) + --interval|-!(-*)n) return ;; esac @@ -44,7 +44,7 @@ _watch() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/webmitm b/completions/webmitm index 308f2281..d50bc3e3 100644 --- a/completions/webmitm +++ b/completions/webmitm @@ -6,7 +6,7 @@ _webmitm() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) else _known_hosts_real -- "$cur" fi diff --git a/completions/wget b/completions/wget index 95011bef..b27d860d 100644 --- a/completions/wget +++ b/completions/wget @@ -6,18 +6,18 @@ _wget() _init_completion -s || return case $prev in - -V|--version|-h|--help) + --version|--help|-!(-*)[hV]) return ;; --progress) - COMPREPLY=( $( compgen -W 'bar dot' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'bar dot' -- "$cur") ) return ;; --bind-address) - _ip_addresses "$cur" + _ip_addresses return ;; - -D|--domains|--exclude-domains) + --domains|--exclude-domains|-!(-*)D) _known_hosts_real -- "$cur" return ;; @@ -37,53 +37,53 @@ _wget() excludes+=( ascii ) ;; esac - local excludes_str=$( export IFS='|'; echo "${excludes[*]}"; ) + local excludes_str=$(export IFS='|'; echo "${excludes[*]}";) # prevopt is the previous options string used as a prefix # to avoid COMPREPLY replacing them with the $lastopt completion local lastopt=${cur/*,} prevopt= [[ $cur == *,* ]] && prevopt=${cur%,*}, - COMPREPLY=( $( compgen -P "$prevopt" -X "@($excludes_str)" \ + COMPREPLY=( $(compgen -P "$prevopt" -X "@($excludes_str)" \ -W 'unix windows nocontrol ascii lowercase uppercase' \ - -- "$lastopt" ) ) + -- "$lastopt") ) # +o nospace when no more valid option is possible (= append a space) - local opt_as_arr=( $( echo ${COMPREPLY[0]//,/ } ) ) + local opt_as_arr=( $(echo ${COMPREPLY[0]//,/ }) ) [[ ${#opt_as_arr[@]} -lt 4 ]] && compopt -o nospace return ;; --prefer-family) - COMPREPLY=( $( compgen -W 'IPv4 IPv6 none' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'IPv4 IPv6 none' -- "$cur") ) return ;; - -P|--directory-prefix|--ca-directory|--warc-tempdir) + --directory-prefix|--ca-directory|--warc-tempdir|-!(-*)P) _filedir -d return ;; - -o|--output-file|-a|--append-output|--config|--load-cookies|\ - --save-cookies|--post-file|--certificate|--ca-certificate|\ - --private-key|--random-file|--egd-file|--warc-file|--warc-dedup) + --output-file|--append-output|--config|--load-cookies|--save-cookies|\ + --post-file|--certificate|--ca-certificate|--private-key|\ + --random-file|--egd-file|--warc-file|--warc-dedup|-!(-*)[oa]) _filedir return ;; - -O|--output-document|-i|--input-file) + --output-document|--input-file|-!(-*)[Oi]) _filedir && [[ $cur == - || -z $cur ]] && COMPREPLY+=( - ) return ;; --secure-protocol) - COMPREPLY=( $( compgen -W 'auto SSLv2 SSLv3 TLSv1' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'auto SSLv2 SSLv3 TLSv1' -- "$cur") ) return ;; --certificate-type|--private-key-type) - COMPREPLY=( $( compgen -W 'PEM DER' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'PEM DER' -- "$cur") ) return ;; --follow-tags|--ignore-tags) local lastopt=${cur/*,} prevopt= [[ $cur == *,* ]] && prevopt=${cur%,*}, - COMPREPLY=( $( compgen -P "$prevopt" -W 'a abbr acronym address + COMPREPLY=( $(compgen -P "$prevopt" -W 'a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dir div dfn dl dt em fieldset font form frame frameset h6 head hr html i iframe @@ -91,37 +91,37 @@ _wget() noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmp' \ - -- "$lastopt" ) ) + -- "$lastopt") ) return ;; - -t|--tries|-T|--timeout|--dns-timeout|--connect-timeout|--read-timeout|\ - -w|--wait|--waitretry|--cut-dirs|--max-redirect|-l|--level) + --tries|--timeout|--dns-timeout|--connect-timeout|--read-timeout|\ + --wait|--waitretry|--cut-dirs|--max-redirect|--level|-!(-*)[tTwl]) # expect integer number - COMPREPLY+=( $( compgen -P "$cur" -W "{0..9}" ) ) + COMPREPLY+=( $(compgen -P "$cur" -W "{0..9}") ) compopt -o nospace return ;; - -Q|--quota|--limit-rate|--warc-max-size) + --quota|--limit-rate|--warc-max-size|-!(-*)Q) # expect size if [[ $cur == *[km] ]]; then - COMPREPLY=( $( compgen -W "$cur" ) ) + COMPREPLY=( $(compgen -W "$cur") ) elif [[ $cur ]]; then - COMPREPLY=( $( compgen -P "$cur" -W "{0..9} k m" ) ) + COMPREPLY=( $(compgen -P "$cur" -W "{0..9} k m") ) compopt -o nospace else - COMPREPLY=( $( compgen -W "{0..9}" ) ) + COMPREPLY=( $(compgen -W "{0..9}") ) compopt -o nospace fi return ;; --user|--http-user|--proxy-user|--ftp-user) - COMPREPLY=( $( compgen -W "$( command sed -n \ + COMPREPLY=( $(compgen -W "$(command sed -n \ '/^login/s/^[[:blank:]]*login[[:blank:]]//p' ~/.netrc \ - 2>/dev/null )" -- "$cur" ) ) + 2>/dev/null)" -- "$cur") ) return ;; --header) - COMPREPLY=( $( compgen -W 'Accept Accept-Charset Accept-Encoding + COMPREPLY=( $(compgen -W 'Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges Age Allow Authorization Cache-Control Connection Content-Encoding Content-Language Content-Length Content-Location Content-MD5 Content-Range @@ -130,31 +130,29 @@ _wget() Last-Modified Location Max-Forwards Pragma Proxy-Authenticate Proxy-Authorization Range Referer Retry-After Server TE Trailer Transfer-Encoding Upgrade User-Agent Vary Via Warning - WWW-Authenticate' -- "$cur" ) ) + WWW-Authenticate' -- "$cur") ) compopt -o nospace return ;; --local-encoding|--remote-encoding) - type -P xauth &>/dev/null && \ - COMPREPLY=( $( compgen -W '$( iconv -l 2>/dev/null | \ - command sed -e "s@/*\$@@" -e "s/[,()]//g" 2>/dev/null )' -- "$cur" ) ) + type -P xauth &>/dev/null && _xfunc iconv _iconv_charsets return ;; - -e|--execute) + --execute|-!(-*)e) return # TODO base=STR ;; --report-speed) - COMPREPLY=( $( compgen -W 'bits' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'bits' -- "$cur") ) return ;; --regex-type) - COMPREPLY=( $( compgen -W 'posix' -- "$cur" ) ) + 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|--accept-regex|--reject-regex|-I|\ - --include-directories|-X|--exclude-directories) + --base|--password|--ftp-password|--http-password|--proxy-password|\ + --default-page|--referer|--user-agent|--post-data|--warc-header|\ + --accept|--reject|--accept-regex|--reject-regex|--include-directories|\ + --exclude-directories|-!(-*)[BUARIX]) # argument required but no completions available return ;; @@ -163,7 +161,7 @@ _wget() $split && return if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi diff --git a/completions/wine b/completions/wine index be299755..f871e744 100644 --- a/completions/wine +++ b/completions/wine @@ -7,7 +7,7 @@ _wine() if [[ $cword -eq 1 ]]; then if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --version' -- "$cur") ) [[ $COMPREPLY ]] && return fi _filedir '@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR]|[mM][sS][iI])' diff --git a/completions/withlist b/completions/withlist index 913e410b..cd030a27 100644 --- a/completions/withlist +++ b/completions/withlist @@ -6,8 +6,8 @@ _withlist() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--lock --interactive --run --all --quiet - --help' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--lock --interactive --run --all --quiet + --help' -- "$cur") ) else _xfunc list_lists _mailman_lists fi diff --git a/completions/wodim b/completions/wodim index 7380166b..ac1dc5a9 100644 --- a/completions/wodim +++ b/completions/wodim @@ -16,8 +16,8 @@ _cdrecord() _filedir ;; blank) - COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail - unclose session' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'help all fast track unreserve trtail + unclose session' -- "$cur") ) ;; driveropts) if [[ $cur == *=* ]]; then @@ -25,31 +25,30 @@ _cdrecord() cur=${cur#*=} case $prev in varirec) - COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W "-2 -1 0 1 2" -- "$cur") ) ;; gigarec) - COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3 - 1.4" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "0.6 0.7 0.8 1.0 1.2 1.3 + 1.4" -- "$cur") ) ;; tattoofile) _filedir ;; esac else - COMPREPLY=( $( compgen -W 'burnfree noburnfree varirec= + COMPREPLY=( $(compgen -W 'burnfree noburnfree varirec= gigarec= audiomaster forcespeed noforcespeed speedread nospeedread singlesession nosinglesession hidecdr - nohidecdr tattooinfo tattoofile=' -- "$cur" ) ) + nohidecdr tattooinfo tattoofile=' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace fi ;; driver) - COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \ - awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$($1 driver=help 2>&1 | \ + awk 'NR > 1 { print $1 }') help" -- "$cur") ) ;; minbuf) - COMPREPLY=( $( compgen -W '{25..95}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{25..95}' -- "$cur") ) ;; esac return @@ -83,10 +82,10 @@ _cdrecord() # files are always eligible completion _filedir # track options are always available - COMPREPLY+=( $( compgen -W '${track_options[@]}' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '${track_options[@]}' -- "$cur") ) # general options are no more available after file or track option if [[ $track_mode -eq 0 ]]; then - COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) ) + COMPREPLY+=( $(compgen -W '${generic_options[@]}' -- "$cur") ) fi [[ $COMPREPLY == *= ]] && compopt -o nospace } && diff --git a/completions/wol b/completions/wol index 1ce25b05..0222b24d 100644 --- a/completions/wol +++ b/completions/wol @@ -6,20 +6,20 @@ _wol() _init_completion -s -n : || return case $prev in - -V|--version|--help|-p|--port|--passwd|-w|--wait) + --version|--help|--port|--passwd|--wait|-!(-*)[Vpw]) return ;; - -h|--host|-i|--ipaddr) + --host|--ipaddr|-!(-*)[hi]) # Broadcast addresses local PATH=$PATH:/sbin - COMPREPLY=( $( { ip addr show || ifconfig -a; } 2>/dev/null | \ + COMPREPLY=( $({ ip addr show || ifconfig -a; } 2>/dev/null | \ 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' ) ) + 's/.*[[:space:]]broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p') ) _known_hosts_real -- "$cur" return ;; - -f|--file) + --file|-!(-*)f) _filedir return ;; @@ -28,7 +28,7 @@ _wol() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/wsimport b/completions/wsimport index a7f591e7..406a47d7 100644 --- a/completions/wsimport +++ b/completions/wsimport @@ -22,7 +22,7 @@ _wsimport() return ;; -target) - COMPREPLY=( $( compgen -W '2.0 2.1 2.2' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '2.0 2.1 2.2' -- "$cur") ) return ;; -clientjar) @@ -35,8 +35,7 @@ _wsimport() _known_hosts_real -- "${cur#-httpproxy:}" return elif [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) [[ $COMPREPLY == *: ]] && compopt -o nospace __ltrim_colon_completions "$cur" return diff --git a/completions/wtf b/completions/wtf index 26a0d4b8..6a596a3b 100644 --- a/completions/wtf +++ b/completions/wtf @@ -7,7 +7,7 @@ _wtf() _init_completion || return [[ $prev == -f ]] && _filedir && return - [[ ${words[@]} == *\ -f* ]] && addf= || addf=-f + [[ "${words[*]}" == *\ -f* ]] && addf= || addf=-f if [[ $cur == -* ]]; then COMPREPLY=( $addf ) return @@ -32,8 +32,8 @@ _wtf() [[ -z "$db" ]] && return fi - COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db* 2>/dev/null ) $addf" \ - -- "${cur^^}" ) ) + COMPREPLY=( $(compgen -W "$(cut -f 1 -s $db* 2>/dev/null) $addf" \ + -- "${cur^^}") ) } && complete -F _wtf wtf diff --git a/completions/wvdial b/completions/wvdial index e456f1b1..e0316617 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -18,7 +18,7 @@ _wvdial() case $cur in -*) - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace ;; *) @@ -33,7 +33,7 @@ _wvdial() done # parse config files for sections and # remove default section - COMPREPLY=( $( command 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// /\\ } diff --git a/completions/xdg-mime b/completions/xdg-mime index 92d5b838..72e92c66 100644 --- a/completions/xdg-mime +++ b/completions/xdg-mime @@ -2,8 +2,8 @@ _xdg_mime_mimetype() { - COMPREPLY+=( $( compgen -S / -W 'application audio font image message model - multipart text video' -- "$cur" ) ) + COMPREPLY+=( $(compgen -S / -W 'application audio font image message model + multipart text video' -- "$cur") ) [[ $COMPREPLY == */ ]] && compopt -o nospace } @@ -17,18 +17,18 @@ _xdg_mime() if [[ $args -eq 1 ]]; then if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '--help --manual --version' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--help --manual --version' -- "$cur") ) return fi - COMPREPLY=( $( compgen -W \ - 'query default install uninstall' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + 'query default install uninstall' -- "$cur") ) return fi case ${words[1]} in query) if [[ $args -eq 2 ]]; then - COMPREPLY=( $( compgen -W 'filetype default' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'filetype default' -- "$cur") ) return fi case ${words[2]} in # TODO and $args -eq 3 (takes only one arg!) @@ -43,25 +43,25 @@ _xdg_mime() desktops=( "${desktops[@]##*/}" ) $reset IFS=$'\n' - COMPREPLY=( $( compgen -W '${desktops[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${desktops[@]}' -- "$cur") ) else _xdg_mime_mimetype fi ;; install) if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '--mode --novendor' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--mode --novendor' -- "$cur") ) elif [[ $prev == --mode ]]; then - COMPREPLY=( $( compgen -W 'user system' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'user system' -- "$cur") ) else _filedir xml fi ;; uninstall) if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '--mode' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '--mode' -- "$cur") ) elif [[ $prev == --mode ]]; then - COMPREPLY=( $( compgen -W 'user system' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'user system' -- "$cur") ) else _filedir xml fi @@ -69,3 +69,5 @@ _xdg_mime() esac } && complete -F _xdg_mime xdg-mime + +# ex: filetype=sh diff --git a/completions/xdg-settings b/completions/xdg-settings index 15f040d4..c14d37ba 100644 --- a/completions/xdg-settings +++ b/completions/xdg-settings @@ -12,18 +12,20 @@ _xdg_settings() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( "$1" --help | - command sed -e "s/[{|]/\n/g" | _parse_help - )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" --help | + tr "{|" "\n" | _parse_help -)' -- "$cur") ) return fi local args _count_args if [[ $args -eq 1 ]]; then - COMPREPLY=( $( compgen -W "get check set" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "get check set" -- "$cur") ) elif [[ $args -eq 2 ]]; then - COMPREPLY=( $( compgen -W \ - '$( "$1" --list | awk "!/^Known/ { print \$1 }" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$("$1" --list | awk "!/^Known/ { print \$1 }")' -- "$cur") ) fi } && complete -F _xdg_settings xdg-settings + +# ex: filetype=sh diff --git a/completions/xfreerdp b/completions/xfreerdp index 9ca7ac81..f025cfce 100644 --- a/completions/xfreerdp +++ b/completions/xfreerdp @@ -3,34 +3,62 @@ _xfreerdp() { local cur prev words cword - _init_completion || return + _init_completion -n : || return - case $prev in + case $prev in # old/dash syntax -k) - COMPREPLY=( $( compgen -W "$($1 --kbd-list | \ - awk '/^0x/ {print $1}')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" --kbd-list | + awk "/^0x/ { print \$1 }")' -- "$cur") ) return ;; -a) - COMPREPLY=( $( compgen -W '8 15 16 24 32' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '8 15 16 24 32' -- "$cur") ) return ;; -x) - COMPREPLY=( $( compgen -W 'b broadband m modem l lan' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'broadband modem lan' -- "$cur") ) return ;; --plugin) - COMPREPLY=( $( compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur") ) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -t -g -a -z -f -x -O -o -k - --kbd-list -h --plugin --data' -- "$cur" ) ) + case $cur in # new/slash syntax + /kbd:*) + COMPREPLY=( $(compgen -W '$("$1" /kbd-list | + awk "/^0x/ { print \$1 }")' -- "${cur#/kbd:}") ) + return + ;; + /bpp:*) + COMPREPLY=( $(compgen -W '8 15 16 24 32' -- "${cur#/bpp:}") ) + return + ;; + /*:*|/help|/version|-h|--help|--version) + return + ;; + esac + + if [[ "$cur" == /* ]]; then + COMPREPLY=( $(compgen -W '$("$1" --help | + awk "\$1 ~ /^\\// && \$1 !~ /^.(flag\$|option:)/ { sub(\":.*\",\":\",\$1); print \$1 }")' \ + -- "$cur") ) + [[ $COMPREPLY == *: ]] && compopt -o nospace + elif [[ "$cur" == [+-]* ]]; then + local char=${cur:0:1} + local help="$($1 --help)" + if [[ "$help" == */help* ]]; then # new/slash syntax + COMPREPLY=( $(compgen -W '$(awk " + \$1 ~ /^[+-]/ && \$1 !~ /^.toggle\$/ { sub(\"^.\",\"$char\",\$1); print \$1 } + " <<<"$help")' -- "$cur") ) + else # old/dash syntax + COMPREPLY=( $(_parse_help - <<<"$help") ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]%:}' -- "$cur") ) + fi else - COMPREPLY=( $( compgen -W "$(awk '{print $1}' ~/.freerdp/known_hosts \ - 2>/dev/null)" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(awk '{print $1}' ~/.freerdp/known_hosts \ + 2>/dev/null)" -- "$cur") ) fi } && diff --git a/completions/xgamma b/completions/xgamma index 7b9d43cc..005928d2 100644 --- a/completions/xgamma +++ b/completions/xgamma @@ -7,9 +7,9 @@ _xgamma() case "$prev" in -screen) - local screens=$( xrandr --query 2>/dev/null | command sed -n \ - '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null ) - COMPREPLY=( $( compgen -W "$screens" -- "$cur" ) ) + 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 ;; -gamma|-rgamma|-ggamma|-bgamma) @@ -17,7 +17,7 @@ _xgamma() if [[ $cur && "$cur" != *.* ]]; then COMPREPLY=( . ) fi - COMPREPLY+=( $( compgen -W "{0..9}" ) ) + COMPREPLY+=( $(compgen -W "{0..9}") ) compopt -o nospace return ;; @@ -26,15 +26,15 @@ _xgamma() if [[ "$cur" == :* && "$cur" != :*.* ]]; then # FIXME: where to get local display numbers? local display=${cur#:} - COMPREPLY=( $( compgen -W "${display:-0}." ) ) + COMPREPLY=( $(compgen -W "${display:-0}.") ) compopt -o nospace elif [[ "$cur" == :*.* ]]; then # local screen numbers - local t screens=$( xrandr --query 2>/dev/null | command sed -ne \ - '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null ) + 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" -- \ - "${cur##*.}" ) ) + COMPREPLY=( $(compgen -P "${t%.*}." -W "$screens" -- \ + "${cur##*.}") ) elif [[ "$cur" != *:* ]]; then # complete hostnames _known_hosts_real -c -- "$cur" @@ -43,13 +43,13 @@ _xgamma() fi compopt -o nospace fi - # no dislpay completion for remote hosts + # no display completion for remote hosts return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return fi diff --git a/completions/xm b/completions/xm deleted file mode 100644 index c720fae1..00000000 --- a/completions/xm +++ /dev/null @@ -1,222 +0,0 @@ -# bash completion for xm -*- shell-script -*- - -_xen_domain_names() -{ - COMPREPLY=( $( compgen -W "$( xm list 2>/dev/null | \ - awk '!/Name|Domain-0/ { print $1 }' )" -- "$cur" ) ) -} - -_xen_domain_ids() -{ - COMPREPLY=( $( compgen -W "$( xm list 2>/dev/null | \ - awk '!/Name|Domain-0/ { print $2 }' )" -- "$cur" ) ) -} - -_xm() -{ - local cur prev words cword - _init_completion || return - - # TODO: _split_longopt - - local args command commands options - - commands='console vncviewer create new delete destroy domid domname - dump-core list mem-max mem-set migrate pause reboot rename reset - restore resume save shutdown start suspend sysrq trigger top unpause - uptime usb-add usb-del vcpu-list vcpu-pin vcpu-set debug-keys dmesg - info log serve sched-credit sched-sedf block-attach block-detach - block-list block-configure network-attach network-detach network-list - vtpm-list pci-attach pci-detach pci-list pci-list-assignable-devices - scsi-attach scsi-detach scsi-list vnet-list vnet-create vnet-delete - labels addlabel rmlabel getlabel dry-run resources dumppolicy setpolicy - resetpolicy getpolicy shell help' - - if [[ $cword -eq 1 ]] ; then - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) - else - if [[ "$cur" == *=* ]]; then - prev=${cur/=*/} - cur=${cur/*=/} - fi - - command=${words[1]} - if [[ "$cur" == -* ]]; then - # possible options for the command - case $command in - create) - options='-c' - ;; - dmesg) - options='--clear' - ;; - list) - options='--long' - ;; - reboot) - options='-w -a' - ;; - shutdown) - options='-w -a -R -H' - ;; - sched-credit) - options='-d -w -c' - ;; - block-list|network-list|vtpm-list|vnet-list) - options='-l --long' - ;; - getpolicy) - options='--dumpxml' - ;; - new) - options='-h --help --help_config -q --quiet --path= -f= - --defconfig= -F= --config= -b --dryrun -x --xmldryrun - -s --skipdtd -p --paused -c --console_autoconnect' - ;; - esac - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - else - case $command in - console|destroy|domname|domid|list|mem-set|mem-max| \ - pause|reboot|rename|shutdown|unpause|vcpu-list|vcpu-pin| \ - vcpu-set|block-list|network-list|vtpm-list) - _count_args - case $args in - 2) - _xen_domain_names - ;; - esac - ;; - migrate) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - _known_hosts_real -- "$cur" - ;; - esac - ;; - restore|dry-run|vnet-create) - _filedir - ;; - save) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - _filedir - ;; - esac - ;; - sysrq) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - COMPREPLY=( $( compgen -W "r s e i u b" \ - -- "$cur" ) ) - ;; - esac - ;; - block-attach) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - COMPREPLY=( $( compgen -W "phy: file:" \ - -- "$cur" ) ) - ;; - 5) - COMPREPLY=( $( compgen -W "w r" -- "$cur" ) ) - ;; - 6) - _xen_domain_names - ;; - esac - ;; - block-detach) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - COMPREPLY=( $( compgen -W "$( xm block-list $prev \ - 2>/dev/null | awk '!/Vdev/ { print $1 }' )" \ - -- "$cur" ) ) - ;; - esac - ;; - network-attach) - _count_args - case $args in - 2) - _xen_domain_names - ;; - *) - COMPREPLY=( $( compgen -W "script= ip= mac= bridge= - backend=" -- "$cur" ) ) - ;; - esac - ;; - network-detach) - _count_args - case $args in - 2) - _xen_domain_names - ;; - 3) - COMPREPLY=( $(compgen -W "$( xm network-list $prev \ - 2>/dev/null | awk '!/Idx/ { print $1 }' )" \ - -- "$cur" ) ) - ;; - esac - ;; - sched-credit) - case $prev in - -d) - _xen_domain_names - return - ;; - esac - ;; - create) - _filedir - COMPREPLY+=( \ - $( compgen -W '$( command ls /etc/xen 2>/dev/null )' \ - -- "$cur" ) ) - ;; - new) - case $prev in - -f|-F|--defconfig|--config) - _filedir - return - ;; - --path) - _filedir -d - return - ;; - esac - - _count_args - case $args in - 2) - _xen_domain_names - ;; - esac - ;; - esac - fi - fi -} && -complete -F _xm xm - -# ex: filetype=sh diff --git a/completions/xmllint b/completions/xmllint index e9a35d06..f5865b39 100644 --- a/completions/xmllint +++ b/completions/xmllint @@ -10,7 +10,7 @@ _xmllint() _filedir return ;; - --path|--dtdvalidfpi|--maxmem|--encode|--pattern) + --path|--dtdvalidfpi|--maxmem|--pattern|--xpath) # argument required but no completions available return ;; @@ -30,10 +30,18 @@ _xmllint() _filedir 'sch?(.gz)' return ;; + --encode) + _xfunc iconv _iconv_charsets + return + ;; + --pretty) + COMPREPLY=( $(compgen -W '{0..2}' -- "$cur") ) + return + ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) COMPREPLY=( "${COMPREPLY[@]%:}" ) return fi diff --git a/completions/xmlwf b/completions/xmlwf index dd7a5457..9cd0e195 100644 --- a/completions/xmlwf +++ b/completions/xmlwf @@ -6,22 +6,22 @@ _xmlwf() _init_completion || return case $prev in - -d) + -*d) _filedir -d return ;; - -e) - COMPREPLY=( $( compgen -W 'US-ASCII UTF-8 UTF-16 ISO-8859-1' \ - -- "$cur" ) ) + -*e) + COMPREPLY=( $(compgen -W 'US-ASCII UTF-8 UTF-16 ISO-8859-1' \ + -- "$cur") ) return ;; - -v) + -*v) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_usage "$1")' -- "$cur") ) return fi diff --git a/completions/xmms b/completions/xmms index 88e65bd4..9f084c38 100644 --- a/completions/xmms +++ b/completions/xmms @@ -6,17 +6,19 @@ _xmms() _init_completion -s || return case $prev in - -h|--help|-v|--version) + --help|--version|-!(-*)[hv]) return ;; - -S|--toggle-shuffle|-R|--toggle-repeat|-A|--toggle-advance) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + --toggle-shuffle|--toggle-repeat|--toggle-advance|-!(-*)[SRA]) + COMPREPLY=( $(compgen -W 'on off' -- "$cur") ) return ;; esac + $split && return + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) else _filedir '@(mp[23]|ogg|wav|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)' fi diff --git a/completions/xmodmap b/completions/xmodmap index 4db899b1..38bc6391 100644 --- a/completions/xmodmap +++ b/completions/xmodmap @@ -12,8 +12,7 @@ _xmodmap() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-display -help -grammar -verbose -quiet -n - -e -pm -pk -pke -pp' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") ) return fi diff --git a/completions/xrandr b/completions/xrandr index 841904a5..9b5b6a59 100644 --- a/completions/xrandr +++ b/completions/xrandr @@ -12,8 +12,8 @@ _xrandr() return ;; --output|--left-of|--right-of|--above|--below|--same-as) - local outputs=$( "$1" | awk '/connected/ {print $1}' ) - COMPREPLY=( $( compgen -W "$outputs" -- "$cur" ) ) + local outputs=$("$1" | awk '/connected/ {print $1}') + COMPREPLY=( $(compgen -W "$outputs" -- "$cur") ) return ;; --mode) @@ -25,37 +25,38 @@ _xrandr() fi done if [[ $output ]]; then - local modes=$( "$1" | command 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" ) ) + -e "s/\([^[:space:]]\)[[:space:]].*/\1/") + COMPREPLY=( $(compgen -W "$modes" -- "$cur") ) fi return ;; -o|--orientation) - COMPREPLY=( $( compgen -W 'normal inverted left right 0 1 2 3' -- \ - "$cur" ) ) + COMPREPLY=( $(compgen -W 'normal inverted left right 0 1 2 3' -- \ + "$cur") ) return ;; --reflect) - COMPREPLY=( $( compgen -W 'normal x y xy' -- "$cur" ) ) + COMPREPLY=( $(compgen -W 'normal x y xy' -- "$cur") ) return ;; --rotate) - COMPREPLY=( $( compgen -W 'normal inverted left right' -- "$cur" ) ) + 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" ) ) + 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 | - command sed -e "s/ or / /g" -e "s/<[^>]*>]//g" | _parse_help - )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$("$1" -help 2>&1 | + command sed -e "s/ or / /g" -e "s/<[^>]*>]//g" | _parse_help -)' \ + -- "$cur") ) } && complete -F _xrandr xrandr diff --git a/completions/xrdb b/completions/xrdb index 1f517cb3..d9f11439 100644 --- a/completions/xrdb +++ b/completions/xrdb @@ -16,7 +16,7 @@ _xrdb() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) return fi diff --git a/completions/xsltproc b/completions/xsltproc index 98d3e72a..241de67b 100644 --- a/completions/xsltproc +++ b/completions/xsltproc @@ -16,8 +16,8 @@ _xsltproc() ;; --encoding) # some aliases removed - COMPREPLY=( $( compgen -W "$( iconv -l | command sed -e '/^UTF[1378]/d' \ - -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" ) ) + COMPREPLY=( $(compgen -W "$(iconv -l | command sed -e '/^UTF[1378]/d' \ + -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur") ) return ;; --param|--stringparam) @@ -37,7 +37,7 @@ _xsltproc() [[ $cword -gt 2 && `_get_cword '' 2` == --?(string)param ]] && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) COMPREPLY=( "${COMPREPLY[@]%:}" ) else # TODO: 1st file xsl|xslt, 2nd XML diff --git a/completions/xxd b/completions/xxd index f190d75a..f6bcb4a2 100644 --- a/completions/xxd +++ b/completions/xxd @@ -12,7 +12,7 @@ _xxd() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) return fi diff --git a/completions/xz b/completions/xz index 7499ffb5..b64921f1 100644 --- a/completions/xz +++ b/completions/xz @@ -15,25 +15,23 @@ _xz() _filedir return ;; - -C|--check) - COMPREPLY=( $( compgen -W 'crc32 crc64 sha256 none' -- "$cur" ) ) + --check|-!(-*)C) + COMPREPLY=( $(compgen -W 'crc32 crc64 sha256 none' -- "$cur") ) return ;; - -F|--format) - COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- "$cur" ) ) + --format|-!(-*)F) + COMPREPLY=( $(compgen -W 'auto xz lzma raw' -- "$cur") ) return ;; - -T|--threads) - COMPREPLY=( $( compgen -W "{0..$(_ncpus)}" -- "$cur" ) ) + --threads|-!(-*)T) + 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 + --memlimit|--memlimit-compress|--memlimit-decompress|--memory|\ + --suffix|--delta|--lzma1|--lzma2|-!(-*)[MS]) return ;; - -h|--help|-H|--long-help|-V|--version|--info-memory) - # all other arguments are noop with these + --help|--long-help|--version|--info-memory|-!(-*)[hHV]) return ;; esac @@ -41,8 +39,8 @@ _xz() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \ - -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1" --long-help) {-1..-9}' \ + -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -51,8 +49,7 @@ _xz() local IFS=$'\n' compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _xz xz pxz diff --git a/completions/xzdec b/completions/xzdec index 5475a8e2..6b402eb3 100644 --- a/completions/xzdec +++ b/completions/xzdec @@ -6,12 +6,10 @@ _xzdec() _init_completion -s || return case $prev in - -M|--memory) - # argument required but no completions available + --memory|-!(-*)M) return ;; - -h|--help|-V|--version) - # all other arguments are noop with these + --help|--version|-!(-*)[hV]) return ;; esac @@ -19,7 +17,7 @@ _xzdec() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/ypmatch b/completions/ypmatch index c6de48b3..655390f2 100644 --- a/completions/ypmatch +++ b/completions/ypmatch @@ -12,13 +12,13 @@ _ypmatch() 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" ) ) + COMPREPLY=( $(compgen -W '$(ypcat $map 2>/dev/null | \ + cut -d':' -f 1)' -- "$cur") ) else [[ $cmd == ypmatch && $cword -ne 2 ]] && return - COMPREPLY=( $( compgen -W \ - '$( printf "%s\n" $(ypcat -x 2>/dev/null | \ - cut -d"\"" -f 2) )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(printf "%s\n" $(ypcat -x 2>/dev/null | \ + cut -d"\"" -f 2))' -- "$cur") ) fi } && complete -F _ypmatch ypmatch ypcat diff --git a/completions/yum-arch b/completions/yum-arch index 9dac178e..f2b902a3 100644 --- a/completions/yum-arch +++ b/completions/yum-arch @@ -5,8 +5,8 @@ _yum_arch() local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur" ) ) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur") ) else _filedir -d fi diff --git a/completions/zopfli b/completions/zopfli index ee2c890c..3c7ea403 100644 --- a/completions/zopfli +++ b/completions/zopfli @@ -12,8 +12,8 @@ _zopfli() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W \ - '$( _parse_help "$1" -h | command sed -e "s/#$//" )' -- "$cur" ) ) + COMPREPLY=( $(compgen -W \ + '$(_parse_help "$1" -h | command sed -e "s/#$//")' -- "$cur") ) [[ $COMPREPLY == --i ]] && compopt -o nospace return fi @@ -22,8 +22,7 @@ _zopfli() local IFS=$'\n' xspec="*.@(gz|t[ag]z)" compopt -o filenames - COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ - $( compgen -d -- "$cur" ) ) + COMPREPLY=( $(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur") ) } && complete -F _zopfli zopfli diff --git a/completions/zopflipng b/completions/zopflipng index 88ddbe68..3d815404 100644 --- a/completions/zopflipng +++ b/completions/zopflipng @@ -10,7 +10,7 @@ _zopflipng() return ;; --splitting) - COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '{0..3}' -- "$cur") ) return ;; esac @@ -18,13 +18,13 @@ _zopflipng() $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( _parse_help "$1" -h ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]%:}' -- "$cur" ) ) + COMPREPLY=( $(_parse_help "$1" -h) ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]%:}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi - if [[ ${words[@]} != *\ --prefix=* ]]; then + if [[ "${words[*]}" != *\ --prefix=* ]]; then # 2 png args only if --prefix not given local args _count_args diff --git a/configure.ac b/configure.ac index 3be96fdf..1f3b37e8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,9 @@ AC_PREREQ([2.60]) -AC_INIT([bash-completion], [2.8]) -AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip -Wall -Werror]) +AC_INIT([bash-completion], [2.9]) +AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip -Wall -Wno-portability -Werror]) AC_PROG_LN_S AC_PROG_MKDIR_P +AC_PROG_SED AC_SUBST(compatdir, $sysconfdir/bash_completion.d) AC_CONFIG_FILES([ Makefile @@ -10,8 +11,7 @@ completions/Makefile doc/Makefile helpers/Makefile test/Makefile -bash-completion.pc -bash-completion-config.cmake -bash-completion-config-version.cmake +test/t/Makefile +test/t/unit/Makefile ]) AC_OUTPUT diff --git a/doc/testing.txt b/doc/testing.txt index 2ce7f373..c3a1f00a 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -7,23 +7,37 @@ The bash-completion package contains an automated test suite. Running the tests should help verifying that bash-completion works as expected. The tests are also very helpful in uncovering software regressions at an early stage. -The bash-completion test suite is written on top of the +The original, "legacy" bash-completion test suite is written on top of the http://www.gnu.org/software/dejagnu/[DejaGnu] testing framework. DejaGnu is written in http://expect.nist.gov[Expect], which in turn uses http://tcl.sourceforge.net[Tcl] -- Tool command language. +Most of the test framework has been ported over to use +https://pytest.org/[pytest] and https://pexpect.readthedocs.io/[pexpect]. +Eventually, all of it should be ported. + Coding Style Guide ------------------ -The bash-completion test suite tries to adhere to this +For the Python part, all of it is formatted using +https://github.com/ambv/black[Black], and we also run +http://flake8.pycqa.org/[Flake8] on it. + +The legacy test suite tries to adhere to this http://wiki.tcl.tk/708[Tcl Style Guide]. Installing dependencies ----------------------- -Installing dependencies should be easy using your local package manager. +Installing dependencies should be easy using your local package manager or +`pip`. Python 3.4 or newer is required, and the rest of the Python package +dependencies are specified in the `test/requirements.txt` file. If using `pip`, +this file can be fed directly to it, e.g. like: +------------------------------------ +pip install -r test/requirements.txt +------------------------------------ Debian/Ubuntu @@ -31,29 +45,31 @@ Debian/Ubuntu On Debian/Ubuntu you can use `apt-get`: ------------- -sudo apt-get install dejagnu tcllib +sudo apt-get install python3-pytest python3-pexpect dejagnu tcllib ------------- -This should also install the necessary `expect` and `tcl` packages. +This should also install the necessary dependencies. Only Debian testing +(buster) and Ubuntu 18.10 (cosmic) and later have an appropriate version +of pytest in the repositories. Fedora/RHEL/CentOS ~~~~~~~~~~~~~~~~~~ -On Fedora and RHEL/CentOS (with EPEL) you can use `yum`: +On Fedora and RHEL/CentOS (with EPEL) you can try `yum` or `dnf`: ------------- -sudo yum install dejagnu tcllib +sudo yum install python3-pytest python3-pexpect dejagnu tcllib ------------- -This should also install the necessary `expect` and `tcl` packages. +This should also install the necessary dependencies. At time of writing, only +Fedora 29 comes with recent enough pytest. Structure --------- +Pytest tests are in the `t/` subdirectory, with `t/test_\*.py` being +completion tests, and `t/unit/test_unit_\*.py` unit tests. -Main areas (DejaGnu tools) -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The tests are grouped into different areas, called _tool_ in DejaGnu: +Legacy tests are grouped into different areas, called _tool_ in DejaGnu: *completion*:: Functional tests per completion. @@ -63,60 +79,17 @@ The tests are grouped into different areas, called _tool_ in DejaGnu: *unit*:: Unit tests for bash-completion helper functions. -Each tool has a slightly different way of loading the test fixtures, see -<<Test_context,Test context>> below. - - -Completion -~~~~~~~~~~ - -Completion tests are spread over two directories: `completion/\*.exp` calls -completions in `lib/completions/\*.exp`. This two-file system stems from -bash-completion-lib (http://code.google.com/p/bash-completion-lib/, containing -dynamic loading of completions) where tests are run twice per completion; once -before dynamic loading and a second time after to confirm that all dynamic -loading has gone well. - -For example: - ----- -set test "Completion via comp_load() should be installed" -set cmd "complete -p awk" -send "$cmd\r" -expect { - -re "^$cmd\r\ncomplete -o filenames -F comp_load awk\r\n/@$" { pass "$test" } - -re /@ { fail "$test at prompt" } -} - - -source "lib/completions/awk.exp" - - -set test "Completion via _longopt() should be installed" -set cmd "complete -p awk" -send "$cmd\r" -expect { - -re "^$cmd\r\ncomplete -o filenames -F _longopt awk\r\n/@$" { pass "$test" } - -re /@ { fail "$test at prompt" } -} - - -source "lib/completions/awk.exp" ----- - -Looking to the completion tests from a broader perspective, every test for a -command has two stages which are now reflected in the two files: - -. Tests concerning the command completions' environment (typically in -`test/completion/foo`) -. Tests invoking actual command completion (typically in -`test/lib/completions/foo`) - Running the tests ----------------- -The tests are run by calling `runtest` command in the test directory: +Python based tests are run by calling `pytest` on the desired test directories +or individual files, for example in the project root directory: +----------------------- +pytest test/t +----------------------- + +Legacy tests are run by calling `runtest` command in the test directory: ----------------------- runtest --outdir log --tool completion runtest --outdir log --tool install @@ -136,80 +109,15 @@ To run a particular test, specify file name of your test as an argument to ----------------------- That will run `test/completion/ssh.exp`. +See `test/docker/docker-script.sh` for how and what we run and test in CI. -Running tests via cron -~~~~~~~~~~~~~~~~~~~~~~ - -The test suite requires a connected terminal (tty). When invoked via cron, no -tty is connected and the test suite may respond with this error: ---------------------------------------------- -can't read "multipass_name": no such variable ---------------------------------------------- - -To run the tests successfully via cron, connect a terminal by redirecting -stdin from a tty, e.g. /dev/tty40. (In Linux, you can press alt-Fx or -ctrl-alt-Fx to switch the console from /dev/tty1 to tty7. There are many more -/dev/tty* which are not accessed via function keys. To be safe, use a tty -greater than tty7) - ----------------------- -./runUnit < /dev/tty40 ----------------------- - -If the process doesn't run as root (recommended), root will have to change the -owner and permissions of the tty: -------------------------- -sudo chmod o+r /dev/tty40 -------------------------- - -To make this permission permanent (at least on Debian) - and not revert back on -reboot - create the file `/etc/udev/rules.d/10-mydejagnu.rules`, containing: ----------------------------- -KERNEL=="tty40", MODE="0666" ----------------------------- - -To start the test at 01:00, set the crontab to this: ----------------------------- -* 1 * * * cd bash-completion/test && ./cron.sh < /dev/tty40 ----------------------------- - -Here's an example batch file `cron.sh`, to be put in the bash-completion `test` -directory. This batch file only e-mails the output of each test-run if the -test-run fails. - -[source,bash] ---------------------------------------------------------------------- -#!/bin/sh - -set -e # Exit if simple command fails -set -u # Error if variable is undefined - -LOG=/tmp/bash-completion.log~ - - # Retrieve latest sources -git pull - - # Run tests on bash-4 - -./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 ---------------------------------------------------------------------- Specifying bash binary ~~~~~~~~~~~~~~~~~~~~~~ -The test suite standard uses `bash` as found in the tcl path (/bin/bash). -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.3/bin/bash ----------------- - - +The test suite standard uses `bash` as found in PATH. Export the +`bashcomp_bash` environment variable with a path to another bash executable if +you want to test against something else. Maintenance @@ -219,218 +127,10 @@ Maintenance Adding a completion test ~~~~~~~~~~~~~~~~~~~~~~~~ -You can run `cd test && ./generate cmd` to add a test for the `cmd` command. -This will add two files with a very basic tests: ----------------------------------- -test/completion/cmd.exp -test/lib/completions/cmd.exp ----------------------------------- -Place any additional tests into `test/lib/completions/cmd.exp`. - - -Fixing a completion test -~~~~~~~~~~~~~~~~~~~~~~~~ -Let's consider this real-life example where an ssh completion bug is fixed. -First you're triggered by unsuccessful tests: - ----------------------------------- -$ ./runCompletion -... - === completion Summary === - -# of expected passes 283 -# of unexpected failures 8 -# of unresolved testcases 2 -# of unsupported tests 47 ----------------------------------- - -Take a look in `log/completion.log` to find out which specific command is -failing. - ------------------------ -$ vi log/completion.log ------------------------ - -Search for `UNRESOLVED` or `FAIL`. From there scroll up to see which `.exp` -test is failing: - ---------------------------------------------------------- -/@Running ./completion/ssh.exp ... -... -UNRESOLVED: Tab should complete ssh known-hosts at prompt ---------------------------------------------------------- - -In this case it appears `ssh.exp` is causing the problem. Isolate the `ssh` -tests by specifying just `ssh.exp` to run. Furthermore add the `--debug` flag, -so output gets logged in `dbg.log`: - ----------------------------------- -$ ./runCompletion ssh.exp --debug -... - === completion Summary === - -# of expected passes 1 -# of unresolved testcases 1 ----------------------------------- - -Now we can have a detailed look in `dbg.log` to find out what's going wrong. -Open `dbg.log` and search for `UNRESOLVED` (or `FAIL` if that's what you're -looking for): - ---------------------------------------------------------- -UNRESOLVED: Tab should complete ssh known-hosts at prompt ---------------------------------------------------------- - -From there, search up for the first line saying: - -------------------------------------------------- -expect: does "..." match regular expression "..." -------------------------------------------------- - -This tells you where the actual output differs from the expected output. In -this case it looks like the test "ssh -F fixtures/ssh/config <TAB>" is -expecting just hostnames, whereas the actual completion is containing commands -- but no hostnames. -So what should be expected after "ssh -F fixtures/ssh/config <TAB>" are *both* -commands and hostnames. This means both the test and the completion need -fixing. Let's start with the test. - ----------------------------- -$ vi lib/completions/ssh.exp ----------------------------- - -Search for the test "Tab should complete ssh known-hosts". Here you could've -seen that what was expected were hostnames ($hosts): - ------------------------------------------ -set expected "^$cmd\r\n$hosts\r\n/@$cmd$" ------------------------------------------ - -Adding *all* commands (which could well be over 2000) to 'expected', seems a -bit overdone so we're gonna change things here. Lets expect the unit test for -`_known_hosts` assures all hosts are returned. Then all we need to do here is -expect one host and one command, just to be kind of sure that both hosts and -commands are completed. - -Looking in the fixture for ssh: - ------------------------------ -$ vi fixtures/ssh/known_hosts ------------------------------ - -it looks like we can add an additional host 'ls_known_host'. Now if we would -perform the test "ssh -F fixtures/ssh/config ls<TAB>" both the command `ls` and -the host `ls_known_host` should come up. Let's modify the test so: - --------------------------------------------------------- -$ vi lib/completions/ssh.exp -... -set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$" --------------------------------------------------------- - -Running the test reveals we still have an unresolved test: - ----------------------------------- -$ ./runCompletion ssh.exp --debug -... - === completion Summary === - -# of expected passes 1 -# of unresolved testcases 1 ----------------------------------- - -But if now look into the log file `dbg.log` we can see the completion only -returns commands starting with 'ls' but fails to match our regular expression -which also expects the hostname `ls_known_host': - ------------------------ -$ vi dbg.log -... -expect: does "ssh -F fixtures/ssh/config ls\r\nls lsattr lsb_release lshal lshw lsmod lsof lspci lspcmcia lspgpot lss16toppm\r\nlsusb\r\n/@ssh -F fixtures/ssh/config ls" (spawn_id exp9) match regular expression "^ssh -F fixtures/ssh/config ls\r\n.*ls.*ls_known_host.*\r\n/@ssh -F fixtures/ssh/config ls$"? no ------------------------ - -Now let's fix ssh completion: - -------------------- -$ vi ../contrib/ssh -... -------------------- - -until the test shows: - ----------------------------------- -$ ./runCompletion ssh.exp -... - === completion Summary === - -# of expected passes 2 ----------------------------------- - -Fixing a unit test -~~~~~~~~~~~~~~~~~~ -Now let's consider a unit test failure. First you're triggered by unsuccessful -tests: - ----------------------------------- -$ ./runUnit -... - === unit Summary === - -# of expected passes 1 -# of unexpected failures 1 ----------------------------------- - -Take a look in `log/unit.log` to find out which specific command is failing. - ------------------ -$ vi log/unit.log ------------------ - -Search for `UNRESOLVED` or `FAIL`. From there scroll up to see which `.exp` -test is failing: - ------------------------------------------- -/@Running ./unit/_known_hosts_real.exp ... -... -FAIL: Environment should stay clean ------------------------------------------- - -In this case it appears `_known_hosts_real.exp` is causing the problem. -Isolate the `_known_hosts_real` test by specifying just `_known_hosts_real.exp` -to run. Furthermore add the `--debug` flag, so output gets logged in -`dbg.log`: - ----------------------------------- -$ ./runUnit _known_hosts_real.exp --debug -... - === completion Summary === - -# of expected passes 1 -# of unexpected failures 1 ----------------------------------- - -Now, if we haven't already figured out the problem, we can have a detailed look -in `dbg.log` to find out what's going wrong. Open `dbg.log` and search for -`UNRESOLVED` (or `FAIL` if that's what you're looking for): - ------------------------------------ -FAIL: Environment should stay clean ------------------------------------ - -From there, search up for the first line saying: - -------------------------------------------------- -expect: does "..." match regular expression "..." -------------------------------------------------- - -This tells you where the actual output differs from the expected output. In -this case it looks like the the function `_known_hosts_real` is unexpectedly -modifying global variables `cur` and `flag`. In case you need to modify the -test: - ------------------------------------ -$ vi lib/unit/_known_hosts_real.exp ------------------------------------ +You can run `cd test && ./generate cmd` to add a test for the `cmd` +command. Additional arguments will be passed to the first generated test case. +This will add the `test/t/test_cmd.py` file with a very basic test, and add it +to `test/t/Makefile.am`. Add additional tests to the generated file. Rationale --------- @@ -449,124 +149,3 @@ script/generate ^^^^^^^^^^^^^^^ The name and location of this code generation script come from Ruby on Rails' http://en.wikibooks.org/wiki/Ruby_on_Rails/Tools/Generators[script/generate]. - - - - -== Reference - -Within test scripts the following library functions can be used: - -[[Test_context]] -== Test context - -The test environment needs to be put to fixed states when testing. For -instance the bash prompt (PS1) is set to the current test directory, followed -by an at sign (@). The default settings for `bash` reside in `config/bashrc` -and `config/inputrc`. - -For each tool (completion, install, unit) a slightly different context is in -effect. - -=== What happens when tests are run? - -==== completion - -When the completions are tested, invoking DejaGnu will result in a call to -`completion_start()` which in turn will start `bash --rcfile config/bashrc`. - -.What happens when completion tests are run? ----- - | runtest --tool completion - V - +----------+-----------+ - | lib/completion.exp | - | lib/library.exp | - | config/default.exp | - +----------+-----------+ - : - V - +----------+-----------+ +---------------+ +----------------+ - | completion_start() +<---+ config/bashrc +<---| config/inputrc | - | (lib/completion.exp) | +---------------+ +----------------+ - +----------+-----------+ - | ,+----------------------------+ - | ,--+-+ "Actual completion tests" | - V / +------------------------------+ - +----------+-----------+ +-----------------------+ - | completion/*.exp +<---| lib/completions/*.exp | - +----------+-----------+ +-----------------------+ - | \ ,+--------------------------------+ - | `----------------------+-+ "Completion invocation tests" | - V +----------------------------------+ - +----------+-----------+ - | completion_exit() | - | (lib/completion.exp) | - +----------------------+ ----- -Setting up bash once within `completion_start()` has the speed advantage that -bash - and bash-completion - need only initialize once when testing multiple -completions, e.g.: ----- - runtest --tool completion alias.exp cd.exp ----- -==== install - -.What happens when install tests are run? ----- - | runtest --tool install - V - +----+----+ - | DejaGnu | - +----+----+ - | - V - +------------+---------------+ - | (file: config/default.exp) | - +------------+---------------+ - | - V - +------------+------------+ - | (file: lib/install.exp) | - +-------------------------+ ----- - -==== unit - -.What happens when unit tests are run? ----- - | runtest --tool unit - V - +----+----+ - | DejaGnu | - +----+----+ - | - V - +----------+-----------+ - | - | - | (file: lib/unit.exp) | - +----------------------+ ----- - -=== bashrc - -This is the bash configuration file (bashrc) used for testing: - -[source,bash] ---------------------------------------------------------------------- -include::bashrc[] ---------------------------------------------------------------------- - - -=== inputrc - -This is the readline configuration file (inputrc) used for testing: - -[source,bash] ---------------------------------------------------------------------- -include::inputrc[] ---------------------------------------------------------------------- - - -Index -===== diff --git a/extra/git-post-commit.sh b/extra/git-post-commit.sh new file mode 100755 index 00000000..18238585 --- /dev/null +++ b/extra/git-post-commit.sh @@ -0,0 +1,23 @@ +#!/bin/sh -e + +# Post-commit hook for triggering bash-completion Docker Hub test image +# builds at https://hub.docker.com/r/vskytta/bash-completion/ +# +# To enable: ln -s ../../extra/git-post-commit.sh .git/hooks/post-commit +# +# The bash-completion.docker-hub-trigger-url config option must be set to +# the full Docker Hub build trigger URL to hit. + +url=$(git config bash-completion.docker-hub-trigger-url) + +test "$(git symbolic-ref --short HEAD 2>/dev/null)" = master + +git diff-tree -r --name-only --no-commit-id HEAD | \ + grep -qxE 'completions/Makefile\.am|test/requirements\.txt' + +curl \ + --silent --show-error \ + --max-time 30 \ + --header Content-Type:application/json \ + --data '{"build":true}' \ + $url >/dev/null diff --git a/extra/git-pre-push.sh b/extra/git-pre-push.sh new file mode 100755 index 00000000..27de6013 --- /dev/null +++ b/extra/git-pre-push.sh @@ -0,0 +1,41 @@ +#!/bin/sh -e + +# Pre-push hook for triggering bash-completion Docker Hub test image +# builds at https://hub.docker.com/r/vskytta/bash-completion/ +# +# To enable: ln -s ../../extra/git-pre-push.sh .git/hooks/pre-push +# +# The bash-completion.docker-hub-trigger-url config option must be set to +# the full Docker Hub build trigger URL to hit. + +url=$(git config bash-completion.docker-hub-trigger-url) || exit 0 + +branch=master +files="completions/Makefile\.am|test/requirements\.txt" + +trigger=false +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha; do + case $remote_ref in */$branch) ;; *) continue ;; esac + [ $local_sha != $z40 ] || continue # delete not handled (yet?) + if [ $remote_sha = $z40 ]; then + list_files="git ls-tree -r --name-only $local_sha" + else + list_files="git diff --name-only $remote_sha..$local_sha" + fi + ! $list_files | grep -qEx $files || { trigger=true; break; } +done + +if $trigger; then + cat <<EOF | at -M now + sleep 15 + curl \ + --silent --show-error \ + --max-time 30 \ + --header Content-Type:application/json \ + --data '{"build":true}' \ + $url 2>&1 \ + | logger -e --tag bash-completion-pre-push +EOF +fi diff --git a/helpers/perl b/helpers/perl index 2a01a096..83ab1a10 100644 --- a/helpers/perl +++ b/helpers/perl @@ -15,33 +15,36 @@ sub print_modules_real { # (the shorter being the pattern to be used as the regexp) # word 'Fi', base 'File' -> match 'File' against 'Fi' # word 'File::Sp', base 'File' -> match 'File::Sp' against 'File' - return if - $base && - $word && - $base !~ /^\Q$word/ && - $word !~ /^\Q$base/; + return + if $base + && $word + && $base !~ /^\Q$word/ + && $word !~ /^\Q$base/; chdir($dir) or return; # print each file - foreach my $file (sort(glob('*.pm'),glob('*.pod'))) { + 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}++; - print $module . "\n"; + print $module, "\n"; } # recurse in each subdirectory - foreach my $directory (grep { -d } glob('*')) { + foreach my $directory (grep {-d} glob('*')) { my $subdir = $dir . '/' . $directory; if ($directory =~ /^(?:[.\d]+|$Config{archname}|auto)$/) { + # exclude subdirectory name from base print_modules_real(undef, $subdir, $word, $include_pod); } else { + # add subdirectory name to base - print_modules_real($base . $directory . '::', $subdir, $word, $include_pod); + print_modules_real($base . $directory . '::', + $subdir, $word, $include_pod); } } } @@ -60,7 +63,7 @@ sub print_functions { my ($word) = @_; my $perlfunc; - for ( @INC, undef ) { + for (@INC, undef) { return if not defined; $perlfunc = catfile $_, qw( pod perlfunc.pod ); last if -r $perlfunc; @@ -69,16 +72,16 @@ sub print_functions { open my $fh, '<', $perlfunc or return; my $nest_level = -1; - while ( <$fh> ) { + while (<$fh>) { next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/; ++$nest_level if /^=over/; --$nest_level if /^=back/; - next if $nest_level; + next if $nest_level; next unless /^=item (-?\w+)/; my $function = $1; next if $function !~ /^\Q$word/; next if $seen{$function}++; - print $function . "\n"; + print $function, "\n"; } } @@ -93,4 +96,3 @@ if ($type eq 'functions') { } elsif ($type eq 'perldocs') { print_modules($word, 1); } - diff --git a/helpers/python b/helpers/python index b6c4d5ed..9e268252 100644 --- a/helpers/python +++ b/helpers/python @@ -11,4 +11,4 @@ else: walker = pkgutil.iter_modules for mod in walker(): - print(mod[1]) + print (mod[1]) # noqa: E211 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..2581528c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +line-length = 79 +target-version = ["py34", "py35", "py36", "py37", "py38"] diff --git a/test/.gitignore b/test/.gitignore index 2ea9dc1e..aa9a8096 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,4 +1,7 @@ +log/ +tmp/ dbg.log xtrace.log site.exp site.bak +pytestdebug.log diff --git a/test/Makefile.am b/test/Makefile.am index 19d75573..454f1ecd 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,9 @@ +AUTOMAKE_OPTIONS = dejagnu DEJATOOL = completion install unit AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log +SUBDIRS = t + EXTRA_DIST = completion \ config \ fixtures \ @@ -10,7 +13,8 @@ EXTRA_DIST = completion \ all: $(MKDIR_P) log tmp -distclean-local: - rm -rf log tmp +CLEANFILES = \ + fixtures/make/extra_makefile -AUTOMAKE_OPTIONS = dejagnu +clean-local: + $(RM) -rf log tmp diff --git a/test/completion/2to3.exp b/test/completion/2to3.exp deleted file mode 100644 index 9efdd77e..00000000 --- a/test/completion/2to3.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions 2to3 diff --git a/test/completion/7z.exp b/test/completion/7z.exp deleted file mode 100644 index 0796b7a5..00000000 --- a/test/completion/7z.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions 7z diff --git a/test/completion/a2ps.exp b/test/completion/a2ps.exp deleted file mode 100644 index 06927b56..00000000 --- a/test/completion/a2ps.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions a2ps diff --git a/test/completion/a2x.exp b/test/completion/a2x.exp deleted file mode 100644 index 5d4098f1..00000000 --- a/test/completion/a2x.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions a2x diff --git a/test/completion/abook.exp b/test/completion/abook.exp deleted file mode 100644 index eaa4b308..00000000 --- a/test/completion/abook.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions abook diff --git a/test/completion/aclocal.exp b/test/completion/aclocal.exp deleted file mode 100644 index 477921a9..00000000 --- a/test/completion/aclocal.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions aclocal diff --git a/test/completion/acpi.exp b/test/completion/acpi.exp deleted file mode 100644 index 934f6d1c..00000000 --- a/test/completion/acpi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions acpi diff --git a/test/completion/acroread.exp b/test/completion/acroread.exp deleted file mode 100644 index e23e98dd..00000000 --- a/test/completion/acroread.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions acroread diff --git a/test/completion/adb.exp b/test/completion/adb.exp deleted file mode 100644 index 0da0ad12..00000000 --- a/test/completion/adb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions adb diff --git a/test/completion/add_members.exp b/test/completion/add_members.exp deleted file mode 100644 index 17aacd0a..00000000 --- a/test/completion/add_members.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions add_members diff --git a/test/completion/alpine.exp b/test/completion/alpine.exp deleted file mode 100644 index 04ac8b01..00000000 --- a/test/completion/alpine.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions alpine diff --git a/test/completion/animate.exp b/test/completion/animate.exp deleted file mode 100644 index 2f4e749e..00000000 --- a/test/completion/animate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions animate diff --git a/test/completion/ant.exp b/test/completion/ant.exp deleted file mode 100644 index ad6996bd..00000000 --- a/test/completion/ant.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ant diff --git a/test/completion/apache2ctl.exp b/test/completion/apache2ctl.exp deleted file mode 100644 index f3d5d771..00000000 --- a/test/completion/apache2ctl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions apache2ctl diff --git a/test/completion/appdata-validate.exp b/test/completion/appdata-validate.exp deleted file mode 100644 index 5fae5959..00000000 --- a/test/completion/appdata-validate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions appdata-validate diff --git a/test/completion/apt-build.exp b/test/completion/apt-build.exp deleted file mode 100644 index 48bbe583..00000000 --- a/test/completion/apt-build.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions apt-build diff --git a/test/completion/apt-cache.exp b/test/completion/apt-cache.exp deleted file mode 100644 index 901c5e87..00000000 --- a/test/completion/apt-cache.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions apt-cache diff --git a/test/completion/apt-get.exp b/test/completion/apt-get.exp deleted file mode 100644 index 04fbf631..00000000 --- a/test/completion/apt-get.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions apt-get diff --git a/test/completion/aptitude.exp b/test/completion/aptitude.exp deleted file mode 100644 index 6afbacc8..00000000 --- a/test/completion/aptitude.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions aptitude diff --git a/test/completion/arch.exp b/test/completion/arch.exp deleted file mode 100644 index 25cda56f..00000000 --- a/test/completion/arch.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/arping.exp b/test/completion/arping.exp deleted file mode 100644 index 5a64b1a3..00000000 --- a/test/completion/arping.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions arping diff --git a/test/completion/arpspoof.exp b/test/completion/arpspoof.exp deleted file mode 100644 index d4f9341e..00000000 --- a/test/completion/arpspoof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions arpspoof diff --git a/test/completion/asciidoc.exp b/test/completion/asciidoc.exp deleted file mode 100644 index 05b3f1f2..00000000 --- a/test/completion/asciidoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions asciidoc diff --git a/test/completion/aspell.exp b/test/completion/aspell.exp deleted file mode 100644 index 5592574f..00000000 --- a/test/completion/aspell.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions aspell diff --git a/test/completion/autoconf.exp b/test/completion/autoconf.exp deleted file mode 100644 index 64942435..00000000 --- a/test/completion/autoconf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autoconf diff --git a/test/completion/autoheader.exp b/test/completion/autoheader.exp deleted file mode 100644 index b797371a..00000000 --- a/test/completion/autoheader.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autoheader diff --git a/test/completion/automake.exp b/test/completion/automake.exp deleted file mode 100644 index af412413..00000000 --- a/test/completion/automake.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions automake diff --git a/test/completion/autoreconf.exp b/test/completion/autoreconf.exp deleted file mode 100644 index 337d11f7..00000000 --- a/test/completion/autoreconf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autoreconf diff --git a/test/completion/autorpm.exp b/test/completion/autorpm.exp deleted file mode 100644 index 5931bdb1..00000000 --- a/test/completion/autorpm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autorpm diff --git a/test/completion/autoscan.exp b/test/completion/autoscan.exp deleted file mode 100644 index 9fc76858..00000000 --- a/test/completion/autoscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autoscan diff --git a/test/completion/autoupdate.exp b/test/completion/autoupdate.exp deleted file mode 100644 index f56f4c6d..00000000 --- a/test/completion/autoupdate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions autoupdate diff --git a/test/completion/avctrl.exp b/test/completion/avctrl.exp deleted file mode 100644 index ea323c51..00000000 --- a/test/completion/avctrl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions avctrl diff --git a/test/completion/awk.exp b/test/completion/awk.exp deleted file mode 100644 index 42572591..00000000 --- a/test/completion/awk.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions awk diff --git a/test/completion/badblocks.exp b/test/completion/badblocks.exp deleted file mode 100644 index 74bfcd5d..00000000 --- a/test/completion/badblocks.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions badblocks diff --git a/test/completion/base64.exp b/test/completion/base64.exp deleted file mode 100644 index 2f5f6122..00000000 --- a/test/completion/base64.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions base64 diff --git a/test/completion/bash.exp b/test/completion/bash.exp deleted file mode 100644 index c00fc09b..00000000 --- a/test/completion/bash.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bash diff --git a/test/completion/bc.exp b/test/completion/bc.exp deleted file mode 100644 index 8b7a3d0b..00000000 --- a/test/completion/bc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bc diff --git a/test/completion/bind.exp b/test/completion/bind.exp deleted file mode 100644 index d93003b7..00000000 --- a/test/completion/bind.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bind diff --git a/test/completion/bison.exp b/test/completion/bison.exp deleted file mode 100644 index ac40cccc..00000000 --- a/test/completion/bison.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bison diff --git a/test/completion/bk.exp b/test/completion/bk.exp deleted file mode 100644 index 10540b7a..00000000 --- a/test/completion/bk.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bk diff --git a/test/completion/brctl.exp b/test/completion/brctl.exp deleted file mode 100644 index efb5a75a..00000000 --- a/test/completion/brctl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions brctl diff --git a/test/completion/btdownloadcurses.py.exp b/test/completion/btdownloadcurses.py.exp deleted file mode 100644 index fc9d95f7..00000000 --- a/test/completion/btdownloadcurses.py.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions btdownloadcurses.py diff --git a/test/completion/btdownloadgui.py.exp b/test/completion/btdownloadgui.py.exp deleted file mode 100644 index e617156b..00000000 --- a/test/completion/btdownloadgui.py.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions btdownloadgui.py diff --git a/test/completion/btdownloadheadless.py.exp b/test/completion/btdownloadheadless.py.exp deleted file mode 100644 index fc4f2561..00000000 --- a/test/completion/btdownloadheadless.py.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions btdownloadheadless.py diff --git a/test/completion/bzip2.exp b/test/completion/bzip2.exp deleted file mode 100644 index b3953144..00000000 --- a/test/completion/bzip2.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions bzip2 diff --git a/test/completion/c++.exp b/test/completion/c++.exp deleted file mode 100644 index b00bf8c2..00000000 --- a/test/completion/c++.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions c++ diff --git a/test/completion/cal.exp b/test/completion/cal.exp deleted file mode 100644 index 5fba48be..00000000 --- a/test/completion/cal.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cal diff --git a/test/completion/cancel.exp b/test/completion/cancel.exp deleted file mode 100644 index 67c47100..00000000 --- a/test/completion/cancel.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cancel diff --git a/test/completion/cardctl.exp b/test/completion/cardctl.exp deleted file mode 100644 index 99d0276b..00000000 --- a/test/completion/cardctl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cardctl diff --git a/test/completion/cat.exp b/test/completion/cat.exp deleted file mode 100644 index 15588ac7..00000000 --- a/test/completion/cat.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cat diff --git a/test/completion/cc.exp b/test/completion/cc.exp deleted file mode 100644 index af39132d..00000000 --- a/test/completion/cc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cc diff --git a/test/completion/ccache.exp b/test/completion/ccache.exp deleted file mode 100644 index 4d88bf98..00000000 --- a/test/completion/ccache.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ccache diff --git a/test/completion/ccze.exp b/test/completion/ccze.exp deleted file mode 100644 index 4ec83394..00000000 --- a/test/completion/ccze.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ccze diff --git a/test/completion/cdrecord.exp b/test/completion/cdrecord.exp deleted file mode 100644 index 9aaa7573..00000000 --- a/test/completion/cdrecord.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cdrecord diff --git a/test/completion/cfagent.exp b/test/completion/cfagent.exp deleted file mode 100644 index 21d71e20..00000000 --- a/test/completion/cfagent.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cfagent diff --git a/test/completion/cfrun.exp b/test/completion/cfrun.exp deleted file mode 100644 index f261c3ba..00000000 --- a/test/completion/cfrun.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cfrun diff --git a/test/completion/chage.exp b/test/completion/chage.exp deleted file mode 100644 index 32dc4409..00000000 --- a/test/completion/chage.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chage diff --git a/test/completion/change_pw.exp b/test/completion/change_pw.exp deleted file mode 100644 index aed916fb..00000000 --- a/test/completion/change_pw.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/check_db.exp b/test/completion/check_db.exp deleted file mode 100644 index cf136872..00000000 --- a/test/completion/check_db.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions check_db diff --git a/test/completion/check_perms.exp b/test/completion/check_perms.exp deleted file mode 100644 index 860e8d79..00000000 --- a/test/completion/check_perms.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions check_perms diff --git a/test/completion/checksec.exp b/test/completion/checksec.exp deleted file mode 100644 index 7e25e898..00000000 --- a/test/completion/checksec.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions checksec diff --git a/test/completion/chfn.exp b/test/completion/chfn.exp deleted file mode 100644 index c67743c2..00000000 --- a/test/completion/chfn.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chfn diff --git a/test/completion/chgrp.exp b/test/completion/chgrp.exp deleted file mode 100644 index 2b1d2251..00000000 --- a/test/completion/chgrp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chgrp diff --git a/test/completion/chkconfig.exp b/test/completion/chkconfig.exp deleted file mode 100644 index 38b4226d..00000000 --- a/test/completion/chkconfig.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chkconfig diff --git a/test/completion/chpasswd.exp b/test/completion/chpasswd.exp deleted file mode 100644 index 854266c1..00000000 --- a/test/completion/chpasswd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chpasswd diff --git a/test/completion/chronyc.exp b/test/completion/chronyc.exp deleted file mode 100644 index 9f7d8216..00000000 --- a/test/completion/chronyc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chronyc diff --git a/test/completion/chroot.exp b/test/completion/chroot.exp deleted file mode 100644 index 5cdf8f52..00000000 --- a/test/completion/chroot.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chroot diff --git a/test/completion/chrpath.exp b/test/completion/chrpath.exp deleted file mode 100644 index eee81ec7..00000000 --- a/test/completion/chrpath.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chrpath diff --git a/test/completion/chsh.exp b/test/completion/chsh.exp deleted file mode 100644 index 3caa0c55..00000000 --- a/test/completion/chsh.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions chsh diff --git a/test/completion/ci.exp b/test/completion/ci.exp deleted file mode 100644 index 03e417a1..00000000 --- a/test/completion/ci.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ci diff --git a/test/completion/ciptool.exp b/test/completion/ciptool.exp deleted file mode 100644 index 206f21c6..00000000 --- a/test/completion/ciptool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ciptool diff --git a/test/completion/civclient.exp b/test/completion/civclient.exp deleted file mode 100644 index 9ad3a3a6..00000000 --- a/test/completion/civclient.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions civclient diff --git a/test/completion/civserver.exp b/test/completion/civserver.exp deleted file mode 100644 index d590e0c6..00000000 --- a/test/completion/civserver.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions civserver diff --git a/test/completion/cksfv.exp b/test/completion/cksfv.exp deleted file mode 100644 index 293096f7..00000000 --- a/test/completion/cksfv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cksfv diff --git a/test/completion/cleanarch.exp b/test/completion/cleanarch.exp deleted file mode 100644 index 504f6865..00000000 --- a/test/completion/cleanarch.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/clisp.exp b/test/completion/clisp.exp deleted file mode 100644 index f4203ef4..00000000 --- a/test/completion/clisp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions clisp diff --git a/test/completion/clone_member.exp b/test/completion/clone_member.exp deleted file mode 100644 index 04dcfe9f..00000000 --- a/test/completion/clone_member.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions clone_member diff --git a/test/completion/co.exp b/test/completion/co.exp deleted file mode 100644 index e8babba4..00000000 --- a/test/completion/co.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions co diff --git a/test/completion/compare.exp b/test/completion/compare.exp deleted file mode 100644 index d2ea0cc7..00000000 --- a/test/completion/compare.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions compare diff --git a/test/completion/complete.exp b/test/completion/complete.exp deleted file mode 100644 index 3872244f..00000000 --- a/test/completion/complete.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions complete diff --git a/test/completion/composite.exp b/test/completion/composite.exp deleted file mode 100644 index 0eaf6150..00000000 --- a/test/completion/composite.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions composite diff --git a/test/completion/config_list.exp b/test/completion/config_list.exp deleted file mode 100644 index 40986234..00000000 --- a/test/completion/config_list.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions config_list diff --git a/test/completion/configure.exp b/test/completion/configure.exp deleted file mode 100644 index 16130d48..00000000 --- a/test/completion/configure.exp +++ /dev/null @@ -1 +0,0 @@ -source "$::srcdir/lib/completions/configure.exp" diff --git a/test/completion/conjure.exp b/test/completion/conjure.exp deleted file mode 100644 index 687c6107..00000000 --- a/test/completion/conjure.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions conjure diff --git a/test/completion/convert.exp b/test/completion/convert.exp deleted file mode 100644 index 27fcc6d0..00000000 --- a/test/completion/convert.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions convert diff --git a/test/completion/cowsay.exp b/test/completion/cowsay.exp deleted file mode 100644 index b82d66d3..00000000 --- a/test/completion/cowsay.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cowsay diff --git a/test/completion/cp.exp b/test/completion/cp.exp deleted file mode 100644 index db7b6991..00000000 --- a/test/completion/cp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cp diff --git a/test/completion/cpan2dist.exp b/test/completion/cpan2dist.exp deleted file mode 100644 index c9913b3b..00000000 --- a/test/completion/cpan2dist.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cpan2dist diff --git a/test/completion/cpio.exp b/test/completion/cpio.exp deleted file mode 100644 index c3fae7ad..00000000 --- a/test/completion/cpio.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cpio diff --git a/test/completion/cppcheck.exp b/test/completion/cppcheck.exp deleted file mode 100644 index 1cfb9c56..00000000 --- a/test/completion/cppcheck.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cppcheck diff --git a/test/completion/createdb.exp b/test/completion/createdb.exp deleted file mode 100644 index db76b2cc..00000000 --- a/test/completion/createdb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions createdb diff --git a/test/completion/createuser.exp b/test/completion/createuser.exp deleted file mode 100644 index ad1c24c9..00000000 --- a/test/completion/createuser.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions createuser diff --git a/test/completion/crontab.exp b/test/completion/crontab.exp deleted file mode 100644 index 2a649491..00000000 --- a/test/completion/crontab.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions crontab diff --git a/test/completion/cryptsetup.exp b/test/completion/cryptsetup.exp deleted file mode 100644 index c28169af..00000000 --- a/test/completion/cryptsetup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cryptsetup diff --git a/test/completion/csplit.exp b/test/completion/csplit.exp deleted file mode 100644 index d1049855..00000000 --- a/test/completion/csplit.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions csplit diff --git a/test/completion/curl.exp b/test/completion/curl.exp deleted file mode 100644 index e8bf2135..00000000 --- a/test/completion/curl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions curl diff --git a/test/completion/cut.exp b/test/completion/cut.exp deleted file mode 100644 index 87858132..00000000 --- a/test/completion/cut.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cut diff --git a/test/completion/cvs.exp b/test/completion/cvs.exp deleted file mode 100644 index 3515047a..00000000 --- a/test/completion/cvs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cvs diff --git a/test/completion/cvsps.exp b/test/completion/cvsps.exp deleted file mode 100644 index e6e3173c..00000000 --- a/test/completion/cvsps.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions cvsps diff --git a/test/completion/date.exp b/test/completion/date.exp deleted file mode 100644 index 098ca455..00000000 --- a/test/completion/date.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions date diff --git a/test/completion/dcop.exp b/test/completion/dcop.exp deleted file mode 100644 index d0d0fcc0..00000000 --- a/test/completion/dcop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dcop diff --git a/test/completion/dd.exp b/test/completion/dd.exp deleted file mode 100644 index e53ab66d..00000000 --- a/test/completion/dd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dd diff --git a/test/completion/declare.exp b/test/completion/declare.exp deleted file mode 100644 index a62f9891..00000000 --- a/test/completion/declare.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions declare diff --git a/test/completion/deja-dup.exp b/test/completion/deja-dup.exp deleted file mode 100644 index b2dc288d..00000000 --- a/test/completion/deja-dup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions deja-dup diff --git a/test/completion/desktop-file-validate.exp b/test/completion/desktop-file-validate.exp deleted file mode 100644 index e026a68c..00000000 --- a/test/completion/desktop-file-validate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions desktop-file-validate diff --git a/test/completion/df.exp b/test/completion/df.exp deleted file mode 100644 index 3840252d..00000000 --- a/test/completion/df.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions df diff --git a/test/completion/dfutool.exp b/test/completion/dfutool.exp deleted file mode 100644 index 0859f07e..00000000 --- a/test/completion/dfutool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dfutool diff --git a/test/completion/dhclient.exp b/test/completion/dhclient.exp deleted file mode 100644 index ef8b6a85..00000000 --- a/test/completion/dhclient.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dhclient diff --git a/test/completion/dict.exp b/test/completion/dict.exp deleted file mode 100644 index 0860b228..00000000 --- a/test/completion/dict.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dict diff --git a/test/completion/diff.exp b/test/completion/diff.exp deleted file mode 100644 index 63e11c74..00000000 --- a/test/completion/diff.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions diff diff --git a/test/completion/dir.exp b/test/completion/dir.exp deleted file mode 100644 index fa4c12fd..00000000 --- a/test/completion/dir.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dir diff --git a/test/completion/display.exp b/test/completion/display.exp deleted file mode 100644 index a37de277..00000000 --- a/test/completion/display.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions display diff --git a/test/completion/dmesg.exp b/test/completion/dmesg.exp deleted file mode 100644 index 1eca1e5b..00000000 --- a/test/completion/dmesg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dmesg diff --git a/test/completion/dnsspoof.exp b/test/completion/dnsspoof.exp deleted file mode 100644 index c7110c58..00000000 --- a/test/completion/dnsspoof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dnsspoof diff --git a/test/completion/dot.exp b/test/completion/dot.exp deleted file mode 100644 index d12422c1..00000000 --- a/test/completion/dot.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dot diff --git a/test/completion/dpkg-deb.exp b/test/completion/dpkg-deb.exp deleted file mode 100644 index 4f113ec0..00000000 --- a/test/completion/dpkg-deb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dpkg-deb diff --git a/test/completion/dpkg-reconfigure.exp b/test/completion/dpkg-reconfigure.exp deleted file mode 100644 index 8d22071a..00000000 --- a/test/completion/dpkg-reconfigure.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dpkg-reconfigure diff --git a/test/completion/dpkg-source.exp b/test/completion/dpkg-source.exp deleted file mode 100644 index 4a7badf8..00000000 --- a/test/completion/dpkg-source.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dpkg-source diff --git a/test/completion/dpkg.exp b/test/completion/dpkg.exp deleted file mode 100644 index 934c3474..00000000 --- a/test/completion/dpkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dpkg diff --git a/test/completion/dropdb.exp b/test/completion/dropdb.exp deleted file mode 100644 index ce35fd5c..00000000 --- a/test/completion/dropdb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dropdb diff --git a/test/completion/dropuser.exp b/test/completion/dropuser.exp deleted file mode 100644 index 1be7988a..00000000 --- a/test/completion/dropuser.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dropuser diff --git a/test/completion/dselect.exp b/test/completion/dselect.exp deleted file mode 100644 index 716b6a26..00000000 --- a/test/completion/dselect.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dselect diff --git a/test/completion/dsniff.exp b/test/completion/dsniff.exp deleted file mode 100644 index 452beebb..00000000 --- a/test/completion/dsniff.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dsniff diff --git a/test/completion/du.exp b/test/completion/du.exp deleted file mode 100644 index ec7a9946..00000000 --- a/test/completion/du.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions du diff --git a/test/completion/dumpdb.exp b/test/completion/dumpdb.exp deleted file mode 100644 index 96aee537..00000000 --- a/test/completion/dumpdb.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/dumpe2fs.exp b/test/completion/dumpe2fs.exp deleted file mode 100644 index 22d1523c..00000000 --- a/test/completion/dumpe2fs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions dumpe2fs diff --git a/test/completion/e2freefrag.exp b/test/completion/e2freefrag.exp deleted file mode 100644 index 713ee236..00000000 --- a/test/completion/e2freefrag.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions e2freefrag diff --git a/test/completion/e2label.exp b/test/completion/e2label.exp deleted file mode 100644 index 2383c98e..00000000 --- a/test/completion/e2label.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions e2label diff --git a/test/completion/ebtables.exp b/test/completion/ebtables.exp deleted file mode 100644 index 34399189..00000000 --- a/test/completion/ebtables.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ebtables diff --git a/test/completion/eject.exp b/test/completion/eject.exp deleted file mode 100644 index 5f02e2ae..00000000 --- a/test/completion/eject.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions eject diff --git a/test/completion/enscript.exp b/test/completion/enscript.exp deleted file mode 100644 index 4ea7b029..00000000 --- a/test/completion/enscript.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions enscript diff --git a/test/completion/env.exp b/test/completion/env.exp deleted file mode 100644 index baf3f754..00000000 --- a/test/completion/env.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions env diff --git a/test/completion/eog.exp b/test/completion/eog.exp deleted file mode 100644 index bba23491..00000000 --- a/test/completion/eog.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions eog diff --git a/test/completion/ether-wake.exp b/test/completion/ether-wake.exp deleted file mode 100644 index 602ba271..00000000 --- a/test/completion/ether-wake.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ether-wake diff --git a/test/completion/evince.exp b/test/completion/evince.exp deleted file mode 100644 index 27376e06..00000000 --- a/test/completion/evince.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions evince diff --git a/test/completion/expand.exp b/test/completion/expand.exp deleted file mode 100644 index 1bb7dd6b..00000000 --- a/test/completion/expand.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions expand diff --git a/test/completion/explodepkg.exp b/test/completion/explodepkg.exp deleted file mode 100644 index 7d6ce793..00000000 --- a/test/completion/explodepkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions explodepkg diff --git a/test/completion/export.exp b/test/completion/export.exp deleted file mode 100644 index bab517a9..00000000 --- a/test/completion/export.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions export diff --git a/test/completion/faillog.exp b/test/completion/faillog.exp deleted file mode 100644 index 46d19d9a..00000000 --- a/test/completion/faillog.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions faillog diff --git a/test/completion/fbgs.exp b/test/completion/fbgs.exp deleted file mode 100644 index 38efcbe9..00000000 --- a/test/completion/fbgs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions fbgs diff --git a/test/completion/fbi.exp b/test/completion/fbi.exp deleted file mode 100644 index 36f8b8ea..00000000 --- a/test/completion/fbi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions fbi diff --git a/test/completion/feh.exp b/test/completion/feh.exp deleted file mode 100644 index 4613bfaf..00000000 --- a/test/completion/feh.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions feh diff --git a/test/completion/file-roller.exp b/test/completion/file-roller.exp deleted file mode 100644 index 2208ba14..00000000 --- a/test/completion/file-roller.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions file-roller diff --git a/test/completion/file.exp b/test/completion/file.exp deleted file mode 100644 index 92662f0a..00000000 --- a/test/completion/file.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions file diff --git a/test/completion/filefrag.exp b/test/completion/filefrag.exp deleted file mode 100644 index eeb5f8ce..00000000 --- a/test/completion/filefrag.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions filefrag diff --git a/test/completion/filesnarf.exp b/test/completion/filesnarf.exp deleted file mode 100644 index 20af6347..00000000 --- a/test/completion/filesnarf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions filesnarf diff --git a/test/completion/find.exp b/test/completion/find.exp deleted file mode 100644 index dc73012e..00000000 --- a/test/completion/find.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions find diff --git a/test/completion/find_member.exp b/test/completion/find_member.exp deleted file mode 100644 index c8e4548c..00000000 --- a/test/completion/find_member.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions find_member diff --git a/test/completion/flake8.exp b/test/completion/flake8.exp deleted file mode 100644 index 8050e8a8..00000000 --- a/test/completion/flake8.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions flake8 diff --git a/test/completion/fmt.exp b/test/completion/fmt.exp deleted file mode 100644 index 44ed2147..00000000 --- a/test/completion/fmt.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions fmt diff --git a/test/completion/fold.exp b/test/completion/fold.exp deleted file mode 100644 index eec92d33..00000000 --- a/test/completion/fold.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions fold diff --git a/test/completion/freebsd-update.exp b/test/completion/freebsd-update.exp deleted file mode 100644 index 80c35662..00000000 --- a/test/completion/freebsd-update.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions freebsd-update diff --git a/test/completion/freeciv-gtk2.exp b/test/completion/freeciv-gtk2.exp deleted file mode 100644 index 4f96469d..00000000 --- a/test/completion/freeciv-gtk2.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions freeciv-gtk2 diff --git a/test/completion/freeciv-server.exp b/test/completion/freeciv-server.exp deleted file mode 100644 index 92b25ed0..00000000 --- a/test/completion/freeciv-server.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions freeciv-server diff --git a/test/completion/freerdp.exp b/test/completion/freerdp.exp deleted file mode 100644 index 5ca649a2..00000000 --- a/test/completion/freerdp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xfreerdp diff --git a/test/completion/function.exp b/test/completion/function.exp deleted file mode 100644 index 04c6e2b2..00000000 --- a/test/completion/function.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions function diff --git a/test/completion/fusermount.exp b/test/completion/fusermount.exp deleted file mode 100644 index 7b9e0391..00000000 --- a/test/completion/fusermount.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions fusermount diff --git a/test/completion/g++.exp b/test/completion/g++.exp deleted file mode 100644 index 9635d93e..00000000 --- a/test/completion/g++.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions g++ diff --git a/test/completion/g4.exp b/test/completion/g4.exp deleted file mode 100644 index 7bf0b164..00000000 --- a/test/completion/g4.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions g4 diff --git a/test/completion/g77.exp b/test/completion/g77.exp deleted file mode 100644 index 9a78cac8..00000000 --- a/test/completion/g77.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions g77 diff --git a/test/completion/gcc.exp b/test/completion/gcc.exp deleted file mode 100644 index 749fafeb..00000000 --- a/test/completion/gcc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gcc diff --git a/test/completion/gcj.exp b/test/completion/gcj.exp deleted file mode 100644 index 88ca9ff3..00000000 --- a/test/completion/gcj.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gcj diff --git a/test/completion/gcl.exp b/test/completion/gcl.exp deleted file mode 100644 index ba2ff758..00000000 --- a/test/completion/gcl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gcl diff --git a/test/completion/gdb.exp b/test/completion/gdb.exp deleted file mode 100644 index 2b09307f..00000000 --- a/test/completion/gdb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gdb diff --git a/test/completion/genaliases.exp b/test/completion/genaliases.exp deleted file mode 100644 index bd33abb3..00000000 --- a/test/completion/genaliases.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/gendiff.exp b/test/completion/gendiff.exp deleted file mode 100644 index f3a3fe19..00000000 --- a/test/completion/gendiff.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gendiff diff --git a/test/completion/genisoimage.exp b/test/completion/genisoimage.exp deleted file mode 100644 index de3be5ba..00000000 --- a/test/completion/genisoimage.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions genisoimage diff --git a/test/completion/geoiplookup.exp b/test/completion/geoiplookup.exp deleted file mode 100644 index b2f6bcec..00000000 --- a/test/completion/geoiplookup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions geoiplookup diff --git a/test/completion/getconf.exp b/test/completion/getconf.exp deleted file mode 100644 index f1b010bd..00000000 --- a/test/completion/getconf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions getconf diff --git a/test/completion/getent.exp b/test/completion/getent.exp deleted file mode 100644 index 9abcfbbd..00000000 --- a/test/completion/getent.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions getent diff --git a/test/completion/gkrellm.exp b/test/completion/gkrellm.exp deleted file mode 100644 index 55422a0f..00000000 --- a/test/completion/gkrellm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gkrellm diff --git a/test/completion/gm.exp b/test/completion/gm.exp deleted file mode 100644 index 82177a28..00000000 --- a/test/completion/gm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gm diff --git a/test/completion/gmplayer.exp b/test/completion/gmplayer.exp deleted file mode 100644 index 0cea91c1..00000000 --- a/test/completion/gmplayer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gmplayer diff --git a/test/completion/gnatmake.exp b/test/completion/gnatmake.exp deleted file mode 100644 index eebb3c00..00000000 --- a/test/completion/gnatmake.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gnatmake diff --git a/test/completion/gnokii.exp b/test/completion/gnokii.exp deleted file mode 100644 index 4cd3055c..00000000 --- a/test/completion/gnokii.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gnokii diff --git a/test/completion/gnome-mplayer.exp b/test/completion/gnome-mplayer.exp deleted file mode 100644 index 79c0cb1e..00000000 --- a/test/completion/gnome-mplayer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gnome-mplayer diff --git a/test/completion/gpasswd.exp b/test/completion/gpasswd.exp deleted file mode 100644 index cf07a4de..00000000 --- a/test/completion/gpasswd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gpasswd diff --git a/test/completion/gpc.exp b/test/completion/gpc.exp deleted file mode 100644 index d7fdb9e7..00000000 --- a/test/completion/gpc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gpc diff --git a/test/completion/gperf.exp b/test/completion/gperf.exp deleted file mode 100644 index 2b87d664..00000000 --- a/test/completion/gperf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gperf diff --git a/test/completion/gpg.exp b/test/completion/gpg.exp deleted file mode 100644 index 694f5f87..00000000 --- a/test/completion/gpg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gpg diff --git a/test/completion/gpg2.exp b/test/completion/gpg2.exp deleted file mode 100644 index 4c44ed41..00000000 --- a/test/completion/gpg2.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gpg2 diff --git a/test/completion/gphoto2.exp b/test/completion/gphoto2.exp deleted file mode 100644 index 1eab94b0..00000000 --- a/test/completion/gphoto2.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gphoto2 diff --git a/test/completion/gprof.exp b/test/completion/gprof.exp deleted file mode 100644 index c63cc28b..00000000 --- a/test/completion/gprof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gprof diff --git a/test/completion/grep.exp b/test/completion/grep.exp deleted file mode 100644 index 945c3459..00000000 --- a/test/completion/grep.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions grep diff --git a/test/completion/groupadd.exp b/test/completion/groupadd.exp deleted file mode 100644 index 7cc8e386..00000000 --- a/test/completion/groupadd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions groupadd diff --git a/test/completion/groupdel.exp b/test/completion/groupdel.exp deleted file mode 100644 index 337a8310..00000000 --- a/test/completion/groupdel.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions groupdel diff --git a/test/completion/groupmems.exp b/test/completion/groupmems.exp deleted file mode 100644 index 6a34f902..00000000 --- a/test/completion/groupmems.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions groupmems diff --git a/test/completion/groupmod.exp b/test/completion/groupmod.exp deleted file mode 100644 index 74d92e6e..00000000 --- a/test/completion/groupmod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions groupmod diff --git a/test/completion/growisofs.exp b/test/completion/growisofs.exp deleted file mode 100644 index 57cb991b..00000000 --- a/test/completion/growisofs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions growisofs diff --git a/test/completion/grpck.exp b/test/completion/grpck.exp deleted file mode 100644 index db2caeea..00000000 --- a/test/completion/grpck.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions grpck diff --git a/test/completion/grub.exp b/test/completion/grub.exp deleted file mode 100644 index d50bf754..00000000 --- a/test/completion/grub.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions grub diff --git a/test/completion/gzip.exp b/test/completion/gzip.exp deleted file mode 100644 index e2a31c5f..00000000 --- a/test/completion/gzip.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions gzip diff --git a/test/completion/hciattach.exp b/test/completion/hciattach.exp deleted file mode 100644 index f85a3558..00000000 --- a/test/completion/hciattach.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hciattach diff --git a/test/completion/hciconfig.exp b/test/completion/hciconfig.exp deleted file mode 100644 index 5f109956..00000000 --- a/test/completion/hciconfig.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hciconfig diff --git a/test/completion/hcitool.exp b/test/completion/hcitool.exp deleted file mode 100644 index d30c564b..00000000 --- a/test/completion/hcitool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hcitool diff --git a/test/completion/hddtemp.exp b/test/completion/hddtemp.exp deleted file mode 100644 index f8c63d62..00000000 --- a/test/completion/hddtemp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hddtemp diff --git a/test/completion/head.exp b/test/completion/head.exp deleted file mode 100644 index 49235c2e..00000000 --- a/test/completion/head.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions head diff --git a/test/completion/hexdump.exp b/test/completion/hexdump.exp deleted file mode 100644 index 7bdc0d36..00000000 --- a/test/completion/hexdump.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hexdump diff --git a/test/completion/hid2hci.exp b/test/completion/hid2hci.exp deleted file mode 100644 index de78db2b..00000000 --- a/test/completion/hid2hci.exp +++ /dev/null @@ -1,3 +0,0 @@ -assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/lib/udev"} -assert_source_completions hid2hci -assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/host.exp b/test/completion/host.exp deleted file mode 100644 index 9866e1e1..00000000 --- a/test/completion/host.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions host diff --git a/test/completion/hostname.exp b/test/completion/hostname.exp deleted file mode 100644 index 3c6983ee..00000000 --- a/test/completion/hostname.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hostname diff --git a/test/completion/hping2.exp b/test/completion/hping2.exp deleted file mode 100644 index e9df7c2b..00000000 --- a/test/completion/hping2.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hping2 diff --git a/test/completion/hping3.exp b/test/completion/hping3.exp deleted file mode 100644 index 5ffb9b06..00000000 --- a/test/completion/hping3.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hping3 diff --git a/test/completion/htop.exp b/test/completion/htop.exp deleted file mode 100644 index c5372475..00000000 --- a/test/completion/htop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions htop diff --git a/test/completion/htpasswd.exp b/test/completion/htpasswd.exp deleted file mode 100644 index 08294f35..00000000 --- a/test/completion/htpasswd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions htpasswd diff --git a/test/completion/hwclock.exp b/test/completion/hwclock.exp deleted file mode 100644 index b0bdb8ed..00000000 --- a/test/completion/hwclock.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions hwclock diff --git a/test/completion/iconv.exp b/test/completion/iconv.exp deleted file mode 100644 index c4c5fb6f..00000000 --- a/test/completion/iconv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iconv diff --git a/test/completion/id.exp b/test/completion/id.exp deleted file mode 100644 index a4f81c84..00000000 --- a/test/completion/id.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions id diff --git a/test/completion/identify.exp b/test/completion/identify.exp deleted file mode 100644 index 59bd9d6a..00000000 --- a/test/completion/identify.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions identify diff --git a/test/completion/idn.exp b/test/completion/idn.exp deleted file mode 100644 index 5fccae3d..00000000 --- a/test/completion/idn.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions idn diff --git a/test/completion/ifdown.exp b/test/completion/ifdown.exp deleted file mode 100644 index f3f1a69d..00000000 --- a/test/completion/ifdown.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ifdown diff --git a/test/completion/iftop.exp b/test/completion/iftop.exp deleted file mode 100644 index 5ec1cb57..00000000 --- a/test/completion/iftop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iftop diff --git a/test/completion/ifup.exp b/test/completion/ifup.exp deleted file mode 100644 index 780794b2..00000000 --- a/test/completion/ifup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ifup diff --git a/test/completion/import.exp b/test/completion/import.exp deleted file mode 100644 index 682a5069..00000000 --- a/test/completion/import.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions import diff --git a/test/completion/info.exp b/test/completion/info.exp deleted file mode 100644 index d16830b7..00000000 --- a/test/completion/info.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions info diff --git a/test/completion/inject.exp b/test/completion/inject.exp deleted file mode 100644 index 6fcd8093..00000000 --- a/test/completion/inject.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/insmod.exp b/test/completion/insmod.exp deleted file mode 100644 index 9aab37c8..00000000 --- a/test/completion/insmod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions insmod diff --git a/test/completion/installpkg.exp b/test/completion/installpkg.exp deleted file mode 100644 index 47f85f41..00000000 --- a/test/completion/installpkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions installpkg diff --git a/test/completion/interdiff.exp b/test/completion/interdiff.exp deleted file mode 100644 index 97bbbdeb..00000000 --- a/test/completion/interdiff.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions interdiff diff --git a/test/completion/invoke-rc.d.exp b/test/completion/invoke-rc.d.exp deleted file mode 100644 index 0198d100..00000000 --- a/test/completion/invoke-rc.d.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions invoke-rc.d diff --git a/test/completion/ionice.exp b/test/completion/ionice.exp deleted file mode 100644 index d569f418..00000000 --- a/test/completion/ionice.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ionice diff --git a/test/completion/ip.exp b/test/completion/ip.exp deleted file mode 100644 index e80841e8..00000000 --- a/test/completion/ip.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ip diff --git a/test/completion/iperf.exp b/test/completion/iperf.exp deleted file mode 100644 index f5f19ef5..00000000 --- a/test/completion/iperf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iperf diff --git a/test/completion/ipmitool.exp b/test/completion/ipmitool.exp deleted file mode 100644 index a5c72a78..00000000 --- a/test/completion/ipmitool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ipmitool diff --git a/test/completion/ipsec.exp b/test/completion/ipsec.exp deleted file mode 100644 index f904429b..00000000 --- a/test/completion/ipsec.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ipsec diff --git a/test/completion/iptables.exp b/test/completion/iptables.exp deleted file mode 100644 index 3c3bbc39..00000000 --- a/test/completion/iptables.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iptables diff --git a/test/completion/ipv6calc.exp b/test/completion/ipv6calc.exp deleted file mode 100644 index b1c3c181..00000000 --- a/test/completion/ipv6calc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ipv6calc diff --git a/test/completion/irb.exp b/test/completion/irb.exp deleted file mode 100644 index 02f166f8..00000000 --- a/test/completion/irb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions irb diff --git a/test/completion/iscsiadm.exp b/test/completion/iscsiadm.exp deleted file mode 100644 index 6d760dd4..00000000 --- a/test/completion/iscsiadm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iscsiadm diff --git a/test/completion/isql.exp b/test/completion/isql.exp deleted file mode 100644 index d06295b7..00000000 --- a/test/completion/isql.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions isql diff --git a/test/completion/iwconfig.exp b/test/completion/iwconfig.exp deleted file mode 100644 index d3935e61..00000000 --- a/test/completion/iwconfig.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iwconfig diff --git a/test/completion/iwlist.exp b/test/completion/iwlist.exp deleted file mode 100644 index 5293e3b1..00000000 --- a/test/completion/iwlist.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iwlist diff --git a/test/completion/iwpriv.exp b/test/completion/iwpriv.exp deleted file mode 100644 index 5caa8410..00000000 --- a/test/completion/iwpriv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iwpriv diff --git a/test/completion/iwspy.exp b/test/completion/iwspy.exp deleted file mode 100644 index 08476d3d..00000000 --- a/test/completion/iwspy.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions iwspy diff --git a/test/completion/jar.exp b/test/completion/jar.exp deleted file mode 100644 index f9dbdc79..00000000 --- a/test/completion/jar.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions jar diff --git a/test/completion/jarsigner.exp b/test/completion/jarsigner.exp deleted file mode 100644 index 21b84fea..00000000 --- a/test/completion/jarsigner.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions jarsigner diff --git a/test/completion/java.exp b/test/completion/java.exp deleted file mode 100644 index fbea3c32..00000000 --- a/test/completion/java.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions java diff --git a/test/completion/javac.exp b/test/completion/javac.exp deleted file mode 100644 index 1bc9403e..00000000 --- a/test/completion/javac.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions javac diff --git a/test/completion/javadoc.exp b/test/completion/javadoc.exp deleted file mode 100644 index 0fcca89c..00000000 --- a/test/completion/javadoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions javadoc diff --git a/test/completion/javaws.exp b/test/completion/javaws.exp deleted file mode 100644 index c1c6b106..00000000 --- a/test/completion/javaws.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions javaws diff --git a/test/completion/jpegoptim.exp b/test/completion/jpegoptim.exp deleted file mode 100644 index 1d43b944..00000000 --- a/test/completion/jpegoptim.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions jpegoptim diff --git a/test/completion/jps.exp b/test/completion/jps.exp deleted file mode 100644 index 8a04f645..00000000 --- a/test/completion/jps.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions jps diff --git a/test/completion/jshint.exp b/test/completion/jshint.exp deleted file mode 100644 index 4416472c..00000000 --- a/test/completion/jshint.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions jshint diff --git a/test/completion/k3b.exp b/test/completion/k3b.exp deleted file mode 100644 index 6d71bbef..00000000 --- a/test/completion/k3b.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions k3b diff --git a/test/completion/kcov.exp b/test/completion/kcov.exp deleted file mode 100644 index 4f0b9a7c..00000000 --- a/test/completion/kcov.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kcov diff --git a/test/completion/kdvi.exp b/test/completion/kdvi.exp deleted file mode 100644 index 9f6aa664..00000000 --- a/test/completion/kdvi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kdvi diff --git a/test/completion/kill.exp b/test/completion/kill.exp deleted file mode 100644 index 98efb326..00000000 --- a/test/completion/kill.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kill diff --git a/test/completion/killall.exp b/test/completion/killall.exp deleted file mode 100644 index 8cf4fe58..00000000 --- a/test/completion/killall.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions killall diff --git a/test/completion/kldload.exp b/test/completion/kldload.exp deleted file mode 100644 index 23ad008b..00000000 --- a/test/completion/kldload.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kldload diff --git a/test/completion/kldunload.exp b/test/completion/kldunload.exp deleted file mode 100644 index 26219f20..00000000 --- a/test/completion/kldunload.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kldunload diff --git a/test/completion/koji.exp b/test/completion/koji.exp deleted file mode 100644 index 4d85dfc2..00000000 --- a/test/completion/koji.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions koji diff --git a/test/completion/kpdf.exp b/test/completion/kpdf.exp deleted file mode 100644 index d0a17749..00000000 --- a/test/completion/kpdf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kpdf diff --git a/test/completion/kplayer.exp b/test/completion/kplayer.exp deleted file mode 100644 index 0812c045..00000000 --- a/test/completion/kplayer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions kplayer diff --git a/test/completion/ktutil.exp b/test/completion/ktutil.exp deleted file mode 100644 index 430316f3..00000000 --- a/test/completion/ktutil.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ktutil diff --git a/test/completion/l2ping.exp b/test/completion/l2ping.exp deleted file mode 100644 index 5bd300d3..00000000 --- a/test/completion/l2ping.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions l2ping diff --git a/test/completion/larch.exp b/test/completion/larch.exp deleted file mode 100644 index ccf332ee..00000000 --- a/test/completion/larch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions larch diff --git a/test/completion/lastlog.exp b/test/completion/lastlog.exp deleted file mode 100644 index cefb67b9..00000000 --- a/test/completion/lastlog.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lastlog diff --git a/test/completion/ld.exp b/test/completion/ld.exp deleted file mode 100644 index fcbc43da..00000000 --- a/test/completion/ld.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ld diff --git a/test/completion/ldapadd.exp b/test/completion/ldapadd.exp deleted file mode 100644 index 2c74de74..00000000 --- a/test/completion/ldapadd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapadd diff --git a/test/completion/ldapcompare.exp b/test/completion/ldapcompare.exp deleted file mode 100644 index bb1db4c3..00000000 --- a/test/completion/ldapcompare.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapcompare diff --git a/test/completion/ldapdelete.exp b/test/completion/ldapdelete.exp deleted file mode 100644 index 76027d9f..00000000 --- a/test/completion/ldapdelete.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapdelete diff --git a/test/completion/ldapmodrdn.exp b/test/completion/ldapmodrdn.exp deleted file mode 100644 index 9614af6c..00000000 --- a/test/completion/ldapmodrdn.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapmodrdn diff --git a/test/completion/ldappasswd.exp b/test/completion/ldappasswd.exp deleted file mode 100644 index 0a5ac72c..00000000 --- a/test/completion/ldappasswd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldappasswd diff --git a/test/completion/ldapsearch.exp b/test/completion/ldapsearch.exp deleted file mode 100644 index c552967d..00000000 --- a/test/completion/ldapsearch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapsearch diff --git a/test/completion/ldapvi.exp b/test/completion/ldapvi.exp deleted file mode 100644 index 2e3ddef2..00000000 --- a/test/completion/ldapvi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapvi diff --git a/test/completion/ldapwhoami.exp b/test/completion/ldapwhoami.exp deleted file mode 100644 index 9d07d8a8..00000000 --- a/test/completion/ldapwhoami.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldapwhoami diff --git a/test/completion/ldd.exp b/test/completion/ldd.exp deleted file mode 100644 index af175bef..00000000 --- a/test/completion/ldd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ldd diff --git a/test/completion/less.exp b/test/completion/less.exp deleted file mode 100644 index 1a18c817..00000000 --- a/test/completion/less.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions less diff --git a/test/completion/lftp.exp b/test/completion/lftp.exp deleted file mode 100644 index 90f307b8..00000000 --- a/test/completion/lftp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lftp diff --git a/test/completion/lftpget.exp b/test/completion/lftpget.exp deleted file mode 100644 index 26c40cb8..00000000 --- a/test/completion/lftpget.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lftpget diff --git a/test/completion/lilo.exp b/test/completion/lilo.exp deleted file mode 100644 index 94076365..00000000 --- a/test/completion/lilo.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lilo diff --git a/test/completion/links.exp b/test/completion/links.exp deleted file mode 100644 index 36af0ddf..00000000 --- a/test/completion/links.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions links diff --git a/test/completion/lintian-info.exp b/test/completion/lintian-info.exp deleted file mode 100644 index 9dcb3fce..00000000 --- a/test/completion/lintian-info.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lintian-info diff --git a/test/completion/lintian.exp b/test/completion/lintian.exp deleted file mode 100644 index 3662b0de..00000000 --- a/test/completion/lintian.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lintian diff --git a/test/completion/lisp.exp b/test/completion/lisp.exp deleted file mode 100644 index f531d8e2..00000000 --- a/test/completion/lisp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lisp diff --git a/test/completion/list_admins.exp b/test/completion/list_admins.exp deleted file mode 100644 index 17d9f57a..00000000 --- a/test/completion/list_admins.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions list_admins diff --git a/test/completion/list_lists.exp b/test/completion/list_lists.exp deleted file mode 100644 index 28a381cd..00000000 --- a/test/completion/list_lists.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions list_lists diff --git a/test/completion/list_members.exp b/test/completion/list_members.exp deleted file mode 100644 index 89b6e1ef..00000000 --- a/test/completion/list_members.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions list_members diff --git a/test/completion/list_owners.exp b/test/completion/list_owners.exp deleted file mode 100644 index 9f6cf03d..00000000 --- a/test/completion/list_owners.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/ln.exp b/test/completion/ln.exp deleted file mode 100644 index db4fe381..00000000 --- a/test/completion/ln.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ln diff --git a/test/completion/look.exp b/test/completion/look.exp deleted file mode 100644 index 3a781af4..00000000 --- a/test/completion/look.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions look diff --git a/test/completion/lpq.exp b/test/completion/lpq.exp deleted file mode 100644 index 062d0c09..00000000 --- a/test/completion/lpq.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lpq diff --git a/test/completion/lpr.exp b/test/completion/lpr.exp deleted file mode 100644 index 6f65fee3..00000000 --- a/test/completion/lpr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lpr diff --git a/test/completion/lrzip.exp b/test/completion/lrzip.exp deleted file mode 100644 index 60616f00..00000000 --- a/test/completion/lrzip.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lrzip diff --git a/test/completion/ls.exp b/test/completion/ls.exp deleted file mode 100644 index c98d3463..00000000 --- a/test/completion/ls.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ls diff --git a/test/completion/lsof.exp b/test/completion/lsof.exp deleted file mode 100644 index 98baab04..00000000 --- a/test/completion/lsof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lsof diff --git a/test/completion/lspci.exp b/test/completion/lspci.exp deleted file mode 100644 index 7b287827..00000000 --- a/test/completion/lspci.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lspci diff --git a/test/completion/lsscsi.exp b/test/completion/lsscsi.exp deleted file mode 100644 index 4b19b1fd..00000000 --- a/test/completion/lsscsi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lsscsi diff --git a/test/completion/lsusb.exp b/test/completion/lsusb.exp deleted file mode 100644 index 0a75f462..00000000 --- a/test/completion/lsusb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lsusb diff --git a/test/completion/lua.exp b/test/completion/lua.exp deleted file mode 100644 index a5774f4f..00000000 --- a/test/completion/lua.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lua diff --git a/test/completion/luac.exp b/test/completion/luac.exp deleted file mode 100644 index 63f49ee7..00000000 --- a/test/completion/luac.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions luac diff --git a/test/completion/luseradd.exp b/test/completion/luseradd.exp deleted file mode 100644 index 69b10cfe..00000000 --- a/test/completion/luseradd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions luseradd diff --git a/test/completion/luserdel.exp b/test/completion/luserdel.exp deleted file mode 100644 index 289a4c32..00000000 --- a/test/completion/luserdel.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions luserdel diff --git a/test/completion/lusermod.exp b/test/completion/lusermod.exp deleted file mode 100644 index 9ca4cecc..00000000 --- a/test/completion/lusermod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lusermod diff --git a/test/completion/lvchange.exp b/test/completion/lvchange.exp deleted file mode 100644 index 400a6c5f..00000000 --- a/test/completion/lvchange.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvchange diff --git a/test/completion/lvcreate.exp b/test/completion/lvcreate.exp deleted file mode 100644 index f211c6d5..00000000 --- a/test/completion/lvcreate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvcreate diff --git a/test/completion/lvdisplay.exp b/test/completion/lvdisplay.exp deleted file mode 100644 index 0d4540b3..00000000 --- a/test/completion/lvdisplay.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvdisplay diff --git a/test/completion/lvextend.exp b/test/completion/lvextend.exp deleted file mode 100644 index 84c1b526..00000000 --- a/test/completion/lvextend.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvextend diff --git a/test/completion/lvm.exp b/test/completion/lvm.exp deleted file mode 100644 index ff3e80fd..00000000 --- a/test/completion/lvm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvm diff --git a/test/completion/lvmdiskscan.exp b/test/completion/lvmdiskscan.exp deleted file mode 100644 index c1f4f5f8..00000000 --- a/test/completion/lvmdiskscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvmdiskscan diff --git a/test/completion/lvreduce.exp b/test/completion/lvreduce.exp deleted file mode 100644 index c9cd8732..00000000 --- a/test/completion/lvreduce.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvreduce diff --git a/test/completion/lvremove.exp b/test/completion/lvremove.exp deleted file mode 100644 index 475202fb..00000000 --- a/test/completion/lvremove.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvremove diff --git a/test/completion/lvrename.exp b/test/completion/lvrename.exp deleted file mode 100644 index 32e7f626..00000000 --- a/test/completion/lvrename.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvrename diff --git a/test/completion/lvresize.exp b/test/completion/lvresize.exp deleted file mode 100644 index dd05dbdc..00000000 --- a/test/completion/lvresize.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvresize diff --git a/test/completion/lvs.exp b/test/completion/lvs.exp deleted file mode 100644 index 796c8b2d..00000000 --- a/test/completion/lvs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvs diff --git a/test/completion/lvscan.exp b/test/completion/lvscan.exp deleted file mode 100644 index 549c9fdb..00000000 --- a/test/completion/lvscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lvscan diff --git a/test/completion/lz4.exp b/test/completion/lz4.exp deleted file mode 100644 index 9db680ed..00000000 --- a/test/completion/lz4.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lz4 diff --git a/test/completion/lzip.exp b/test/completion/lzip.exp deleted file mode 100644 index faa83a41..00000000 --- a/test/completion/lzip.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lzip diff --git a/test/completion/lzma.exp b/test/completion/lzma.exp deleted file mode 100644 index 8d3f637b..00000000 --- a/test/completion/lzma.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lzma diff --git a/test/completion/lzop.exp b/test/completion/lzop.exp deleted file mode 100644 index 99d8e67e..00000000 --- a/test/completion/lzop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions lzop diff --git a/test/completion/m4.exp b/test/completion/m4.exp deleted file mode 100644 index 475fb9a9..00000000 --- a/test/completion/m4.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions m4 diff --git a/test/completion/macof.exp b/test/completion/macof.exp deleted file mode 100644 index 0942c213..00000000 --- a/test/completion/macof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions macof diff --git a/test/completion/mailmanctl.exp b/test/completion/mailmanctl.exp deleted file mode 100644 index 58773291..00000000 --- a/test/completion/mailmanctl.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/mailsnarf.exp b/test/completion/mailsnarf.exp deleted file mode 100644 index c3e20e2a..00000000 --- a/test/completion/mailsnarf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mailsnarf diff --git a/test/completion/make.exp b/test/completion/make.exp deleted file mode 100644 index 483c7fe8..00000000 --- a/test/completion/make.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions make diff --git a/test/completion/makepkg.exp b/test/completion/makepkg.exp deleted file mode 100644 index a4f5e38c..00000000 --- a/test/completion/makepkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions makepkg diff --git a/test/completion/man.exp b/test/completion/man.exp deleted file mode 100644 index 7bae8c03..00000000 --- a/test/completion/man.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions man diff --git a/test/completion/mc.exp b/test/completion/mc.exp deleted file mode 100644 index 37471b40..00000000 --- a/test/completion/mc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mc diff --git a/test/completion/mcrypt.exp b/test/completion/mcrypt.exp deleted file mode 100644 index 086b0581..00000000 --- a/test/completion/mcrypt.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mcrypt diff --git a/test/completion/md5sum.exp b/test/completion/md5sum.exp deleted file mode 100644 index 3378b370..00000000 --- a/test/completion/md5sum.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions md5sum diff --git a/test/completion/mdadm.exp b/test/completion/mdadm.exp deleted file mode 100644 index ad3c36f4..00000000 --- a/test/completion/mdadm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mdadm diff --git a/test/completion/mdecrypt.exp b/test/completion/mdecrypt.exp deleted file mode 100644 index daab2196..00000000 --- a/test/completion/mdecrypt.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mdecrypt diff --git a/test/completion/mdtool.exp b/test/completion/mdtool.exp deleted file mode 100644 index f7604e13..00000000 --- a/test/completion/mdtool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mdtool diff --git a/test/completion/medusa.exp b/test/completion/medusa.exp deleted file mode 100644 index 237cdd54..00000000 --- a/test/completion/medusa.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions medusa diff --git a/test/completion/mencoder.exp b/test/completion/mencoder.exp deleted file mode 100644 index 6c4fa23d..00000000 --- a/test/completion/mencoder.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mencoder diff --git a/test/completion/mii-diag.exp b/test/completion/mii-diag.exp deleted file mode 100644 index b4ddef79..00000000 --- a/test/completion/mii-diag.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mii-diag diff --git a/test/completion/mii-tool.exp b/test/completion/mii-tool.exp deleted file mode 100644 index cd12f228..00000000 --- a/test/completion/mii-tool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mii-tool diff --git a/test/completion/minicom.exp b/test/completion/minicom.exp deleted file mode 100644 index cef598e9..00000000 --- a/test/completion/minicom.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions minicom diff --git a/test/completion/mkdir.exp b/test/completion/mkdir.exp deleted file mode 100644 index f4bad3b9..00000000 --- a/test/completion/mkdir.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mkdir diff --git a/test/completion/mkfifo.exp b/test/completion/mkfifo.exp deleted file mode 100644 index 706b36f4..00000000 --- a/test/completion/mkfifo.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mkfifo diff --git a/test/completion/mkinitrd.exp b/test/completion/mkinitrd.exp deleted file mode 100644 index e8f4e119..00000000 --- a/test/completion/mkinitrd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mkinitrd diff --git a/test/completion/mkisofs.exp b/test/completion/mkisofs.exp deleted file mode 100644 index a94d833b..00000000 --- a/test/completion/mkisofs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mkisofs diff --git a/test/completion/mknod.exp b/test/completion/mknod.exp deleted file mode 100644 index 89f0cefd..00000000 --- a/test/completion/mknod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mknod diff --git a/test/completion/mktemp.exp b/test/completion/mktemp.exp deleted file mode 100644 index b8296865..00000000 --- a/test/completion/mktemp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mktemp diff --git a/test/completion/mmsitepass.exp b/test/completion/mmsitepass.exp deleted file mode 100644 index c54c53b2..00000000 --- a/test/completion/mmsitepass.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mmsitepass diff --git a/test/completion/mock.exp b/test/completion/mock.exp deleted file mode 100644 index 22910a84..00000000 --- a/test/completion/mock.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mock diff --git a/test/completion/modinfo.exp b/test/completion/modinfo.exp deleted file mode 100644 index 88384543..00000000 --- a/test/completion/modinfo.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions modinfo diff --git a/test/completion/modprobe.exp b/test/completion/modprobe.exp deleted file mode 100644 index 405ca8e1..00000000 --- a/test/completion/modprobe.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions modprobe diff --git a/test/completion/module.exp b/test/completion/module.exp deleted file mode 100644 index 3db6d110..00000000 --- a/test/completion/module.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions module diff --git a/test/completion/mogrify.exp b/test/completion/mogrify.exp deleted file mode 100644 index ad3ff02a..00000000 --- a/test/completion/mogrify.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mogrify diff --git a/test/completion/monodevelop.exp b/test/completion/monodevelop.exp deleted file mode 100644 index 1c4fd45b..00000000 --- a/test/completion/monodevelop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions monodevelop diff --git a/test/completion/montage.exp b/test/completion/montage.exp deleted file mode 100644 index afb11ad5..00000000 --- a/test/completion/montage.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions montage diff --git a/test/completion/mount.exp b/test/completion/mount.exp deleted file mode 100644 index 2561e20a..00000000 --- a/test/completion/mount.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mount diff --git a/test/completion/mplayer.exp b/test/completion/mplayer.exp deleted file mode 100644 index 5c38af87..00000000 --- a/test/completion/mplayer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mplayer diff --git a/test/completion/mr.exp b/test/completion/mr.exp deleted file mode 100644 index 85f38ccd..00000000 --- a/test/completion/mr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mr diff --git a/test/completion/msgsnarf.exp b/test/completion/msgsnarf.exp deleted file mode 100644 index cdcbf43d..00000000 --- a/test/completion/msgsnarf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions msgsnarf diff --git a/test/completion/msynctool.exp b/test/completion/msynctool.exp deleted file mode 100644 index 76be37ef..00000000 --- a/test/completion/msynctool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions msynctool diff --git a/test/completion/mtx.exp b/test/completion/mtx.exp deleted file mode 100644 index 6be7a2ff..00000000 --- a/test/completion/mtx.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mtx diff --git a/test/completion/munin-node-configure.exp b/test/completion/munin-node-configure.exp deleted file mode 100644 index 34318e83..00000000 --- a/test/completion/munin-node-configure.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions munin-node-configure diff --git a/test/completion/munin-run.exp b/test/completion/munin-run.exp deleted file mode 100644 index 2a7d6c72..00000000 --- a/test/completion/munin-run.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions munin-run diff --git a/test/completion/munindoc.exp b/test/completion/munindoc.exp deleted file mode 100644 index ea4d0fa2..00000000 --- a/test/completion/munindoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions munindoc diff --git a/test/completion/mussh.exp b/test/completion/mussh.exp deleted file mode 100644 index 1232287c..00000000 --- a/test/completion/mussh.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mussh diff --git a/test/completion/mutt.exp b/test/completion/mutt.exp deleted file mode 100644 index 5fb8c339..00000000 --- a/test/completion/mutt.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mutt diff --git a/test/completion/muttng.exp b/test/completion/muttng.exp deleted file mode 100644 index b06b574d..00000000 --- a/test/completion/muttng.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions muttng diff --git a/test/completion/mv.exp b/test/completion/mv.exp deleted file mode 100644 index b7d22766..00000000 --- a/test/completion/mv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mv diff --git a/test/completion/mysql.exp b/test/completion/mysql.exp deleted file mode 100644 index ad9fac69..00000000 --- a/test/completion/mysql.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mysql diff --git a/test/completion/mysqladmin.exp b/test/completion/mysqladmin.exp deleted file mode 100644 index 61769d26..00000000 --- a/test/completion/mysqladmin.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions mysqladmin diff --git a/test/completion/nc.exp b/test/completion/nc.exp deleted file mode 100644 index a5c06b2d..00000000 --- a/test/completion/nc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nc diff --git a/test/completion/ncftp.exp b/test/completion/ncftp.exp deleted file mode 100644 index c5db3f96..00000000 --- a/test/completion/ncftp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ncftp diff --git a/test/completion/nethogs.exp b/test/completion/nethogs.exp deleted file mode 100644 index 4d501ace..00000000 --- a/test/completion/nethogs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nethogs diff --git a/test/completion/netstat.exp b/test/completion/netstat.exp deleted file mode 100644 index bee92789..00000000 --- a/test/completion/netstat.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions netstat diff --git a/test/completion/newgrp.exp b/test/completion/newgrp.exp deleted file mode 100644 index bbd12372..00000000 --- a/test/completion/newgrp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions newgrp diff --git a/test/completion/newlist.exp b/test/completion/newlist.exp deleted file mode 100644 index ac05a92f..00000000 --- a/test/completion/newlist.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions newlist diff --git a/test/completion/newusers.exp b/test/completion/newusers.exp deleted file mode 100644 index c9ea45c6..00000000 --- a/test/completion/newusers.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions newusers diff --git a/test/completion/ngrep.exp b/test/completion/ngrep.exp deleted file mode 100644 index 3ad711b1..00000000 --- a/test/completion/ngrep.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ngrep diff --git a/test/completion/nl.exp b/test/completion/nl.exp deleted file mode 100644 index c788a06b..00000000 --- a/test/completion/nl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nl diff --git a/test/completion/nm.exp b/test/completion/nm.exp deleted file mode 100644 index 99ccd370..00000000 --- a/test/completion/nm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nm diff --git a/test/completion/nmap.exp b/test/completion/nmap.exp deleted file mode 100644 index 441d1377..00000000 --- a/test/completion/nmap.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nmap diff --git a/test/completion/nmcli.exp b/test/completion/nmcli.exp deleted file mode 100644 index 816468f7..00000000 --- a/test/completion/nmcli.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nmcli diff --git a/test/completion/nproc.exp b/test/completion/nproc.exp deleted file mode 100644 index f2378bfa..00000000 --- a/test/completion/nproc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nproc diff --git a/test/completion/nslookup.exp b/test/completion/nslookup.exp deleted file mode 100644 index 5a26b495..00000000 --- a/test/completion/nslookup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions nslookup diff --git a/test/completion/ntpdate.exp b/test/completion/ntpdate.exp deleted file mode 100644 index d40bbd73..00000000 --- a/test/completion/ntpdate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ntpdate diff --git a/test/completion/objcopy.exp b/test/completion/objcopy.exp deleted file mode 100644 index 579d9ba9..00000000 --- a/test/completion/objcopy.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions objcopy diff --git a/test/completion/objdump.exp b/test/completion/objdump.exp deleted file mode 100644 index 78689842..00000000 --- a/test/completion/objdump.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions objdump diff --git a/test/completion/od.exp b/test/completion/od.exp deleted file mode 100644 index e9ec0f8f..00000000 --- a/test/completion/od.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions od diff --git a/test/completion/oggdec.exp b/test/completion/oggdec.exp deleted file mode 100644 index b18643d5..00000000 --- a/test/completion/oggdec.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions oggdec diff --git a/test/completion/openssl.exp b/test/completion/openssl.exp deleted file mode 100644 index 281cbf9c..00000000 --- a/test/completion/openssl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions openssl diff --git a/test/completion/opera.exp b/test/completion/opera.exp deleted file mode 100644 index 9ab6a08f..00000000 --- a/test/completion/opera.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions opera diff --git a/test/completion/optipng.exp b/test/completion/optipng.exp deleted file mode 100644 index b3207543..00000000 --- a/test/completion/optipng.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions optipng diff --git a/test/completion/p4.exp b/test/completion/p4.exp deleted file mode 100644 index 9301a04b..00000000 --- a/test/completion/p4.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions p4 diff --git a/test/completion/pack200.exp b/test/completion/pack200.exp deleted file mode 100644 index b20f8178..00000000 --- a/test/completion/pack200.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pack200 diff --git a/test/completion/passwd.exp b/test/completion/passwd.exp deleted file mode 100644 index 2f0bec9b..00000000 --- a/test/completion/passwd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions passwd diff --git a/test/completion/paste.exp b/test/completion/paste.exp deleted file mode 100644 index ab2f1249..00000000 --- a/test/completion/paste.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions paste diff --git a/test/completion/patch.exp b/test/completion/patch.exp deleted file mode 100644 index 27d69363..00000000 --- a/test/completion/patch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions patch diff --git a/test/completion/pdftotext.exp b/test/completion/pdftotext.exp deleted file mode 100644 index d84cee5d..00000000 --- a/test/completion/pdftotext.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pdftotext diff --git a/test/completion/perl.exp b/test/completion/perl.exp deleted file mode 100644 index 617a7b18..00000000 --- a/test/completion/perl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions perl diff --git a/test/completion/perldoc.exp b/test/completion/perldoc.exp deleted file mode 100644 index d0d49b1a..00000000 --- a/test/completion/perldoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions perldoc diff --git a/test/completion/perltidy.exp b/test/completion/perltidy.exp deleted file mode 100644 index c4b577dd..00000000 --- a/test/completion/perltidy.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions perltidy diff --git a/test/completion/pgrep.exp b/test/completion/pgrep.exp deleted file mode 100644 index 6deac165..00000000 --- a/test/completion/pgrep.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pgrep diff --git a/test/completion/phing.exp b/test/completion/phing.exp deleted file mode 100644 index 957999bc..00000000 --- a/test/completion/phing.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions phing diff --git a/test/completion/pidof.exp b/test/completion/pidof.exp deleted file mode 100644 index c66ee9f9..00000000 --- a/test/completion/pidof.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pidof diff --git a/test/completion/pine.exp b/test/completion/pine.exp deleted file mode 100644 index 635d79b9..00000000 --- a/test/completion/pine.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pine diff --git a/test/completion/pinfo.exp b/test/completion/pinfo.exp deleted file mode 100644 index 3e937568..00000000 --- a/test/completion/pinfo.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pinfo diff --git a/test/completion/ping.exp b/test/completion/ping.exp deleted file mode 100644 index f006ea25..00000000 --- a/test/completion/ping.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ping diff --git a/test/completion/pkg-config.exp b/test/completion/pkg-config.exp deleted file mode 100644 index 03d8dc41..00000000 --- a/test/completion/pkg-config.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkg-config diff --git a/test/completion/pkg-get.exp b/test/completion/pkg-get.exp deleted file mode 100644 index 4499142f..00000000 --- a/test/completion/pkg-get.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkg-get diff --git a/test/completion/pkg_deinstall.exp b/test/completion/pkg_deinstall.exp deleted file mode 100644 index e7a666cd..00000000 --- a/test/completion/pkg_deinstall.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkg_deinstall diff --git a/test/completion/pkg_delete.exp b/test/completion/pkg_delete.exp deleted file mode 100644 index f66049e0..00000000 --- a/test/completion/pkg_delete.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkg_delete diff --git a/test/completion/pkg_info.exp b/test/completion/pkg_info.exp deleted file mode 100644 index e5387cdb..00000000 --- a/test/completion/pkg_info.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkg_info diff --git a/test/completion/pkgadd.exp b/test/completion/pkgadd.exp deleted file mode 100644 index 128c823e..00000000 --- a/test/completion/pkgadd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkgadd diff --git a/test/completion/pkgrm.exp b/test/completion/pkgrm.exp deleted file mode 100644 index e94337ae..00000000 --- a/test/completion/pkgrm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkgrm diff --git a/test/completion/pkgtool.exp b/test/completion/pkgtool.exp deleted file mode 100644 index 4a946c52..00000000 --- a/test/completion/pkgtool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkgtool diff --git a/test/completion/pkgutil.exp b/test/completion/pkgutil.exp deleted file mode 100644 index b4d152ec..00000000 --- a/test/completion/pkgutil.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkgutil diff --git a/test/completion/pkill.exp b/test/completion/pkill.exp deleted file mode 100644 index 56e30836..00000000 --- a/test/completion/pkill.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pkill diff --git a/test/completion/plague-client.exp b/test/completion/plague-client.exp deleted file mode 100644 index 6f9a9373..00000000 --- a/test/completion/plague-client.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions plague-client diff --git a/test/completion/pm-hibernate.exp b/test/completion/pm-hibernate.exp deleted file mode 100644 index b0a6360c..00000000 --- a/test/completion/pm-hibernate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pm-hibernate diff --git a/test/completion/pm-is-supported.exp b/test/completion/pm-is-supported.exp deleted file mode 100644 index 62d1f2ff..00000000 --- a/test/completion/pm-is-supported.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pm-is-supported diff --git a/test/completion/pm-powersave.exp b/test/completion/pm-powersave.exp deleted file mode 100644 index deb061c6..00000000 --- a/test/completion/pm-powersave.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pm-powersave diff --git a/test/completion/pngfix.exp b/test/completion/pngfix.exp deleted file mode 100644 index 7cea7218..00000000 --- a/test/completion/pngfix.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pngfix diff --git a/test/completion/portinstall.exp b/test/completion/portinstall.exp deleted file mode 100644 index 87fb5968..00000000 --- a/test/completion/portinstall.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions portinstall diff --git a/test/completion/portsnap.exp b/test/completion/portsnap.exp deleted file mode 100644 index 424004e0..00000000 --- a/test/completion/portsnap.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions portsnap diff --git a/test/completion/portupgrade.exp b/test/completion/portupgrade.exp deleted file mode 100644 index 00e8d4df..00000000 --- a/test/completion/portupgrade.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions portupgrade diff --git a/test/completion/postcat.exp b/test/completion/postcat.exp deleted file mode 100644 index eb4ae6da..00000000 --- a/test/completion/postcat.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions postcat diff --git a/test/completion/postconf.exp b/test/completion/postconf.exp deleted file mode 100644 index 7ed485c2..00000000 --- a/test/completion/postconf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions postconf diff --git a/test/completion/postfix.exp b/test/completion/postfix.exp deleted file mode 100644 index 4a39d044..00000000 --- a/test/completion/postfix.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions postfix diff --git a/test/completion/postmap.exp b/test/completion/postmap.exp deleted file mode 100644 index 870af8d1..00000000 --- a/test/completion/postmap.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions postmap diff --git a/test/completion/postsuper.exp b/test/completion/postsuper.exp deleted file mode 100644 index fac52381..00000000 --- a/test/completion/postsuper.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions postsuper diff --git a/test/completion/povray.exp b/test/completion/povray.exp deleted file mode 100644 index 4d49702f..00000000 --- a/test/completion/povray.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions povray diff --git a/test/completion/pr.exp b/test/completion/pr.exp deleted file mode 100644 index 940bfe40..00000000 --- a/test/completion/pr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pr diff --git a/test/completion/prelink.exp b/test/completion/prelink.exp deleted file mode 100644 index d1fbb8ee..00000000 --- a/test/completion/prelink.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions prelink diff --git a/test/completion/protoc.exp b/test/completion/protoc.exp deleted file mode 100644 index 333ebf26..00000000 --- a/test/completion/protoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions protoc diff --git a/test/completion/psql.exp b/test/completion/psql.exp deleted file mode 100644 index 619d9e13..00000000 --- a/test/completion/psql.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions psql diff --git a/test/completion/ptx.exp b/test/completion/ptx.exp deleted file mode 100644 index 4ab752b5..00000000 --- a/test/completion/ptx.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ptx diff --git a/test/completion/puppet.exp b/test/completion/puppet.exp deleted file mode 100644 index 28463445..00000000 --- a/test/completion/puppet.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions puppet diff --git a/test/completion/pushd.exp b/test/completion/pushd.exp deleted file mode 100644 index 44556cdb..00000000 --- a/test/completion/pushd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pushd diff --git a/test/completion/pv.exp b/test/completion/pv.exp deleted file mode 100644 index 2dffce6e..00000000 --- a/test/completion/pv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pv diff --git a/test/completion/pvchange.exp b/test/completion/pvchange.exp deleted file mode 100644 index d6f35360..00000000 --- a/test/completion/pvchange.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvchange diff --git a/test/completion/pvcreate.exp b/test/completion/pvcreate.exp deleted file mode 100644 index 1542baa5..00000000 --- a/test/completion/pvcreate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvcreate diff --git a/test/completion/pvdisplay.exp b/test/completion/pvdisplay.exp deleted file mode 100644 index bcbcb588..00000000 --- a/test/completion/pvdisplay.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvdisplay diff --git a/test/completion/pvmove.exp b/test/completion/pvmove.exp deleted file mode 100644 index 43151934..00000000 --- a/test/completion/pvmove.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvmove diff --git a/test/completion/pvremove.exp b/test/completion/pvremove.exp deleted file mode 100644 index 3cc59769..00000000 --- a/test/completion/pvremove.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvremove diff --git a/test/completion/pvs.exp b/test/completion/pvs.exp deleted file mode 100644 index 22dc03d0..00000000 --- a/test/completion/pvs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvs diff --git a/test/completion/pvscan.exp b/test/completion/pvscan.exp deleted file mode 100644 index 22b02c7f..00000000 --- a/test/completion/pvscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pvscan diff --git a/test/completion/pwck.exp b/test/completion/pwck.exp deleted file mode 100644 index 55d5f95c..00000000 --- a/test/completion/pwck.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pwck diff --git a/test/completion/pwd.exp b/test/completion/pwd.exp deleted file mode 100644 index e24ee974..00000000 --- a/test/completion/pwd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pwd diff --git a/test/completion/pwdx.exp b/test/completion/pwdx.exp deleted file mode 100644 index dd97822a..00000000 --- a/test/completion/pwdx.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pwdx diff --git a/test/completion/pwgen.exp b/test/completion/pwgen.exp deleted file mode 100644 index bba75ecd..00000000 --- a/test/completion/pwgen.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pwgen diff --git a/test/completion/py.test.exp b/test/completion/py.test.exp deleted file mode 100644 index 8f09927d..00000000 --- a/test/completion/py.test.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions py.test diff --git a/test/completion/pycodestyle.exp b/test/completion/pycodestyle.exp deleted file mode 100644 index 50a3c496..00000000 --- a/test/completion/pycodestyle.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pycodestyle diff --git a/test/completion/pydoc.exp b/test/completion/pydoc.exp deleted file mode 100644 index 9555e850..00000000 --- a/test/completion/pydoc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pydoc diff --git a/test/completion/pyflakes.exp b/test/completion/pyflakes.exp deleted file mode 100644 index b10445f6..00000000 --- a/test/completion/pyflakes.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pyflakes diff --git a/test/completion/pylint.exp b/test/completion/pylint.exp deleted file mode 100644 index d5a993de..00000000 --- a/test/completion/pylint.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pylint diff --git a/test/completion/python.exp b/test/completion/python.exp deleted file mode 100644 index 2cb7390d..00000000 --- a/test/completion/python.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions python diff --git a/test/completion/pyvenv.exp b/test/completion/pyvenv.exp deleted file mode 100644 index ce5c8a62..00000000 --- a/test/completion/pyvenv.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions pyvenv diff --git a/test/completion/qemu.exp b/test/completion/qemu.exp deleted file mode 100644 index deedd3a2..00000000 --- a/test/completion/qemu.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions qemu diff --git a/test/completion/qrunner.exp b/test/completion/qrunner.exp deleted file mode 100644 index e8b30af7..00000000 --- a/test/completion/qrunner.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/querybts.exp b/test/completion/querybts.exp deleted file mode 100644 index 81203b2b..00000000 --- a/test/completion/querybts.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions querybts diff --git a/test/completion/quota.exp b/test/completion/quota.exp deleted file mode 100644 index 9c08b4f3..00000000 --- a/test/completion/quota.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions quota diff --git a/test/completion/quotacheck.exp b/test/completion/quotacheck.exp deleted file mode 100644 index 5b53da8f..00000000 --- a/test/completion/quotacheck.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions quotacheck diff --git a/test/completion/quotaon.exp b/test/completion/quotaon.exp deleted file mode 100644 index e66056fc..00000000 --- a/test/completion/quotaon.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions quotaon diff --git a/test/completion/radvdump.exp b/test/completion/radvdump.exp deleted file mode 100644 index e4efa171..00000000 --- a/test/completion/radvdump.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions radvdump diff --git a/test/completion/rcs.exp b/test/completion/rcs.exp deleted file mode 100644 index 34b21190..00000000 --- a/test/completion/rcs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rcs diff --git a/test/completion/rcsdiff.exp b/test/completion/rcsdiff.exp deleted file mode 100644 index 9cf52dcc..00000000 --- a/test/completion/rcsdiff.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rcsdiff diff --git a/test/completion/rdesktop.exp b/test/completion/rdesktop.exp deleted file mode 100644 index 29eddf6e..00000000 --- a/test/completion/rdesktop.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rdesktop diff --git a/test/completion/rdict.exp b/test/completion/rdict.exp deleted file mode 100644 index cea99fbc..00000000 --- a/test/completion/rdict.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rdict diff --git a/test/completion/readelf.exp b/test/completion/readelf.exp deleted file mode 100644 index d0d9bc48..00000000 --- a/test/completion/readelf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions readelf diff --git a/test/completion/readonly.exp b/test/completion/readonly.exp deleted file mode 100644 index f35b8e7a..00000000 --- a/test/completion/readonly.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions readonly diff --git a/test/completion/remove_members.exp b/test/completion/remove_members.exp deleted file mode 100644 index 0cc71ac1..00000000 --- a/test/completion/remove_members.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions remove_members diff --git a/test/completion/removepkg.exp b/test/completion/removepkg.exp deleted file mode 100644 index e78e01a7..00000000 --- a/test/completion/removepkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions removepkg diff --git a/test/completion/renice.exp b/test/completion/renice.exp deleted file mode 100644 index e5d6c8e5..00000000 --- a/test/completion/renice.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions renice diff --git a/test/completion/repomanage.exp b/test/completion/repomanage.exp deleted file mode 100644 index 79ec53b2..00000000 --- a/test/completion/repomanage.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions repomanage diff --git a/test/completion/reportbug.exp b/test/completion/reportbug.exp deleted file mode 100644 index 10d6cebb..00000000 --- a/test/completion/reportbug.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions reportbug diff --git a/test/completion/reptyr.exp b/test/completion/reptyr.exp deleted file mode 100644 index 62ab427d..00000000 --- a/test/completion/reptyr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions reptyr diff --git a/test/completion/resolvconf.exp b/test/completion/resolvconf.exp deleted file mode 100644 index d4651336..00000000 --- a/test/completion/resolvconf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions resolvconf diff --git a/test/completion/rfcomm.exp b/test/completion/rfcomm.exp deleted file mode 100644 index 6de31dc2..00000000 --- a/test/completion/rfcomm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rfcomm diff --git a/test/completion/rfkill.exp b/test/completion/rfkill.exp deleted file mode 100644 index 74201043..00000000 --- a/test/completion/rfkill.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rfkill diff --git a/test/completion/ri.exp b/test/completion/ri.exp deleted file mode 100644 index f93d3409..00000000 --- a/test/completion/ri.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ri diff --git a/test/completion/rlog.exp b/test/completion/rlog.exp deleted file mode 100644 index 9af48c09..00000000 --- a/test/completion/rlog.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rlog diff --git a/test/completion/rm.exp b/test/completion/rm.exp deleted file mode 100644 index 6a99948b..00000000 --- a/test/completion/rm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rm diff --git a/test/completion/rmdir.exp b/test/completion/rmdir.exp deleted file mode 100644 index a7435b82..00000000 --- a/test/completion/rmdir.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rmdir diff --git a/test/completion/rmlist.exp b/test/completion/rmlist.exp deleted file mode 100644 index ac4dd513..00000000 --- a/test/completion/rmlist.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rmlist diff --git a/test/completion/rmmod.exp b/test/completion/rmmod.exp deleted file mode 100644 index 040c7372..00000000 --- a/test/completion/rmmod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rmmod diff --git a/test/completion/route.exp b/test/completion/route.exp deleted file mode 100644 index beff8251..00000000 --- a/test/completion/route.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions route diff --git a/test/completion/rpcdebug.exp b/test/completion/rpcdebug.exp deleted file mode 100644 index add86388..00000000 --- a/test/completion/rpcdebug.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rpcdebug diff --git a/test/completion/rpm.exp b/test/completion/rpm.exp deleted file mode 100644 index c583e56c..00000000 --- a/test/completion/rpm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rpm diff --git a/test/completion/rpm2tgz.exp b/test/completion/rpm2tgz.exp deleted file mode 100644 index 6acd954a..00000000 --- a/test/completion/rpm2tgz.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rpm2tgz diff --git a/test/completion/rpmbuild.exp b/test/completion/rpmbuild.exp deleted file mode 100644 index f829b588..00000000 --- a/test/completion/rpmbuild.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rpmbuild diff --git a/test/completion/rrdtool.exp b/test/completion/rrdtool.exp deleted file mode 100644 index 72016859..00000000 --- a/test/completion/rrdtool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rrdtool diff --git a/test/completion/rsync.exp b/test/completion/rsync.exp deleted file mode 100644 index d927b509..00000000 --- a/test/completion/rsync.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rsync diff --git a/test/completion/rtcwake.exp b/test/completion/rtcwake.exp deleted file mode 100644 index abedd8de..00000000 --- a/test/completion/rtcwake.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions rtcwake diff --git a/test/completion/runuser.exp b/test/completion/runuser.exp deleted file mode 100644 index ed0abdcf..00000000 --- a/test/completion/runuser.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions runuser diff --git a/test/completion/sbcl-mt.exp b/test/completion/sbcl-mt.exp deleted file mode 100644 index a5485f14..00000000 --- a/test/completion/sbcl-mt.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sbcl-mt diff --git a/test/completion/sbcl.exp b/test/completion/sbcl.exp deleted file mode 100644 index 865f9509..00000000 --- a/test/completion/sbcl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sbcl diff --git a/test/completion/sbopkg.exp b/test/completion/sbopkg.exp deleted file mode 100644 index 0fec4db1..00000000 --- a/test/completion/sbopkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sbopkg diff --git a/test/completion/screen.exp b/test/completion/screen.exp deleted file mode 100644 index 8fce61d0..00000000 --- a/test/completion/screen.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions screen diff --git a/test/completion/sdptool.exp b/test/completion/sdptool.exp deleted file mode 100644 index 6d20cf99..00000000 --- a/test/completion/sdptool.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sdptool diff --git a/test/completion/sed.exp b/test/completion/sed.exp deleted file mode 100644 index e4ce16f8..00000000 --- a/test/completion/sed.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sed diff --git a/test/completion/seq.exp b/test/completion/seq.exp deleted file mode 100644 index 4123ba9d..00000000 --- a/test/completion/seq.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions seq diff --git a/test/completion/service.exp b/test/completion/service.exp deleted file mode 100644 index a1bae6a4..00000000 --- a/test/completion/service.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions service diff --git a/test/completion/set.exp b/test/completion/set.exp deleted file mode 100644 index e30a9c6f..00000000 --- a/test/completion/set.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions set diff --git a/test/completion/setquota.exp b/test/completion/setquota.exp deleted file mode 100644 index c97dccc0..00000000 --- a/test/completion/setquota.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions setquota diff --git a/test/completion/sh.exp b/test/completion/sh.exp deleted file mode 100644 index 599f3b29..00000000 --- a/test/completion/sh.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sh diff --git a/test/completion/sha1sum.exp b/test/completion/sha1sum.exp deleted file mode 100644 index b6d09e88..00000000 --- a/test/completion/sha1sum.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sha1sum diff --git a/test/completion/shar.exp b/test/completion/shar.exp deleted file mode 100644 index ae23e49e..00000000 --- a/test/completion/shar.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions shar diff --git a/test/completion/sitecopy.exp b/test/completion/sitecopy.exp deleted file mode 100644 index ddb57024..00000000 --- a/test/completion/sitecopy.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sitecopy diff --git a/test/completion/slackpkg.exp b/test/completion/slackpkg.exp deleted file mode 100644 index ecef64d0..00000000 --- a/test/completion/slackpkg.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions slackpkg diff --git a/test/completion/smartctl.exp b/test/completion/smartctl.exp deleted file mode 100644 index 1b6f55d6..00000000 --- a/test/completion/smartctl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smartctl diff --git a/test/completion/smbcacls.exp b/test/completion/smbcacls.exp deleted file mode 100644 index 333a14e7..00000000 --- a/test/completion/smbcacls.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbcacls diff --git a/test/completion/smbclient.exp b/test/completion/smbclient.exp deleted file mode 100644 index 09b9ad33..00000000 --- a/test/completion/smbclient.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbclient diff --git a/test/completion/smbcquotas.exp b/test/completion/smbcquotas.exp deleted file mode 100644 index f7c4e94a..00000000 --- a/test/completion/smbcquotas.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbcquotas diff --git a/test/completion/smbget.exp b/test/completion/smbget.exp deleted file mode 100644 index 8f6c849e..00000000 --- a/test/completion/smbget.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbget diff --git a/test/completion/smbpasswd.exp b/test/completion/smbpasswd.exp deleted file mode 100644 index de2297a6..00000000 --- a/test/completion/smbpasswd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbpasswd diff --git a/test/completion/smbtar.exp b/test/completion/smbtar.exp deleted file mode 100644 index 72dd9f1f..00000000 --- a/test/completion/smbtar.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbtar diff --git a/test/completion/smbtree.exp b/test/completion/smbtree.exp deleted file mode 100644 index 713c5bab..00000000 --- a/test/completion/smbtree.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions smbtree diff --git a/test/completion/snownews.exp b/test/completion/snownews.exp deleted file mode 100644 index c7a94d2f..00000000 --- a/test/completion/snownews.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions snownews diff --git a/test/completion/sort.exp b/test/completion/sort.exp deleted file mode 100644 index 8cc2429e..00000000 --- a/test/completion/sort.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sort diff --git a/test/completion/split.exp b/test/completion/split.exp deleted file mode 100644 index 78614669..00000000 --- a/test/completion/split.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions split diff --git a/test/completion/spovray.exp b/test/completion/spovray.exp deleted file mode 100644 index 3c45889b..00000000 --- a/test/completion/spovray.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions spovray diff --git a/test/completion/sqlite3.exp b/test/completion/sqlite3.exp deleted file mode 100644 index 88195e0d..00000000 --- a/test/completion/sqlite3.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sqlite3 diff --git a/test/completion/ss.exp b/test/completion/ss.exp deleted file mode 100644 index f8703884..00000000 --- a/test/completion/ss.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ss diff --git a/test/completion/ssh-add.exp b/test/completion/ssh-add.exp deleted file mode 100644 index 03035cf7..00000000 --- a/test/completion/ssh-add.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ssh-add diff --git a/test/completion/ssh-copy-id.exp b/test/completion/ssh-copy-id.exp deleted file mode 100644 index c4923e78..00000000 --- a/test/completion/ssh-copy-id.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ssh-copy-id diff --git a/test/completion/ssh-keygen.exp b/test/completion/ssh-keygen.exp deleted file mode 100644 index f074b5a4..00000000 --- a/test/completion/ssh-keygen.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ssh-keygen diff --git a/test/completion/sshfs.exp b/test/completion/sshfs.exp deleted file mode 100644 index e5deaddd..00000000 --- a/test/completion/sshfs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sshfs diff --git a/test/completion/sshmitm.exp b/test/completion/sshmitm.exp deleted file mode 100644 index f1c10baa..00000000 --- a/test/completion/sshmitm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sshmitm diff --git a/test/completion/sshow.exp b/test/completion/sshow.exp deleted file mode 100644 index 8899f907..00000000 --- a/test/completion/sshow.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sshow diff --git a/test/completion/strace.exp b/test/completion/strace.exp deleted file mode 100644 index 717db3a3..00000000 --- a/test/completion/strace.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions strace diff --git a/test/completion/stream.exp b/test/completion/stream.exp deleted file mode 100644 index fba2104f..00000000 --- a/test/completion/stream.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions stream diff --git a/test/completion/strings.exp b/test/completion/strings.exp deleted file mode 100644 index a5c544a2..00000000 --- a/test/completion/strings.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions strings diff --git a/test/completion/strip.exp b/test/completion/strip.exp deleted file mode 100644 index d56fdb21..00000000 --- a/test/completion/strip.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions strip diff --git a/test/completion/su.exp b/test/completion/su.exp deleted file mode 100644 index 8c123fc7..00000000 --- a/test/completion/su.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions su diff --git a/test/completion/svcadm.exp b/test/completion/svcadm.exp deleted file mode 100644 index f96d46dc..00000000 --- a/test/completion/svcadm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions svcadm diff --git a/test/completion/svk.exp b/test/completion/svk.exp deleted file mode 100644 index f3b5c4e6..00000000 --- a/test/completion/svk.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions svk diff --git a/test/completion/svn.exp b/test/completion/svn.exp deleted file mode 100644 index e68594fa..00000000 --- a/test/completion/svn.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions svn diff --git a/test/completion/svnadmin.exp b/test/completion/svnadmin.exp deleted file mode 100644 index cbbc0b71..00000000 --- a/test/completion/svnadmin.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions svnadmin diff --git a/test/completion/svnlook.exp b/test/completion/svnlook.exp deleted file mode 100644 index 6f973fc3..00000000 --- a/test/completion/svnlook.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions svnlook diff --git a/test/completion/sync_members.exp b/test/completion/sync_members.exp deleted file mode 100644 index 85f2f8c8..00000000 --- a/test/completion/sync_members.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sync_members diff --git a/test/completion/synclient.exp b/test/completion/synclient.exp deleted file mode 100644 index 9a277096..00000000 --- a/test/completion/synclient.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions synclient diff --git a/test/completion/sysbench.exp b/test/completion/sysbench.exp deleted file mode 100644 index 68da0a7a..00000000 --- a/test/completion/sysbench.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sysbench diff --git a/test/completion/sysctl.exp b/test/completion/sysctl.exp deleted file mode 100644 index cad11393..00000000 --- a/test/completion/sysctl.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions sysctl diff --git a/test/completion/tac.exp b/test/completion/tac.exp deleted file mode 100644 index 98f051ed..00000000 --- a/test/completion/tac.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tac diff --git a/test/completion/tail.exp b/test/completion/tail.exp deleted file mode 100644 index 362876a3..00000000 --- a/test/completion/tail.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tail diff --git a/test/completion/tar.exp b/test/completion/tar.exp deleted file mode 100644 index 4a309863..00000000 --- a/test/completion/tar.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tar diff --git a/test/completion/tcpdump.exp b/test/completion/tcpdump.exp deleted file mode 100644 index 13eb744e..00000000 --- a/test/completion/tcpdump.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tcpdump diff --git a/test/completion/tcpkill.exp b/test/completion/tcpkill.exp deleted file mode 100644 index c062cf3b..00000000 --- a/test/completion/tcpkill.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tcpkill diff --git a/test/completion/tcpnice.exp b/test/completion/tcpnice.exp deleted file mode 100644 index b7f14f5e..00000000 --- a/test/completion/tcpnice.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tcpnice diff --git a/test/completion/tee.exp b/test/completion/tee.exp deleted file mode 100644 index deb6a0d9..00000000 --- a/test/completion/tee.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tee diff --git a/test/completion/texindex.exp b/test/completion/texindex.exp deleted file mode 100644 index 0363595f..00000000 --- a/test/completion/texindex.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions texindex diff --git a/test/completion/tightvncviewer.exp b/test/completion/tightvncviewer.exp deleted file mode 100644 index e08b7560..00000000 --- a/test/completion/tightvncviewer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tightvncviewer diff --git a/test/completion/time.exp b/test/completion/time.exp deleted file mode 100644 index fc90f521..00000000 --- a/test/completion/time.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions time diff --git a/test/completion/timeout.exp b/test/completion/timeout.exp deleted file mode 100644 index 434a291a..00000000 --- a/test/completion/timeout.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions timeout diff --git a/test/completion/tipc.exp b/test/completion/tipc.exp deleted file mode 100644 index 51a6a7d7..00000000 --- a/test/completion/tipc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tipc diff --git a/test/completion/touch.exp b/test/completion/touch.exp deleted file mode 100644 index 212622c5..00000000 --- a/test/completion/touch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions touch diff --git a/test/completion/tox.exp b/test/completion/tox.exp deleted file mode 100644 index f383b569..00000000 --- a/test/completion/tox.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tox diff --git a/test/completion/tr.exp b/test/completion/tr.exp deleted file mode 100644 index c5b3f9be..00000000 --- a/test/completion/tr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tr diff --git a/test/completion/tracepath.exp b/test/completion/tracepath.exp deleted file mode 100644 index 621f0ba8..00000000 --- a/test/completion/tracepath.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tracepath diff --git a/test/completion/tshark.exp b/test/completion/tshark.exp deleted file mode 100644 index 885fae32..00000000 --- a/test/completion/tshark.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tshark diff --git a/test/completion/tune2fs.exp b/test/completion/tune2fs.exp deleted file mode 100644 index db034967..00000000 --- a/test/completion/tune2fs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions tune2fs diff --git a/test/completion/udevadm.exp b/test/completion/udevadm.exp deleted file mode 100644 index 69c980ff..00000000 --- a/test/completion/udevadm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions udevadm diff --git a/test/completion/unace.exp b/test/completion/unace.exp deleted file mode 100644 index 0fe2b39f..00000000 --- a/test/completion/unace.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions unace diff --git a/test/completion/uname.exp b/test/completion/uname.exp deleted file mode 100644 index 45f26569..00000000 --- a/test/completion/uname.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions uname diff --git a/test/completion/unexpand.exp b/test/completion/unexpand.exp deleted file mode 100644 index ed11ba79..00000000 --- a/test/completion/unexpand.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions unexpand diff --git a/test/completion/uniq.exp b/test/completion/uniq.exp deleted file mode 100644 index a1dfa4a7..00000000 --- a/test/completion/uniq.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions uniq diff --git a/test/completion/units.exp b/test/completion/units.exp deleted file mode 100644 index 5c9bfb73..00000000 --- a/test/completion/units.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions units diff --git a/test/completion/unpack200.exp b/test/completion/unpack200.exp deleted file mode 100644 index c90d02ed..00000000 --- a/test/completion/unpack200.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions unpack200 diff --git a/test/completion/unrar.exp b/test/completion/unrar.exp deleted file mode 100644 index d9a509ee..00000000 --- a/test/completion/unrar.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions unrar diff --git a/test/completion/unset.exp b/test/completion/unset.exp deleted file mode 100644 index 8a00dbf2..00000000 --- a/test/completion/unset.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions unset diff --git a/test/completion/unshunt.exp b/test/completion/unshunt.exp deleted file mode 100644 index 9755c784..00000000 --- a/test/completion/unshunt.exp +++ /dev/null @@ -1,3 +0,0 @@ -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/update-alternatives.exp b/test/completion/update-alternatives.exp deleted file mode 100644 index ff4bc114..00000000 --- a/test/completion/update-alternatives.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions update-alternatives diff --git a/test/completion/update-rc.d.exp b/test/completion/update-rc.d.exp deleted file mode 100644 index 1becc8cc..00000000 --- a/test/completion/update-rc.d.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions update-rc.d diff --git a/test/completion/urlsnarf.exp b/test/completion/urlsnarf.exp deleted file mode 100644 index c541391b..00000000 --- a/test/completion/urlsnarf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions urlsnarf diff --git a/test/completion/uscan.exp b/test/completion/uscan.exp deleted file mode 100644 index e524e39e..00000000 --- a/test/completion/uscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions uscan diff --git a/test/completion/useradd.exp b/test/completion/useradd.exp deleted file mode 100644 index f91bddae..00000000 --- a/test/completion/useradd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions useradd diff --git a/test/completion/userdel.exp b/test/completion/userdel.exp deleted file mode 100644 index e4ba42ce..00000000 --- a/test/completion/userdel.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions userdel diff --git a/test/completion/usermod.exp b/test/completion/usermod.exp deleted file mode 100644 index e3861f52..00000000 --- a/test/completion/usermod.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions usermod diff --git a/test/completion/valgrind.exp b/test/completion/valgrind.exp deleted file mode 100644 index aadd5a52..00000000 --- a/test/completion/valgrind.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions valgrind diff --git a/test/completion/vdir.exp b/test/completion/vdir.exp deleted file mode 100644 index 582f3b09..00000000 --- a/test/completion/vdir.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vdir diff --git a/test/completion/vgcfgbackup.exp b/test/completion/vgcfgbackup.exp deleted file mode 100644 index d512f0bd..00000000 --- a/test/completion/vgcfgbackup.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgcfgbackup diff --git a/test/completion/vgcfgrestore.exp b/test/completion/vgcfgrestore.exp deleted file mode 100644 index 75319983..00000000 --- a/test/completion/vgcfgrestore.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgcfgrestore diff --git a/test/completion/vgchange.exp b/test/completion/vgchange.exp deleted file mode 100644 index 80c35c63..00000000 --- a/test/completion/vgchange.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgchange diff --git a/test/completion/vgck.exp b/test/completion/vgck.exp deleted file mode 100644 index 06a0829e..00000000 --- a/test/completion/vgck.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgck diff --git a/test/completion/vgconvert.exp b/test/completion/vgconvert.exp deleted file mode 100644 index 374522e2..00000000 --- a/test/completion/vgconvert.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgconvert diff --git a/test/completion/vgcreate.exp b/test/completion/vgcreate.exp deleted file mode 100644 index 11c38703..00000000 --- a/test/completion/vgcreate.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgcreate diff --git a/test/completion/vgdisplay.exp b/test/completion/vgdisplay.exp deleted file mode 100644 index 0f8653cd..00000000 --- a/test/completion/vgdisplay.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgdisplay diff --git a/test/completion/vgexport.exp b/test/completion/vgexport.exp deleted file mode 100644 index 13f10342..00000000 --- a/test/completion/vgexport.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgexport diff --git a/test/completion/vgextend.exp b/test/completion/vgextend.exp deleted file mode 100644 index 4b860708..00000000 --- a/test/completion/vgextend.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgextend diff --git a/test/completion/vgimport.exp b/test/completion/vgimport.exp deleted file mode 100644 index dd45bfd0..00000000 --- a/test/completion/vgimport.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgimport diff --git a/test/completion/vgmerge.exp b/test/completion/vgmerge.exp deleted file mode 100644 index 50556060..00000000 --- a/test/completion/vgmerge.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgmerge diff --git a/test/completion/vgmknodes.exp b/test/completion/vgmknodes.exp deleted file mode 100644 index 74f13cb3..00000000 --- a/test/completion/vgmknodes.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgmknodes diff --git a/test/completion/vgreduce.exp b/test/completion/vgreduce.exp deleted file mode 100644 index 47338e05..00000000 --- a/test/completion/vgreduce.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgreduce diff --git a/test/completion/vgremove.exp b/test/completion/vgremove.exp deleted file mode 100644 index 029ba70e..00000000 --- a/test/completion/vgremove.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgremove diff --git a/test/completion/vgrename.exp b/test/completion/vgrename.exp deleted file mode 100644 index 17460c3c..00000000 --- a/test/completion/vgrename.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgrename diff --git a/test/completion/vgs.exp b/test/completion/vgs.exp deleted file mode 100644 index 470b8ecd..00000000 --- a/test/completion/vgs.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgs diff --git a/test/completion/vgscan.exp b/test/completion/vgscan.exp deleted file mode 100644 index a8f1ce46..00000000 --- a/test/completion/vgscan.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgscan diff --git a/test/completion/vgsplit.exp b/test/completion/vgsplit.exp deleted file mode 100644 index d4777569..00000000 --- a/test/completion/vgsplit.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vgsplit diff --git a/test/completion/vi.exp b/test/completion/vi.exp deleted file mode 100644 index b0191404..00000000 --- a/test/completion/vi.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vi diff --git a/test/completion/vipw.exp b/test/completion/vipw.exp deleted file mode 100644 index 38438679..00000000 --- a/test/completion/vipw.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vipw diff --git a/test/completion/vmstat.exp b/test/completion/vmstat.exp deleted file mode 100644 index e55f28e3..00000000 --- a/test/completion/vmstat.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vmstat diff --git a/test/completion/vncviewer.exp b/test/completion/vncviewer.exp deleted file mode 100644 index 05c663d3..00000000 --- a/test/completion/vncviewer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vncviewer diff --git a/test/completion/vpnc.exp b/test/completion/vpnc.exp deleted file mode 100644 index 29511b59..00000000 --- a/test/completion/vpnc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions vpnc diff --git a/test/completion/watch.exp b/test/completion/watch.exp deleted file mode 100644 index 9bb0644f..00000000 --- a/test/completion/watch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions watch diff --git a/test/completion/wc.exp b/test/completion/wc.exp deleted file mode 100644 index fc6a0432..00000000 --- a/test/completion/wc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wc diff --git a/test/completion/webmitm.exp b/test/completion/webmitm.exp deleted file mode 100644 index 73d8a2a7..00000000 --- a/test/completion/webmitm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions webmitm diff --git a/test/completion/wget.exp b/test/completion/wget.exp deleted file mode 100644 index 0607f2e6..00000000 --- a/test/completion/wget.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wget diff --git a/test/completion/who.exp b/test/completion/who.exp deleted file mode 100644 index 3a312a32..00000000 --- a/test/completion/who.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions who diff --git a/test/completion/wine.exp b/test/completion/wine.exp deleted file mode 100644 index ddb1e6f1..00000000 --- a/test/completion/wine.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wine diff --git a/test/completion/withlist.exp b/test/completion/withlist.exp deleted file mode 100644 index cfc5a546..00000000 --- a/test/completion/withlist.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions withlist diff --git a/test/completion/wodim.exp b/test/completion/wodim.exp deleted file mode 100644 index 51b407ba..00000000 --- a/test/completion/wodim.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wodim diff --git a/test/completion/wol.exp b/test/completion/wol.exp deleted file mode 100644 index 2e499726..00000000 --- a/test/completion/wol.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wol diff --git a/test/completion/write.exp b/test/completion/write.exp deleted file mode 100644 index d454b62f..00000000 --- a/test/completion/write.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions write diff --git a/test/completion/wsimport.exp b/test/completion/wsimport.exp deleted file mode 100644 index 3f889e26..00000000 --- a/test/completion/wsimport.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wsimport diff --git a/test/completion/wtf.exp b/test/completion/wtf.exp deleted file mode 100644 index 3e1b364c..00000000 --- a/test/completion/wtf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wtf diff --git a/test/completion/wvdial.exp b/test/completion/wvdial.exp deleted file mode 100644 index 46b65712..00000000 --- a/test/completion/wvdial.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions wvdial diff --git a/test/completion/xdg-mime.exp b/test/completion/xdg-mime.exp deleted file mode 100644 index 01f24d41..00000000 --- a/test/completion/xdg-mime.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xdg-mime diff --git a/test/completion/xdg-settings.exp b/test/completion/xdg-settings.exp deleted file mode 100644 index 8fb8a53e..00000000 --- a/test/completion/xdg-settings.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xdg-settings diff --git a/test/completion/xfreerdp.exp b/test/completion/xfreerdp.exp deleted file mode 100644 index 5ca649a2..00000000 --- a/test/completion/xfreerdp.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xfreerdp diff --git a/test/completion/xgamma.exp b/test/completion/xgamma.exp deleted file mode 100644 index 706e74f9..00000000 --- a/test/completion/xgamma.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xgamma diff --git a/test/completion/xm.exp b/test/completion/xm.exp deleted file mode 100644 index fa0cddf6..00000000 --- a/test/completion/xm.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xm diff --git a/test/completion/xmllint.exp b/test/completion/xmllint.exp deleted file mode 100644 index 64210c80..00000000 --- a/test/completion/xmllint.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xmllint diff --git a/test/completion/xmlwf.exp b/test/completion/xmlwf.exp deleted file mode 100644 index afe823b6..00000000 --- a/test/completion/xmlwf.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xmlwf diff --git a/test/completion/xmms.exp b/test/completion/xmms.exp deleted file mode 100644 index 2ebde005..00000000 --- a/test/completion/xmms.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xmms diff --git a/test/completion/xmodmap.exp b/test/completion/xmodmap.exp deleted file mode 100644 index a80bb027..00000000 --- a/test/completion/xmodmap.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xmodmap diff --git a/test/completion/xpovray.exp b/test/completion/xpovray.exp deleted file mode 100644 index 1ada5e03..00000000 --- a/test/completion/xpovray.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xpovray diff --git a/test/completion/xrandr.exp b/test/completion/xrandr.exp deleted file mode 100644 index 37dcedcc..00000000 --- a/test/completion/xrandr.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xrandr diff --git a/test/completion/xrdb.exp b/test/completion/xrdb.exp deleted file mode 100644 index 522ac311..00000000 --- a/test/completion/xrdb.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xrdb diff --git a/test/completion/xsltproc.exp b/test/completion/xsltproc.exp deleted file mode 100644 index 8729fbe1..00000000 --- a/test/completion/xsltproc.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xsltproc diff --git a/test/completion/xvnc4viewer.exp b/test/completion/xvnc4viewer.exp deleted file mode 100644 index 0c7210bc..00000000 --- a/test/completion/xvnc4viewer.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xvnc4viewer diff --git a/test/completion/xxd.exp b/test/completion/xxd.exp deleted file mode 100644 index d9750e40..00000000 --- a/test/completion/xxd.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xxd diff --git a/test/completion/xz.exp b/test/completion/xz.exp deleted file mode 100644 index 92a6a170..00000000 --- a/test/completion/xz.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xz diff --git a/test/completion/xzdec.exp b/test/completion/xzdec.exp deleted file mode 100644 index 65330d6b..00000000 --- a/test/completion/xzdec.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions xzdec diff --git a/test/completion/ypcat.exp b/test/completion/ypcat.exp deleted file mode 100644 index 9a244c68..00000000 --- a/test/completion/ypcat.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ypcat diff --git a/test/completion/ypmatch.exp b/test/completion/ypmatch.exp deleted file mode 100644 index 5ec094fa..00000000 --- a/test/completion/ypmatch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions ypmatch diff --git a/test/completion/yum-arch.exp b/test/completion/yum-arch.exp deleted file mode 100644 index 95284151..00000000 --- a/test/completion/yum-arch.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions yum-arch diff --git a/test/completion/yum.exp b/test/completion/yum.exp deleted file mode 100644 index d1b7c1f8..00000000 --- a/test/completion/yum.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions yum diff --git a/test/completion/zopfli.exp b/test/completion/zopfli.exp deleted file mode 100644 index 086f78cf..00000000 --- a/test/completion/zopfli.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions zopfli diff --git a/test/completion/zopflipng.exp b/test/completion/zopflipng.exp deleted file mode 100644 index e16a74ab..00000000 --- a/test/completion/zopflipng.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions zopflipng diff --git a/test/docker/Dockerfile-tools b/test/docker/Dockerfile-tools new file mode 100644 index 00000000..2328808e --- /dev/null +++ b/test/docker/Dockerfile-tools @@ -0,0 +1,3 @@ +FROM vskytta/bash-completion:tools + +COPY . . diff --git a/test/docker/docker-script.sh b/test/docker/docker-script.sh index 6ba6fa90..ec310b35 100755 --- a/test/docker/docker-script.sh +++ b/test/docker/docker-script.sh @@ -1,19 +1,42 @@ #!/bin/sh -ex +if [ $DIST = tools ]; then + rc=0 + perlcritic helpers/perl; rc=$((rc+$?)) + perltidy -nst -nse helpers/perl; rc=$((rc+$?)) + if [ -e helpers/perl.ERR ]; then + cat helpers/perl.ERR + rc=$((rc+1)) + fi + flake8 helpers/python test test/generate; rc=$((rc+$?)) + black --check -t py27 -t py33 -t py34 -t py35 -t py36 -t py37 -t py38 \ + helpers/python; rc=$((rc+$?)) + black --check test test/generate; rc=$((rc+$?)) + exit $rc +fi + +if [ "$BSD" ]; then + PATH=/usr/local/lib/bsd-bin:$PATH + export PATH +fi + +case $DIST in + centos6|ubuntu14) + : ${PYTEST:=/root/.local/bin/pytest} + ;; + *) + : ${PYTEST:=pytest-3} + ;; +esac + export bashcomp_bash=bash env autoreconf -i ./configure -make - -make -C completions check - -cd test -xvfb-run ./runCompletion --all -./runInstall --all -./runUnit --all +make -j -cd .. -mkdir install-test -make install DESTDIR=$(pwd)/install-test +xvfb-run make distcheck \ + PYTEST=$PYTEST \ + PYTESTFLAGS="--numprocesses=auto --dist=loadfile" \ + RUNTESTFLAGS="--all --verbose" diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts index 0d6f5025..646b5b6a 100644 --- a/test/fixtures/_known_hosts_real/known_hosts +++ b/test/fixtures/_known_hosts_real/known_hosts @@ -1,6 +1,7 @@ |1|abc |1|def doo +# this is a comment ike ssh-rsa qwerty1234/Qwerty+1234== jub,10.0.0.1 @cert-authority kyl,100.0.0.2 xxxfoo diff --git a/test/fixtures/_longopt/grep--help.txt b/test/fixtures/_longopt/grep--help.txt new file mode 100644 index 00000000..92662563 --- /dev/null +++ b/test/fixtures/_longopt/grep--help.txt @@ -0,0 +1,70 @@ +Usage: grep [OPTION]... PATTERN [FILE]... +Search for PATTERN in each FILE. +Example: grep -i 'hello world' menu.h main.c + +Pattern selection and interpretation: + -E, --extended-regexp PATTERN is an extended regular expression + -F, --fixed-strings PATTERN is a set of newline-separated strings + -G, --basic-regexp PATTERN is a basic regular expression (default) + -P, --perl-regexp PATTERN is a Perl regular expression + -e, --regexp=PATTERN use PATTERN for matching + -f, --file=FILE obtain PATTERN from FILE + -i, --ignore-case ignore case distinctions + -w, --word-regexp force PATTERN to match only whole words + -x, --line-regexp force PATTERN to match only whole lines + -z, --null-data a data line ends in 0 byte, not newline + +Miscellaneous: + -s, --no-messages suppress error messages + -v, --invert-match select non-matching lines + -V, --version display version information and exit + --help display this help text and exit + +Output control: + -m, --max-count=NUM stop after NUM selected lines + -b, --byte-offset print the byte offset with output lines + -n, --line-number print line number with output lines + --line-buffered flush output on every line + -H, --with-filename print file name with output lines + -h, --no-filename suppress the file name prefix on output + --label=LABEL use LABEL as the standard input file name prefix + -o, --only-matching show only the part of a line matching PATTERN + -q, --quiet, --silent suppress all normal output + --binary-files=TYPE assume that binary files are TYPE; + TYPE is 'binary', 'text', or 'without-match' + -a, --text equivalent to --binary-files=text + -I equivalent to --binary-files=without-match + -d, --directories=ACTION how to handle directories; + ACTION is 'read', 'recurse', or 'skip' + -D, --devices=ACTION how to handle devices, FIFOs and sockets; + ACTION is 'read' or 'skip' + -r, --recursive like --directories=recurse + -R, --dereference-recursive likewise, but follow all symlinks + --include=FILE_PATTERN search only files that match FILE_PATTERN + --exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN + --exclude-from=FILE skip files matching any file pattern from FILE + --exclude-dir=PATTERN directories that match PATTERN will be skipped. + -L, --files-without-match print only names of FILEs with no selected lines + -l, --files-with-matches print only names of FILEs with selected lines + -c, --count print only a count of selected lines per FILE + -T, --initial-tab make tabs line up (if needed) + -Z, --null print 0 byte after FILE name + +Context control: + -B, --before-context=NUM print NUM lines of leading context + -A, --after-context=NUM print NUM lines of trailing context + -C, --context=NUM print NUM lines of output context + -NUM same as --context=NUM + --color[=WHEN], + --colour[=WHEN] use markers to highlight the matching strings; + WHEN is 'always', 'never', or 'auto' + -U, --binary do not strip CR characters at EOL (MSDOS/Windows) + +When FILE is '-', read standard input. With no FILE, read '.' if +recursive, '-' otherwise. With fewer than two FILEs, assume -h. +Exit status is 0 if any line is selected, 1 otherwise; +if any error occurs and -q is not given, the exit status is 2. + +Report bugs to: bug-grep@gnu.org +GNU grep home page: <http://www.gnu.org/software/grep/> +General help using GNU software: <http://www.gnu.org/gethelp/> diff --git a/test/fixtures/dnssec-keygen/dnssec-keygen b/test/fixtures/dnssec-keygen/dnssec-keygen new file mode 100755 index 00000000..882cd97c --- /dev/null +++ b/test/fixtures/dnssec-keygen/dnssec-keygen @@ -0,0 +1,76 @@ +#!/bin/sh + +cat <<\EOF >&2 +Usage: + dnssec-keygen [options] name + +Version: 9.11.3-1ubuntu1.5-Ubuntu + name: owner of the key +Options: + -K <directory>: write keys into directory + -a <algorithm>: + RSA | RSAMD5 | DSA | RSASHA1 | NSEC3RSASHA1 | NSEC3DSA | + RSASHA256 | RSASHA512 | ECCGOST | + ECDSAP256SHA256 | ECDSAP384SHA384 | + ED25519 | ED448 | DH | + HMAC-MD5 | HMAC-SHA1 | HMAC-SHA224 | HMAC-SHA256 | + HMAC-SHA384 | HMAC-SHA512 + (default: RSASHA1, or NSEC3RSASHA1 if using -3) + -3: use NSEC3-capable algorithm + -b <key size in bits>: + RSAMD5: [512..4096] + RSASHA1: [512..4096] + NSEC3RSASHA1: [512..4096] + RSASHA256: [512..4096] + RSASHA512: [1024..4096] + DH: [128..4096] + DSA: [512..1024] and divisible by 64 + NSEC3DSA: [512..1024] and divisible by 64 + ECCGOST: ignored + ECDSAP256SHA256: ignored + ECDSAP384SHA384: ignored + ED25519: ignored + ED448: ignored + HMAC-MD5: [1..512] + HMAC-SHA1: [1..160] + HMAC-SHA224: [1..224] + HMAC-SHA256: [1..256] + HMAC-SHA384: [1..384] + HMAC-SHA512: [1..512] + (if using the default algorithm, key size + defaults to 2048 for KSK, or 1024 for all others) + -n <nametype>: ZONE | HOST | ENTITY | USER | OTHER + (DNSKEY generation defaults to ZONE) + -c <class>: (default: IN) + -d <digest bits> (0 => max, default) + -E <engine>: + name of an OpenSSL engine to use + -f <keyflag>: KSK | REVOKE + -g <generator>: use specified generator (DH only) + -L <ttl>: default key TTL + -p <protocol>: (default: 3 [dnssec]) + -r <randomdev>: a file containing random data + -s <strength>: strength value this key signs DNS records with (default: 0) + -T <rrtype>: DNSKEY | KEY (default: DNSKEY; use KEY for SIG(0)) + -t <type>: AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF (default: AUTHCONF) + -h: print usage and exit + -m <memory debugging mode>: + usage | trace | record | size | mctx + -v <level>: set verbosity level (0 - 10) + -V: print version information +Timing options: + -P date/[+-]offset/none: set key publication date (default: now) + -P sync date/[+-]offset/none: set CDS and CDNSKEY publication date + -A date/[+-]offset/none: set key activation date (default: now) + -R date/[+-]offset/none: set key revocation date + -I date/[+-]offset/none: set key inactivation date + -D date/[+-]offset/none: set key deletion date + -D sync date/[+-]offset/none: set CDS and CDNSKEY deletion date + -G: generate key only; do not set -P or -A + -C: generate a backward-compatible key, omitting all dates + -S <key>: generate a successor to an existing key + -i <interval>: prepublication interval for successor key (default: 30 days) +Output: + K<name>+<alg>+<id>.key, K<name>+<alg>+<id>.private +EOF +exit 255 diff --git a/test/fixtures/gdb/core b/test/fixtures/gdb/core new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/gdb/core diff --git a/test/fixtures/gdb/core-NOT b/test/fixtures/gdb/core-NOT new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/gdb/core-NOT diff --git a/test/fixtures/gdb/core.12345 b/test/fixtures/gdb/core.12345 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/gdb/core.12345 diff --git a/test/fixtures/gdb/core.weston.1000.deadbeef.5308.1555362132000000 b/test/fixtures/gdb/core.weston.1000.deadbeef.5308.1555362132000000 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/gdb/core.weston.1000.deadbeef.5308.1555362132000000 diff --git a/test/fixtures/gdb/corenot b/test/fixtures/gdb/corenot new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/gdb/corenot diff --git a/test/generate b/test/generate index deeba05a..59f525b7 100755 --- a/test/generate +++ b/test/generate @@ -1,64 +1,60 @@ -#!/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" +#!/usr/bin/env python3 + +# Generate skeleton files for completion of specified command + +import fileinput +import re +import sys + + +def main(): + if len(sys.argv) < 2: + print("Usage: %s command [args...]" % sys.argv[0], file=sys.stderr) + sys.exit(1) + + cmd = testfile = sys.argv[1] + args = " ".join(sys.argv[2:]) if len(sys.argv) > 2 else "" + marker = "" + if re.search("[.+-]", cmd): + testfile = re.sub("[.-]", "_", cmd).replace("+", "plus") + marker = '\n@pytest.mark.bashcomp(\n cmd="%s",\n)' % cmd + testfile = "test_%s.py" % testfile + name = re.sub("(^|[_-]+)(.)", lambda m: m.group(2).upper(), cmd) + name = name.replace("+", "Plus") + + with open("t/%s" % testfile, "w") as f: + print( + """\ +import pytest + +%s +class Test%s: + @pytest.mark.complete("%s %s") + def test_1(self, completion): + assert completion""" + % (marker, name, cmd, args), + file=f, + ) + + in_extra_dist = False + extra_dist_lines = set() + with fileinput.input(files=("t/Makefile.am"), inplace=True) as f: + for line in f: + if line.startswith("EXTRA_DIST "): + in_extra_dist = True + elif in_extra_dist: + if line.startswith("\t"): + line = line.strip() + if not line.endswith("\\"): + line += " \\" + extra_dist_lines.add(line) + continue + extra_dist_lines.add("%s \\" % testfile) + sys.stdout.write("\t") + print("\n\t".join(sorted(extra_dist_lines))[:-2]) + in_extra_dist = False + sys.stdout.write(line) + + +if __name__ == "__main__": + main() diff --git a/test/lib/completions/2to3.exp b/test/lib/completions/2to3.exp deleted file mode 100644 index 101fbf87..00000000 --- a/test/lib/completions/2to3.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "2to3 " -sync_after_int - - -teardown diff --git a/test/lib/completions/7z.exp b/test/lib/completions/7z.exp deleted file mode 100644 index 4e7e8689..00000000 --- a/test/lib/completions/7z.exp +++ /dev/null @@ -1,37 +0,0 @@ -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/a2ps.exp b/test/lib/completions/a2ps.exp deleted file mode 100644 index 77cd07f5..00000000 --- a/test/lib/completions/a2ps.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "a2ps " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/a2x.exp b/test/lib/completions/a2x.exp deleted file mode 100644 index e1ca8844..00000000 --- a/test/lib/completions/a2x.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "a2x " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp deleted file mode 100644 index 463a28c0..00000000 --- a/test/lib/completions/abook.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "abook -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/aclocal.exp deleted file mode 100644 index da133aa8..00000000 --- a/test/lib/completions/aclocal.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "aclocal " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/acpi.exp b/test/lib/completions/acpi.exp deleted file mode 100644 index 278cdceb..00000000 --- a/test/lib/completions/acpi.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "acpi -" -sync_after_int - - -teardown diff --git a/test/lib/completions/acroread.exp b/test/lib/completions/acroread.exp deleted file mode 100644 index f627d34e..00000000 --- a/test/lib/completions/acroread.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD/d} -} - - -setup - - -assert_complete_dir {foo.d/ t.pdf} "acroread " $::srcdir/fixtures/acroread - - -sync_after_int - - -teardown diff --git a/test/lib/completions/adb.exp b/test/lib/completions/adb.exp deleted file mode 100644 index 0d41fd2d..00000000 --- a/test/lib/completions/adb.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "adb " -sync_after_int - - -teardown diff --git a/test/lib/completions/add_members.exp b/test/lib/completions/add_members.exp deleted file mode 100644 index 46c7a688..00000000 --- a/test/lib/completions/add_members.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "add_members -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp index 2010df2d..c41417f1 100644 --- a/test/lib/completions/alias.exp +++ b/test/lib/completions/alias.exp @@ -15,13 +15,6 @@ proc teardown {} { setup -set test "Tab should complete alias" - # Try completion -set cmd "alias " -assert_complete {bar foo} $cmd $test -sync_after_int - - set test "Tab should complete alias at cursor position" # Try completion set cmd "alias foo" @@ -36,9 +29,4 @@ expect { sync_after_int -# FIXME: test case for "alias foo=<TAB>" -> "alias foo='bar'", this doesn't work -#assert_complete {foo='bar'} "alias foo=" "" -nospace -#sync_after_int - - teardown diff --git a/test/lib/completions/alpine.exp b/test/lib/completions/alpine.exp deleted file mode 100644 index 5ae1901c..00000000 --- a/test/lib/completions/alpine.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "alpine -" -sync_after_int - - -teardown diff --git a/test/lib/completions/animate.exp b/test/lib/completions/animate.exp deleted file mode 100644 index 12314d79..00000000 --- a/test/lib/completions/animate.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "animate " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp deleted file mode 100644 index bcf87711..00000000 --- a/test/lib/completions/ant.exp +++ /dev/null @@ -1,39 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /OLDPWD=/d - /ANT_ARGS=/d - } -} - - -setup - - -assert_complete_any "ant -" -sync_after_int - - -assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/ant -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/apache2ctl.exp b/test/lib/completions/apache2ctl.exp deleted file mode 100644 index 88e53fc2..00000000 --- a/test/lib/completions/apache2ctl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "apache2ctl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/appdata-validate.exp b/test/lib/completions/appdata-validate.exp deleted file mode 100644 index 583c2952..00000000 --- a/test/lib/completions/appdata-validate.exp +++ /dev/null @@ -1,18 +0,0 @@ -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-build.exp b/test/lib/completions/apt-build.exp deleted file mode 100644 index 01ff04b4..00000000 --- a/test/lib/completions/apt-build.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "apt-build " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/apt-cache.exp b/test/lib/completions/apt-cache.exp deleted file mode 100644 index 63be48a8..00000000 --- a/test/lib/completions/apt-cache.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "apt-cache " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp deleted file mode 100644 index 8a5d3629..00000000 --- a/test/lib/completions/apt-get.exp +++ /dev/null @@ -1,29 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -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 - - -assert_complete_dir "./bash-completion-test-subject.deb" "apt-get install ./" "$::srcdir/fixtures/dpkg" -sync_after_int - - -teardown diff --git a/test/lib/completions/aptitude.exp b/test/lib/completions/aptitude.exp deleted file mode 100644 index e6e82abb..00000000 --- a/test/lib/completions/aptitude.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "aptitude " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp deleted file mode 100644 index 5bad0e60..00000000 --- a/test/lib/completions/arch.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "arch -" -sync_after_int - - -teardown diff --git a/test/lib/completions/arping.exp b/test/lib/completions/arping.exp deleted file mode 100644 index 531bb07f..00000000 --- a/test/lib/completions/arping.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "arping " -sync_after_int - -assert_complete_any "arping -" -sync_after_int - - -teardown diff --git a/test/lib/completions/arpspoof.exp b/test/lib/completions/arpspoof.exp deleted file mode 100644 index 91ef5182..00000000 --- a/test/lib/completions/arpspoof.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "arpspoof -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/asciidoc.exp b/test/lib/completions/asciidoc.exp deleted file mode 100644 index 86e7609a..00000000 --- a/test/lib/completions/asciidoc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "asciidoc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/aspell.exp b/test/lib/completions/aspell.exp deleted file mode 100644 index 9dd5f61a..00000000 --- a/test/lib/completions/aspell.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "aspell " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autoconf.exp b/test/lib/completions/autoconf.exp deleted file mode 100644 index 53b096db..00000000 --- a/test/lib/completions/autoconf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autoconf " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autoheader.exp b/test/lib/completions/autoheader.exp deleted file mode 100644 index d85d4606..00000000 --- a/test/lib/completions/autoheader.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autoheader " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/automake.exp b/test/lib/completions/automake.exp deleted file mode 100644 index f875da56..00000000 --- a/test/lib/completions/automake.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "automake " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autoreconf.exp b/test/lib/completions/autoreconf.exp deleted file mode 100644 index 98808fb2..00000000 --- a/test/lib/completions/autoreconf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autoreconf " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autorpm.exp b/test/lib/completions/autorpm.exp deleted file mode 100644 index 2ae4ff80..00000000 --- a/test/lib/completions/autorpm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autorpm " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autoscan.exp b/test/lib/completions/autoscan.exp deleted file mode 100644 index f75da812..00000000 --- a/test/lib/completions/autoscan.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autoscan " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/autoupdate.exp b/test/lib/completions/autoupdate.exp deleted file mode 100644 index c83912dd..00000000 --- a/test/lib/completions/autoupdate.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "autoupdate " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/avctrl.exp b/test/lib/completions/avctrl.exp deleted file mode 100644 index 6ca9de70..00000000 --- a/test/lib/completions/avctrl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "avctrl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/awk.exp b/test/lib/completions/awk.exp deleted file mode 100644 index 260dabcc..00000000 --- a/test/lib/completions/awk.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "awk " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/badblocks.exp b/test/lib/completions/badblocks.exp deleted file mode 100644 index d453b5bd..00000000 --- a/test/lib/completions/badblocks.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "badblocks " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/base64.exp b/test/lib/completions/base64.exp deleted file mode 100644 index 1f3f35cf..00000000 --- a/test/lib/completions/base64.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "base64 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/bash.exp b/test/lib/completions/bash.exp deleted file mode 100644 index bf01e76d..00000000 --- a/test/lib/completions/bash.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "bash --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/bc.exp b/test/lib/completions/bc.exp deleted file mode 100644 index 23c22b62..00000000 --- a/test/lib/completions/bc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "bc --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/bind.exp b/test/lib/completions/bind.exp deleted file mode 100644 index 09bbaaa1..00000000 --- a/test/lib/completions/bind.exp +++ /dev/null @@ -1,21 +0,0 @@ -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/bison.exp b/test/lib/completions/bison.exp deleted file mode 100644 index 4bbb59fa..00000000 --- a/test/lib/completions/bison.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "bison --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/bk.exp b/test/lib/completions/bk.exp deleted file mode 100644 index b652e6b0..00000000 --- a/test/lib/completions/bk.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "bk " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/brctl.exp b/test/lib/completions/brctl.exp deleted file mode 100644 index 57c9edff..00000000 --- a/test/lib/completions/brctl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "brctl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/btdownloadcurses.py.exp b/test/lib/completions/btdownloadcurses.py.exp deleted file mode 100644 index 71a00de7..00000000 --- a/test/lib/completions/btdownloadcurses.py.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "btdownloadcurses.py " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/btdownloadgui.py.exp b/test/lib/completions/btdownloadgui.py.exp deleted file mode 100644 index 65f56776..00000000 --- a/test/lib/completions/btdownloadgui.py.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "btdownloadgui.py " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/btdownloadheadless.py.exp b/test/lib/completions/btdownloadheadless.py.exp deleted file mode 100644 index 3c833bb8..00000000 --- a/test/lib/completions/btdownloadheadless.py.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "btdownloadheadless.py " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/bts.exp b/test/lib/completions/bts.exp deleted file mode 100644 index 38b92b9d..00000000 --- a/test/lib/completions/bts.exp +++ /dev/null @@ -1,21 +0,0 @@ -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/bzip2.exp b/test/lib/completions/bzip2.exp deleted file mode 100644 index d806851a..00000000 --- a/test/lib/completions/bzip2.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "bzip2 " - - -sync_after_int - - -assert_complete_homedir "bzip" -sync_after_int - - -teardown diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp deleted file mode 100644 index c899de27..00000000 --- a/test/lib/completions/c++.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "c++ " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cal.exp b/test/lib/completions/cal.exp deleted file mode 100644 index bf7185e2..00000000 --- a/test/lib/completions/cal.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cal " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cancel.exp b/test/lib/completions/cancel.exp deleted file mode 100644 index f4a03473..00000000 --- a/test/lib/completions/cancel.exp +++ /dev/null @@ -1,31 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - - # Adding a print job is successful? -if {[assert_exec {lp -H hold $::srcdir/fixtures/shared/default/foo} job "" "untested"]} { - # Yes, adding a print-job is successful; - # Retrieve job-id, so we can cancel the job after the test - set job_id [lindex [split $job] 3] - # Retrieve list of all current print jobs - assert_exec {lpstat | cut -d\040 -f1} jobs - # Completion should show all print jobs - assert_complete $jobs "cancel " - # Remove/cancel the test print job - assert_exec "cancel $job_id" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cardctl.exp b/test/lib/completions/cardctl.exp deleted file mode 100644 index 9df90f48..00000000 --- a/test/lib/completions/cardctl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cardctl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cat.exp b/test/lib/completions/cat.exp deleted file mode 100644 index 01b3659e..00000000 --- a/test/lib/completions/cat.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cat " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cc.exp b/test/lib/completions/cc.exp deleted file mode 100644 index eb722dea..00000000 --- a/test/lib/completions/cc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ccache.exp b/test/lib/completions/ccache.exp deleted file mode 100644 index 7cb3103e..00000000 --- a/test/lib/completions/ccache.exp +++ /dev/null @@ -1,43 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -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/ccze.exp b/test/lib/completions/ccze.exp deleted file mode 100644 index 94b51b39..00000000 --- a/test/lib/completions/ccze.exp +++ /dev/null @@ -1,27 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ccze " -sync_after_int - -assert_no_complete "ccze -? " -sync_after_int - -assert_complete_any "ccze -o " -sync_after_int - -assert_complete_any "ccze --plugin=" -sync_after_int - - -teardown diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp index 6f36c881..ded094c3 100644 --- a/test/lib/completions/cd.exp +++ b/test/lib/completions/cd.exp @@ -11,13 +11,6 @@ proc teardown {} { setup -set test "Tab should complete" -assert_complete {"bar bar.d/" foo.d/} "cd $::srcdir/fixtures/shared/default/" $test - - -sync_after_int - - set test "Tab should complete cd at cursor position" # Try completion set cmd "cd $::srcdir/fixtures/shared/default/foo" @@ -35,23 +28,4 @@ expect { sync_after_int -set test "Tab should complete CDPATH" - # Set CDPATH -assert_bash_exec "declare -p CDPATH &>/dev/null && OLDCDPATH=\$CDPATH || :" -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 - -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" - - teardown diff --git a/test/lib/completions/cdrecord.exp b/test/lib/completions/cdrecord.exp deleted file mode 100644 index 192d2ded..00000000 --- a/test/lib/completions/cdrecord.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cdrecord -d" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cfagent.exp b/test/lib/completions/cfagent.exp deleted file mode 100644 index aa5c88cb..00000000 --- a/test/lib/completions/cfagent.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cfagent -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cfrun.exp b/test/lib/completions/cfrun.exp deleted file mode 100644 index 2cf6a4cb..00000000 --- a/test/lib/completions/cfrun.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cfrun -" -sync_after_int - - -teardown diff --git a/test/lib/completions/chage.exp b/test/lib/completions/chage.exp deleted file mode 100644 index e5399054..00000000 --- a/test/lib/completions/chage.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chage " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/change_pw.exp b/test/lib/completions/change_pw.exp deleted file mode 100644 index 28301941..00000000 --- a/test/lib/completions/change_pw.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "change_pw -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/check_db.exp b/test/lib/completions/check_db.exp deleted file mode 100644 index fe34ead2..00000000 --- a/test/lib/completions/check_db.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "check_db -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/check_perms.exp b/test/lib/completions/check_perms.exp deleted file mode 100644 index b40b78fc..00000000 --- a/test/lib/completions/check_perms.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "check_perms -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/checksec.exp b/test/lib/completions/checksec.exp deleted file mode 100644 index 03abd575..00000000 --- a/test/lib/completions/checksec.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "checksec -" -sync_after_int - - -teardown diff --git a/test/lib/completions/chfn.exp b/test/lib/completions/chfn.exp deleted file mode 100644 index ea977c76..00000000 --- a/test/lib/completions/chfn.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chfn " -sync_after_int - - -teardown diff --git a/test/lib/completions/chgrp.exp b/test/lib/completions/chgrp.exp deleted file mode 100644 index e9238bde..00000000 --- a/test/lib/completions/chgrp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chgrp " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp deleted file mode 100644 index 1714144d..00000000 --- a/test/lib/completions/chkconfig.exp +++ /dev/null @@ -1,27 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -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 - - -teardown diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp index 6bfd9d05..792d52a9 100644 --- a/test/lib/completions/chown.exp +++ b/test/lib/completions/chown.exp @@ -12,13 +12,6 @@ proc teardown {} { setup -set users [exec bash -c "compgen -A user"] -assert_complete $users "chown " - - -sync_after_int - - # Find user/group suitable for testing. set failed_find_unique_completion 0 foreach ug {user group} { @@ -34,14 +27,6 @@ foreach ug {user group} { # These tests require an unique completion. if {!$failed_find_unique_completion} { - assert_complete $fulluser "chown $partuser" - sync_after_int - - assert_complete $fulluser:$fullgroup "chown $fulluser:$partgroup" - sync_after_int - - assert_complete "dot.user:$fullgroup" "chown dot.user:$partgroup" - sync_after_int foreach prefix { "funky\\ user:" "funky.user:" "funky\\.user:" "fu\\ nky.user:" @@ -52,28 +37,7 @@ if {!$failed_find_unique_completion} { assert_complete $prefix$fullgroup "chown $prefix$partgroup" $test sync_after_int } - - # Check that we give up in degenerate cases instead of spewing various junk. - - assert_no_complete "chown $fulluser\\\\:$partgroup" - sync_after_int - - assert_no_complete "chown $fulluser\\\\\\:$partgroup" - sync_after_int - - assert_no_complete "chown $fulluser\\\\\\\\:$partgroup" - sync_after_int - - # Colons in user/groupnames are not usually allowed. - assert_no_complete "chown foo:bar:$partgroup" - sync_after_int } -assert_complete {bar "bar bar.d/" foo foo.d/} "chown foo: $::srcdir/fixtures/shared/default/" -sync_after_int - -assert_complete {bar "bar bar.d/" foo foo.d/} "chown :foo $::srcdir/fixtures/shared/default/" -sync_after_int - teardown diff --git a/test/lib/completions/chpasswd.exp b/test/lib/completions/chpasswd.exp deleted file mode 100644 index 84c3345f..00000000 --- a/test/lib/completions/chpasswd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chpasswd -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/chronyc.exp b/test/lib/completions/chronyc.exp deleted file mode 100644 index 33458113..00000000 --- a/test/lib/completions/chronyc.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chronyc -" -sync_after_int - -assert_complete_any "chronyc " -sync_after_int - - -teardown diff --git a/test/lib/completions/chroot.exp b/test/lib/completions/chroot.exp deleted file mode 100644 index ba9f63a1..00000000 --- a/test/lib/completions/chroot.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chroot " -sync_after_int - - -teardown diff --git a/test/lib/completions/chrpath.exp b/test/lib/completions/chrpath.exp deleted file mode 100644 index 311628eb..00000000 --- a/test/lib/completions/chrpath.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chrpath " -sync_after_int - -assert_complete_any "chrpath -" -sync_after_int - - -teardown diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp deleted file mode 100644 index 6736c18c..00000000 --- a/test/lib/completions/chsh.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "chsh -s " - - -sync_after_int - - -assert_complete_any "chsh " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ci.exp b/test/lib/completions/ci.exp deleted file mode 100644 index 15ef2ecc..00000000 --- a/test/lib/completions/ci.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ci " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ciptool.exp b/test/lib/completions/ciptool.exp deleted file mode 100644 index cefe8f92..00000000 --- a/test/lib/completions/ciptool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ciptool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/civclient.exp b/test/lib/completions/civclient.exp deleted file mode 100644 index c0047468..00000000 --- a/test/lib/completions/civclient.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "civclient -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/civserver.exp b/test/lib/completions/civserver.exp deleted file mode 100644 index 3739f50e..00000000 --- a/test/lib/completions/civserver.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "civserver -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cksfv.exp b/test/lib/completions/cksfv.exp deleted file mode 100644 index 2b9be04c..00000000 --- a/test/lib/completions/cksfv.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cksfv -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cleanarch.exp b/test/lib/completions/cleanarch.exp deleted file mode 100644 index a5f3bfe6..00000000 --- a/test/lib/completions/cleanarch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cleanarch -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/clisp.exp b/test/lib/completions/clisp.exp deleted file mode 100644 index dfbad4f3..00000000 --- a/test/lib/completions/clisp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "clisp " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/clone_member.exp b/test/lib/completions/clone_member.exp deleted file mode 100644 index d83d73bc..00000000 --- a/test/lib/completions/clone_member.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "clone_member -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/co.exp b/test/lib/completions/co.exp deleted file mode 100644 index 215268b6..00000000 --- a/test/lib/completions/co.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "co " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/compare.exp b/test/lib/completions/compare.exp deleted file mode 100644 index 006d70a1..00000000 --- a/test/lib/completions/compare.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "compare " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/complete.exp b/test/lib/completions/complete.exp deleted file mode 100644 index 9d898c51..00000000 --- a/test/lib/completions/complete.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "complete -" -sync_after_int - - -teardown diff --git a/test/lib/completions/composite.exp b/test/lib/completions/composite.exp deleted file mode 100644 index aba9af3b..00000000 --- a/test/lib/completions/composite.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "composite " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/config_list.exp b/test/lib/completions/config_list.exp deleted file mode 100644 index 27699239..00000000 --- a/test/lib/completions/config_list.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "config_list -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp deleted file mode 100644 index 1be8e167..00000000 --- a/test/lib/completions/configure.exp +++ /dev/null @@ -1,24 +0,0 @@ -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 --" -sync_after_int - -assert_complete_any "configure --prefix " -sync_after_int - - -teardown diff --git a/test/lib/completions/conjure.exp b/test/lib/completions/conjure.exp deleted file mode 100644 index 4f628af3..00000000 --- a/test/lib/completions/conjure.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "conjure " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp deleted file mode 100644 index b3a2e565..00000000 --- a/test/lib/completions/convert.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "convert " -sync_after_int - - -assert_complete_any "convert -format " -sync_after_int - - -teardown diff --git a/test/lib/completions/cowsay.exp b/test/lib/completions/cowsay.exp deleted file mode 100644 index 382f400f..00000000 --- a/test/lib/completions/cowsay.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cowsay " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cp.exp b/test/lib/completions/cp.exp deleted file mode 100644 index 703bf263..00000000 --- a/test/lib/completions/cp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cp " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cpan2dist.exp b/test/lib/completions/cpan2dist.exp deleted file mode 100644 index 1c7836ad..00000000 --- a/test/lib/completions/cpan2dist.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cpan2dist -" -sync_after_int - - -teardown diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/cpio.exp deleted file mode 100644 index 93f6f3c1..00000000 --- a/test/lib/completions/cpio.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cpio --" - - -sync_after_int - - -assert_complete [exec bash -c "compgen -A user"] "cpio -R " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cppcheck.exp b/test/lib/completions/cppcheck.exp deleted file mode 100644 index 80b6e7b6..00000000 --- a/test/lib/completions/cppcheck.exp +++ /dev/null @@ -1,42 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cppcheck " -sync_after_int - - -assert_complete_any "cppcheck -" -sync_after_int - - -assert_complete_any "cppcheck -DFOO=BAR " -sync_after_int - - -assert_no_complete "cppcheck -D " -sync_after_int - - -assert_complete "--enable=all" "cppcheck --enable=al" -sync_after_int - - -assert_complete "--enable=xx,style" "cppcheck --enable=xx,styl" -sync_after_int - - -assert_complete "--enable=xx,yy,style" "cppcheck --enable=xx,yy,styl" -sync_after_int - - -teardown diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp deleted file mode 100644 index 234817f9..00000000 --- a/test/lib/completions/createdb.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "createdb -" -sync_after_int - - -teardown diff --git a/test/lib/completions/createuser.exp b/test/lib/completions/createuser.exp deleted file mode 100644 index 87d4ac87..00000000 --- a/test/lib/completions/createuser.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "createuser -" -sync_after_int - - -teardown diff --git a/test/lib/completions/crontab.exp b/test/lib/completions/crontab.exp deleted file mode 100644 index 18e2269f..00000000 --- a/test/lib/completions/crontab.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "crontab " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cryptsetup.exp b/test/lib/completions/cryptsetup.exp deleted file mode 100644 index 4c20bc5d..00000000 --- a/test/lib/completions/cryptsetup.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cryptsetup " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/csplit.exp b/test/lib/completions/csplit.exp deleted file mode 100644 index 87b89dea..00000000 --- a/test/lib/completions/csplit.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "csplit " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp deleted file mode 100644 index e05c023e..00000000 --- a/test/lib/completions/curl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "curl --h" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cut.exp b/test/lib/completions/cut.exp deleted file mode 100644 index edb558ea..00000000 --- a/test/lib/completions/cut.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "cut " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp deleted file mode 100644 index 9248edc8..00000000 --- a/test/lib/completions/cvs.exp +++ /dev/null @@ -1,41 +0,0 @@ -proc setup {} { - save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs} -} - - -proc teardown {} { - assert_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDHOME=/d - /OLDPWD=/d - } -} - - -setup - - -assert_complete_any "cvs " - - -sync_after_int - - -set test "-d should complete CVS roots" -set cmd "cvs -d " -send "$cmd\t" -expect { - -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } - default { fail "$test" } -} - - -sync_after_int - - -assert_complete_dir "foo/bar" "cvs diff foo/" $::srcdir/fixtures/cvs -sync_after_int - - -teardown diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp deleted file mode 100644 index 6cf95ac1..00000000 --- a/test/lib/completions/cvsps.exp +++ /dev/null @@ -1,36 +0,0 @@ -proc setup {} { - save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs} -} - - -proc teardown {} { - assert_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDHOME=/d - } -} - - -setup - - -assert_complete_any "cvsps -" - - -sync_after_int - - -set test "No arguments should complete CVS roots" -set cmd "cvsps " -send "$cmd\t" -expect { - -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } - default { fail "$test" } -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/date.exp b/test/lib/completions/date.exp deleted file mode 100644 index ee970cf7..00000000 --- a/test/lib/completions/date.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "date " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp deleted file mode 100644 index dcff2802..00000000 --- a/test/lib/completions/dcop.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {dcop} words "" "untested"]} { - assert_complete $words "dcop " -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp deleted file mode 100644 index 4946e54d..00000000 --- a/test/lib/completions/dd.exp +++ /dev/null @@ -1,33 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dd --" - - -sync_after_int - - -set test "option should be suffixed with =" -set cmd "dd bs" -send "$cmd\t" -expect -ex "$cmd" -expect { - -re "^=$" { pass $test } - -re {^\\=$} { xfail $test } -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/declare.exp b/test/lib/completions/declare.exp deleted file mode 100644 index 8830b676..00000000 --- a/test/lib/completions/declare.exp +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index d46549cf..00000000 --- a/test/lib/completions/deja-dup.exp +++ /dev/null @@ -1,21 +0,0 @@ -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/desktop-file-validate.exp b/test/lib/completions/desktop-file-validate.exp deleted file mode 100644 index 40cbf82f..00000000 --- a/test/lib/completions/desktop-file-validate.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "desktop-file-validate " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/df.exp b/test/lib/completions/df.exp deleted file mode 100644 index acf212a9..00000000 --- a/test/lib/completions/df.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "df " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dfutool.exp b/test/lib/completions/dfutool.exp deleted file mode 100644 index 10e48544..00000000 --- a/test/lib/completions/dfutool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dfutool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dhclient.exp b/test/lib/completions/dhclient.exp deleted file mode 100644 index 6caff5fc..00000000 --- a/test/lib/completions/dhclient.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dhclient -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dict.exp b/test/lib/completions/dict.exp deleted file mode 100644 index 402e0c5c..00000000 --- a/test/lib/completions/dict.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dict -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/diff.exp b/test/lib/completions/diff.exp deleted file mode 100644 index 918bf7fd..00000000 --- a/test/lib/completions/diff.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "diff --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dir.exp b/test/lib/completions/dir.exp deleted file mode 100644 index c9f61cd5..00000000 --- a/test/lib/completions/dir.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dir " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp deleted file mode 100644 index 70cea182..00000000 --- a/test/lib/completions/display.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "display " - - -sync_after_int - - -assert_complete_any "display -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dmesg.exp b/test/lib/completions/dmesg.exp deleted file mode 100644 index 79f2e04a..00000000 --- a/test/lib/completions/dmesg.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dmesg -" -sync_after_int - - -teardown diff --git a/test/lib/completions/dnsspoof.exp b/test/lib/completions/dnsspoof.exp deleted file mode 100644 index 4aefb956..00000000 --- a/test/lib/completions/dnsspoof.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dnsspoof -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dot.exp b/test/lib/completions/dot.exp deleted file mode 100644 index 2a85a56b..00000000 --- a/test/lib/completions/dot.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dot " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dpkg-deb.exp b/test/lib/completions/dpkg-deb.exp deleted file mode 100644 index 37ece08d..00000000 --- a/test/lib/completions/dpkg-deb.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dpkg-deb --c" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dpkg-reconfigure.exp b/test/lib/completions/dpkg-reconfigure.exp deleted file mode 100644 index 0212666b..00000000 --- a/test/lib/completions/dpkg-reconfigure.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dpkg-reconfigure --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dpkg-source.exp b/test/lib/completions/dpkg-source.exp deleted file mode 100644 index a42759b9..00000000 --- a/test/lib/completions/dpkg-source.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dpkg-source -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp deleted file mode 100644 index b69f79fd..00000000 --- a/test/lib/completions/dpkg.exp +++ /dev/null @@ -1,29 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -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 "" "untested"]} { - assert_complete $packages "dpkg -L " -} -sync_after_int - - -assert_complete_homedir "dpkg -i" -sync_after_int - - -teardown diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp deleted file mode 100644 index d68cd48a..00000000 --- a/test/lib/completions/dropdb.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dropdb -" -sync_after_int - - -teardown diff --git a/test/lib/completions/dropuser.exp b/test/lib/completions/dropuser.exp deleted file mode 100644 index 8b36fa5e..00000000 --- a/test/lib/completions/dropuser.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dropuser " -sync_after_int - - -teardown diff --git a/test/lib/completions/dselect.exp b/test/lib/completions/dselect.exp deleted file mode 100644 index 634db05e..00000000 --- a/test/lib/completions/dselect.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dselect " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dsniff.exp b/test/lib/completions/dsniff.exp deleted file mode 100644 index cb8912b6..00000000 --- a/test/lib/completions/dsniff.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dsniff -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/du.exp b/test/lib/completions/du.exp deleted file mode 100644 index 6ddeb9b2..00000000 --- a/test/lib/completions/du.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "du " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dumpdb.exp b/test/lib/completions/dumpdb.exp deleted file mode 100644 index 5b617b11..00000000 --- a/test/lib/completions/dumpdb.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dumpdb " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/dumpe2fs.exp b/test/lib/completions/dumpe2fs.exp deleted file mode 100644 index e935c504..00000000 --- a/test/lib/completions/dumpe2fs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "dumpe2fs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/e2freefrag.exp b/test/lib/completions/e2freefrag.exp deleted file mode 100644 index 1530c9c9..00000000 --- a/test/lib/completions/e2freefrag.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "e2freefrag " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/e2label.exp b/test/lib/completions/e2label.exp deleted file mode 100644 index 8ae7f443..00000000 --- a/test/lib/completions/e2label.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "e2label " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ebtables.exp b/test/lib/completions/ebtables.exp deleted file mode 100644 index e8feea55..00000000 --- a/test/lib/completions/ebtables.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ebtables -" -sync_after_int - - -teardown diff --git a/test/lib/completions/eject.exp b/test/lib/completions/eject.exp deleted file mode 100644 index 8de109d4..00000000 --- a/test/lib/completions/eject.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "eject -" -sync_after_int - - -teardown diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp deleted file mode 100644 index c859b50f..00000000 --- a/test/lib/completions/enscript.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "enscript --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp deleted file mode 100644 index 4f213748..00000000 --- a/test/lib/completions/env.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {env --help} "" "" "unsupported"]} { - assert_complete_any "env --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/eog.exp b/test/lib/completions/eog.exp deleted file mode 100644 index b708c564..00000000 --- a/test/lib/completions/eog.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "eog " -sync_after_int - - -teardown diff --git a/test/lib/completions/ether-wake.exp b/test/lib/completions/ether-wake.exp deleted file mode 100644 index fe1aa174..00000000 --- a/test/lib/completions/ether-wake.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ether-wake " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp deleted file mode 100644 index 204467a1..00000000 --- a/test/lib/completions/evince.exp +++ /dev/null @@ -1,35 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -# NOTE: The directory `fixtures/evince' contains an additional subdir `foo' -# (should be visible as completion) and an additional file `.txt' -# (shouldn't be visible as completion) -set files { - foo/ - .bmp .BMP .cbr .CBR .cbz .CBZ .djv .DJV .djvu .DJVU - .dvi .DVI .dvi.bz2 .dvi.BZ2 .DVI.bz2 .DVI.BZ2 .dvi.gz .dvi.GZ .DVI.gz .DVI.GZ - .eps .EPS .eps.bz2 .eps.BZ2 .EPS.bz2 .EPS.BZ2 .eps.gz .eps.GZ .EPS.gz .EPS.GZ - .gif .GIF .ico .ICO .jpeg .JPEG .jpg .JPG .miff .MIFF .pbm .PBM .pcx .PCX - .pdf .PDF .pdf.bz2 .pdf.BZ2 .PDF.bz2 .PDF.BZ2 .pdf.gz .pdf.GZ .PDF.gz .PDF.GZ - .pgm .PGM .png .PNG .pnm .PNM .ppm .PPM - .ps .PS .ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ - .tga .TGA .tif .TIF .tiff .TIFF - .xpm .XPM .xwd .XWD -} -assert_complete_dir $files "evince " "$::srcdir/fixtures/evince" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp deleted file mode 100644 index 76b6eafa..00000000 --- a/test/lib/completions/expand.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {expand --help} "" "" "unsupported"]} { - assert_complete_any "expand --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/explodepkg.exp b/test/lib/completions/explodepkg.exp deleted file mode 100644 index e5ee35e4..00000000 --- a/test/lib/completions/explodepkg.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -set test "should complete *.t\[gbxl\]z files and dirs" -set dir $::srcdir/fixtures/slackware/home -set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ - \\( -type d -printf '%P/\\n' \\) -o \ - \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] -assert_complete_dir $files "explodepkg " $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/export.exp b/test/lib/completions/export.exp deleted file mode 100644 index 84cb9170..00000000 --- a/test/lib/completions/export.exp +++ /dev/null @@ -1,55 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /OLDPWD=/d - } -} - - -setup - - -assert_complete_any "export BASH" -sync_after_int - - -assert_complete_any "export -n BASH" -sync_after_int - - -assert_no_complete "export -p " -sync_after_int - - -assert_complete_dir {bar "bar bar.d/" foo foo.d/} "export FOO=" \ - fixtures/shared/default -sync_after_int - - -assert_complete_dir {foo foo.d/} "export FOO=f" fixtures/shared/default "" \ - -expect-cmd-minus f -sync_after_int - - -# Functions: _export, _expand, ... -assert_complete_any "export -fn _ex" -sync_after_int - - -assert_complete_any "export -f -n _ex" -sync_after_int - - -assert_complete_any "export FOO=\$BASH" -sync_after_int - - -assert_complete_any "export -" -sync_after_int - - -teardown diff --git a/test/lib/completions/faillog.exp b/test/lib/completions/faillog.exp deleted file mode 100644 index 9ccd1ad2..00000000 --- a/test/lib/completions/faillog.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "faillog -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/fbgs.exp b/test/lib/completions/fbgs.exp deleted file mode 100644 index 45fa22df..00000000 --- a/test/lib/completions/fbgs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "fbgs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/fbi.exp b/test/lib/completions/fbi.exp deleted file mode 100644 index 9c583062..00000000 --- a/test/lib/completions/fbi.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "fbi " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp deleted file mode 100644 index 28e90d99..00000000 --- a/test/lib/completions/feh.exp +++ /dev/null @@ -1,57 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "feh " - - -sync_after_int - - -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 - - -set test "-S pix<TAB> should complete \"pixels\"" -assert_complete "pixels" "feh -S pix" $test - - -sync_after_int - - -set test "--zoom ma<TAB> should complete \"max\"" -assert_complete "max" "feh --zoom ma" $test - - -sync_after_int - - -set test "-g 640<TAB> should complete digits plus \"x\"" -assert_complete "0 1 2 3 4 5 6 7 8 9 x" "feh -g 640" $test - - -sync_after_int - - -set test "-g 640x48<TAB> should complete digits" -assert_complete "0 1 2 3 4 5 6 7 8 9" "feh -g 640x48" $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/file-roller.exp b/test/lib/completions/file-roller.exp deleted file mode 100644 index 942941d0..00000000 --- a/test/lib/completions/file-roller.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "file-roller " -sync_after_int - - -teardown diff --git a/test/lib/completions/file.exp b/test/lib/completions/file.exp deleted file mode 100644 index 346960b6..00000000 --- a/test/lib/completions/file.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "file " -sync_after_int - -assert_complete_any "file -" -sync_after_int - - -teardown diff --git a/test/lib/completions/filefrag.exp b/test/lib/completions/filefrag.exp deleted file mode 100644 index fa80cd05..00000000 --- a/test/lib/completions/filefrag.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "filefrag " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/filesnarf.exp b/test/lib/completions/filesnarf.exp deleted file mode 100644 index 03755056..00000000 --- a/test/lib/completions/filesnarf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "filesnarf -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp deleted file mode 100644 index 96d55334..00000000 --- a/test/lib/completions/find.exp +++ /dev/null @@ -1,78 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "find " - - -sync_after_int - - -assert_complete_any "find -fstype " - - -sync_after_int - - -set options [list -daystart -depth -follow -help \ - -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \ - -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \ - -xdev \ - -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \ - -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \ - -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \ - -readable -regex -samefile -size -true -type -uid -used -user \ - -wholename -writable -xtype -context \ - -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \ - -print -print0 -printf -prune -quit] -assert_complete $options {find -} - - -sync_after_int - - -set test "-wholename should complete files/dirs" -set dir $::srcdir/fixtures/shared/default -set files [split [exec bash -c "cd $dir && ls -p"] "\n"] -assert_complete_dir $files "find -wholename " $dir $test - - -sync_after_int - - -set test "-uid should complete uids" -set cmd "find -uid " -send "$cmd\t" -expect { - -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-gid should complete gids" -set cmd "find -gid " -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/find_member.exp b/test/lib/completions/find_member.exp deleted file mode 100644 index 55672091..00000000 --- a/test/lib/completions/find_member.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "find_member -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index 5a3d3e9e..fa9f5b6b 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -11,15 +11,6 @@ proc teardown {} { setup -set test "Tab should complete usernames" -# Build string list of usernames -set users {} -foreach u [exec bash -c "compgen -A user -S @"] { - lappend users $u -} -assert_complete $users "finger " $test - - sync_after_int diff --git a/test/lib/completions/flake8.exp b/test/lib/completions/flake8.exp deleted file mode 100644 index 146ff04d..00000000 --- a/test/lib/completions/flake8.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "flake8 " -sync_after_int - -assert_complete_any "flake8 -" -sync_after_int - -assert_no_complete "flake8 --doesnt-exist=" -sync_after_int - - -teardown diff --git a/test/lib/completions/fmt.exp b/test/lib/completions/fmt.exp deleted file mode 100644 index 7d3cc17f..00000000 --- a/test/lib/completions/fmt.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {fmt --help} "" "" "unsupported"]} { - assert_complete_any "fmt -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp deleted file mode 100644 index f447f08b..00000000 --- a/test/lib/completions/fold.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {fold --help} "" "" "unsupported"]} { - assert_complete_any "fold --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/freebsd-update.exp b/test/lib/completions/freebsd-update.exp deleted file mode 100644 index 3657ebfd..00000000 --- a/test/lib/completions/freebsd-update.exp +++ /dev/null @@ -1,18 +0,0 @@ -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/freeciv-gtk2.exp b/test/lib/completions/freeciv-gtk2.exp deleted file mode 100644 index 1c0ec474..00000000 --- a/test/lib/completions/freeciv-gtk2.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "freeciv-gtk2 -" -sync_after_int - - -teardown diff --git a/test/lib/completions/freeciv-server.exp b/test/lib/completions/freeciv-server.exp deleted file mode 100644 index a9431848..00000000 --- a/test/lib/completions/freeciv-server.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "freeciv-server -" -sync_after_int - - -teardown diff --git a/test/lib/completions/freerdp.exp b/test/lib/completions/freerdp.exp deleted file mode 100644 index be61d459..00000000 --- a/test/lib/completions/freerdp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xfreerdp" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/function.exp b/test/lib/completions/function.exp deleted file mode 100644 index 823811f1..00000000 --- a/test/lib/completions/function.exp +++ /dev/null @@ -1,18 +0,0 @@ -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/fusermount.exp b/test/lib/completions/fusermount.exp deleted file mode 100644 index f6ac4f5d..00000000 --- a/test/lib/completions/fusermount.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "fusermount " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/g++.exp b/test/lib/completions/g++.exp deleted file mode 100644 index 4dbe73f4..00000000 --- a/test/lib/completions/g++.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "g++ " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/g4.exp b/test/lib/completions/g4.exp deleted file mode 100644 index 7d575f10..00000000 --- a/test/lib/completions/g4.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "g4 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/g77.exp b/test/lib/completions/g77.exp deleted file mode 100644 index e23745b7..00000000 --- a/test/lib/completions/g77.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "g77 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gcc.exp b/test/lib/completions/gcc.exp deleted file mode 100644 index 00097cc2..00000000 --- a/test/lib/completions/gcc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gcc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gcj.exp b/test/lib/completions/gcj.exp deleted file mode 100644 index cde07700..00000000 --- a/test/lib/completions/gcj.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gcj " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gcl.exp b/test/lib/completions/gcl.exp deleted file mode 100644 index 1846d0d1..00000000 --- a/test/lib/completions/gcl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gcl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gdb.exp b/test/lib/completions/gdb.exp deleted file mode 100644 index 2e389edb..00000000 --- a/test/lib/completions/gdb.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gdb - " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/genaliases.exp b/test/lib/completions/genaliases.exp deleted file mode 100644 index bb4d5e0e..00000000 --- a/test/lib/completions/genaliases.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "genaliases -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gendiff.exp b/test/lib/completions/gendiff.exp deleted file mode 100644 index cc1ebb68..00000000 --- a/test/lib/completions/gendiff.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gendiff " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/genisoimage.exp b/test/lib/completions/genisoimage.exp deleted file mode 100644 index 5379f047..00000000 --- a/test/lib/completions/genisoimage.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "genisoimage " -sync_after_int - - -teardown diff --git a/test/lib/completions/geoiplookup.exp b/test/lib/completions/geoiplookup.exp deleted file mode 100644 index 89166401..00000000 --- a/test/lib/completions/geoiplookup.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "geoiplookup -" -sync_after_int - - -teardown diff --git a/test/lib/completions/getconf.exp b/test/lib/completions/getconf.exp deleted file mode 100644 index a599fed1..00000000 --- a/test/lib/completions/getconf.exp +++ /dev/null @@ -1,30 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "getconf P" -sync_after_int - -assert_complete_any "getconf -" -sync_after_int - -assert_complete_any "getconf -a " -sync_after_int - -assert_complete_any "getconf -v " -sync_after_int - -assert_complete_any "getconf PATH_MAX " -sync_after_int - - -teardown diff --git a/test/lib/completions/getent.exp b/test/lib/completions/getent.exp deleted file mode 100644 index 6500b22d..00000000 --- a/test/lib/completions/getent.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "getent " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gkrellm.exp b/test/lib/completions/gkrellm.exp deleted file mode 100644 index 009770fc..00000000 --- a/test/lib/completions/gkrellm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gkrellm -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gm.exp b/test/lib/completions/gm.exp deleted file mode 100644 index 43f0bce2..00000000 --- a/test/lib/completions/gm.exp +++ /dev/null @@ -1,27 +0,0 @@ -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/gmplayer.exp b/test/lib/completions/gmplayer.exp deleted file mode 100644 index a110cb2f..00000000 --- a/test/lib/completions/gmplayer.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gmplayer " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gnatmake.exp b/test/lib/completions/gnatmake.exp deleted file mode 100644 index bad4da33..00000000 --- a/test/lib/completions/gnatmake.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gnatmake " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gnokii.exp b/test/lib/completions/gnokii.exp deleted file mode 100644 index 11bfeb6c..00000000 --- a/test/lib/completions/gnokii.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gnokii " -sync_after_int - - -teardown diff --git a/test/lib/completions/gnome-mplayer.exp b/test/lib/completions/gnome-mplayer.exp deleted file mode 100644 index fd635bff..00000000 --- a/test/lib/completions/gnome-mplayer.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gnome-mplayer " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gpasswd.exp b/test/lib/completions/gpasswd.exp deleted file mode 100644 index 68ac2cc3..00000000 --- a/test/lib/completions/gpasswd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gpasswd " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gpc.exp b/test/lib/completions/gpc.exp deleted file mode 100644 index 71eddacc..00000000 --- a/test/lib/completions/gpc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gpc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gperf.exp b/test/lib/completions/gperf.exp deleted file mode 100644 index 1cf77678..00000000 --- a/test/lib/completions/gperf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gperf --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gpg.exp b/test/lib/completions/gpg.exp deleted file mode 100644 index ea6805fa..00000000 --- a/test/lib/completions/gpg.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gpg " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gpg2.exp b/test/lib/completions/gpg2.exp deleted file mode 100644 index 3bc0e7a7..00000000 --- a/test/lib/completions/gpg2.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gpg2 --h" -sync_after_int - - -teardown diff --git a/test/lib/completions/gphoto2.exp b/test/lib/completions/gphoto2.exp deleted file mode 100644 index 90dc1e5e..00000000 --- a/test/lib/completions/gphoto2.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "gphoto2 --" -sync_after_int - - -teardown diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp deleted file mode 100644 index 996a1efd..00000000 --- a/test/lib/completions/gprof.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {gprof --help} "" "" "unsupported"]} { - assert_complete_any "gprof --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/grep.exp b/test/lib/completions/grep.exp deleted file mode 100644 index c94ae727..00000000 --- a/test/lib/completions/grep.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "grep --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/groupadd.exp b/test/lib/completions/groupadd.exp deleted file mode 100644 index c9a4f067..00000000 --- a/test/lib/completions/groupadd.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_no_complete "groupadd " -sync_after_int - -assert_complete_any "groupadd -" -sync_after_int - - -teardown diff --git a/test/lib/completions/groupdel.exp b/test/lib/completions/groupdel.exp deleted file mode 100644 index 07c77638..00000000 --- a/test/lib/completions/groupdel.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "groupdel " -sync_after_int - - -teardown diff --git a/test/lib/completions/groupmems.exp b/test/lib/completions/groupmems.exp deleted file mode 100644 index 41c4b43e..00000000 --- a/test/lib/completions/groupmems.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "groupmems -" -sync_after_int - - -teardown diff --git a/test/lib/completions/groupmod.exp b/test/lib/completions/groupmod.exp deleted file mode 100644 index 451456b3..00000000 --- a/test/lib/completions/groupmod.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "groupmod " -sync_after_int - -assert_complete_any "groupmod -" -sync_after_int - - -teardown diff --git a/test/lib/completions/growisofs.exp b/test/lib/completions/growisofs.exp deleted file mode 100644 index 0f2a0ec7..00000000 --- a/test/lib/completions/growisofs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "growisofs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/grpck.exp b/test/lib/completions/grpck.exp deleted file mode 100644 index 385ebe2b..00000000 --- a/test/lib/completions/grpck.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "grpck " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/grub.exp b/test/lib/completions/grub.exp deleted file mode 100644 index b88d1f26..00000000 --- a/test/lib/completions/grub.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "grub --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp deleted file mode 100644 index 95f774c6..00000000 --- a/test/lib/completions/gzip.exp +++ /dev/null @@ -1,32 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "Tab should complete" - # Try completion -set cmd "gzip " -send "$cmd\t" -expect { - -re "^$cmd\r\n.*$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -assert_complete_homedir "gzip" -sync_after_int - - -teardown diff --git a/test/lib/completions/hciattach.exp b/test/lib/completions/hciattach.exp deleted file mode 100644 index 35642f28..00000000 --- a/test/lib/completions/hciattach.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hciattach " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hciconfig.exp b/test/lib/completions/hciconfig.exp deleted file mode 100644 index 56444f4f..00000000 --- a/test/lib/completions/hciconfig.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hciconfig " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hcitool.exp b/test/lib/completions/hcitool.exp deleted file mode 100644 index e6ae0032..00000000 --- a/test/lib/completions/hcitool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hcitool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hddtemp.exp b/test/lib/completions/hddtemp.exp deleted file mode 100644 index a6721dbf..00000000 --- a/test/lib/completions/hddtemp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hddtemp -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp deleted file mode 100644 index 7edb8a1b..00000000 --- a/test/lib/completions/head.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {head --help} "" "" "unsupported"]} { - assert_complete_any "head --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hexdump.exp b/test/lib/completions/hexdump.exp deleted file mode 100644 index e3447482..00000000 --- a/test/lib/completions/hexdump.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hexdump -" -sync_after_int - - -teardown diff --git a/test/lib/completions/hid2hci.exp b/test/lib/completions/hid2hci.exp deleted file mode 100644 index c090c2c9..00000000 --- a/test/lib/completions/hid2hci.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hid2hci -" -sync_after_int - - -teardown diff --git a/test/lib/completions/host.exp b/test/lib/completions/host.exp deleted file mode 100644 index 73081821..00000000 --- a/test/lib/completions/host.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "host -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hostname.exp b/test/lib/completions/hostname.exp deleted file mode 100644 index 9d9e4963..00000000 --- a/test/lib/completions/hostname.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hostname -" -sync_after_int - - -teardown diff --git a/test/lib/completions/hping2.exp b/test/lib/completions/hping2.exp deleted file mode 100644 index 8919626d..00000000 --- a/test/lib/completions/hping2.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hping2 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/hping3.exp b/test/lib/completions/hping3.exp deleted file mode 100644 index 991ee3ad..00000000 --- a/test/lib/completions/hping3.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hping3 " -sync_after_int - - -teardown diff --git a/test/lib/completions/htop.exp b/test/lib/completions/htop.exp deleted file mode 100644 index d3e94d10..00000000 --- a/test/lib/completions/htop.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "htop -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/htpasswd.exp b/test/lib/completions/htpasswd.exp deleted file mode 100644 index bb66d2f0..00000000 --- a/test/lib/completions/htpasswd.exp +++ /dev/null @@ -1,32 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /OLDPWD=/d - } -} - - -setup - - -assert_complete_any "htpasswd " -sync_after_int - - -assert_no_complete "htpasswd -n $::srcdir/fixtures/htpasswd/ht" -sync_after_int - - -assert_complete_dir "htpasswd" "htpasswd " $::srcdir/fixtures/htpasswd -sync_after_int - - -assert_complete_dir "foo quux" "htpasswd -D htpasswd " $::srcdir/fixtures/htpasswd -sync_after_int - - -teardown diff --git a/test/lib/completions/hwclock.exp b/test/lib/completions/hwclock.exp deleted file mode 100644 index b12951a9..00000000 --- a/test/lib/completions/hwclock.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "hwclock -" -sync_after_int - - -teardown diff --git a/test/lib/completions/iconv.exp b/test/lib/completions/iconv.exp deleted file mode 100644 index dcce330f..00000000 --- a/test/lib/completions/iconv.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iconv -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/id.exp b/test/lib/completions/id.exp deleted file mode 100644 index b03ee721..00000000 --- a/test/lib/completions/id.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "id -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/identify.exp b/test/lib/completions/identify.exp deleted file mode 100644 index 3347c5cd..00000000 --- a/test/lib/completions/identify.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "identify -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/idn.exp b/test/lib/completions/idn.exp deleted file mode 100644 index 4625c7e4..00000000 --- a/test/lib/completions/idn.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "idn -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp deleted file mode 100644 index 7341ceb8..00000000 --- a/test/lib/completions/ifdown.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -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 - - -teardown diff --git a/test/lib/completions/iftop.exp b/test/lib/completions/iftop.exp deleted file mode 100644 index 12941610..00000000 --- a/test/lib/completions/iftop.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iftop " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp deleted file mode 100644 index 31b5ade4..00000000 --- a/test/lib/completions/ifup.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -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 - - -teardown diff --git a/test/lib/completions/import.exp b/test/lib/completions/import.exp deleted file mode 100644 index db6845ea..00000000 --- a/test/lib/completions/import.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "import " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp deleted file mode 100644 index 443a1305..00000000 --- a/test/lib/completions/info.exp +++ /dev/null @@ -1,23 +0,0 @@ -proc setup {} { - assert_bash_exec {OLDINFOPATH=$INFOPATH; INFOPATH=$INFOPATH:$TESTDIR/fixtures/info:} - save_env -} - - -proc teardown {} { - assert_env_unmodified - assert_bash_exec {INFOPATH="$OLDINFOPATH"; unset -v OLDINFOPATH} -} - - -setup - - -assert_complete_any "info bash" -sync_after_int - -assert_complete_any "info -" -sync_after_int - - -teardown diff --git a/test/lib/completions/inject.exp b/test/lib/completions/inject.exp deleted file mode 100644 index 4f95be23..00000000 --- a/test/lib/completions/inject.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "inject " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp deleted file mode 100644 index ca7c30f6..00000000 --- a/test/lib/completions/insmod.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "insmod " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/installpkg.exp b/test/lib/completions/installpkg.exp deleted file mode 100644 index 48581aa1..00000000 --- a/test/lib/completions/installpkg.exp +++ /dev/null @@ -1,49 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "installpkg -" - - -sync_after_int - - -set test "--<TAB> should complete all long options" -set options [list --warn --md5sum --root --infobox --terse --menu --ask \ - --priority --tagfile] -assert_complete $options "installpkg --" $test - - -sync_after_int - - -set test "--root should comlete only dirs" -set dirs [split [exec bash -c "find . -type d -mindepth 1 -maxdepth 1 \ - -printf '%P/\n'"] "\n"] -assert_complete $dirs "installpkg --root " $test - - -sync_after_int - - -set test "should complete *.t\[gbxl\]z files and dirs" -set dir $::srcdir/fixtures/slackware/home -set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ - \\( -type d -printf '%P/\\n' \\) -o \ - \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] -assert_complete_dir $files "installpkg " $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/interdiff.exp b/test/lib/completions/interdiff.exp deleted file mode 100644 index 8880f461..00000000 --- a/test/lib/completions/interdiff.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "interdiff " -sync_after_int - - -teardown diff --git a/test/lib/completions/invoke-rc.d.exp b/test/lib/completions/invoke-rc.d.exp deleted file mode 100644 index d217d17e..00000000 --- a/test/lib/completions/invoke-rc.d.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "invoke-rc.d " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ionice.exp b/test/lib/completions/ionice.exp deleted file mode 100644 index d0ff8b64..00000000 --- a/test/lib/completions/ionice.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ionice -" -sync_after_int - - -teardown diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp deleted file mode 100644 index f57712cb..00000000 --- a/test/lib/completions/ip.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ip " -sync_after_int - -assert_complete_any "ip a " -sync_after_int - - -teardown diff --git a/test/lib/completions/iperf.exp b/test/lib/completions/iperf.exp deleted file mode 100644 index 66a0ba3b..00000000 --- a/test/lib/completions/iperf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iperf " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ipmitool.exp b/test/lib/completions/ipmitool.exp deleted file mode 100644 index aa18e3ff..00000000 --- a/test/lib/completions/ipmitool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ipmitool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ipsec.exp b/test/lib/completions/ipsec.exp deleted file mode 100644 index 74ef638c..00000000 --- a/test/lib/completions/ipsec.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ipsec " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iptables.exp b/test/lib/completions/iptables.exp deleted file mode 100644 index 8ab42f56..00000000 --- a/test/lib/completions/iptables.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iptables -" -sync_after_int - - -teardown diff --git a/test/lib/completions/ipv6calc.exp b/test/lib/completions/ipv6calc.exp deleted file mode 100644 index 42201f0c..00000000 --- a/test/lib/completions/ipv6calc.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ipv6calc -" - - -sync_after_int - - -assert_complete_any "ipv6calc --in " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/irb.exp b/test/lib/completions/irb.exp deleted file mode 100644 index 720edfdf..00000000 --- a/test/lib/completions/irb.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "irb " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iscsiadm.exp b/test/lib/completions/iscsiadm.exp deleted file mode 100644 index 104e7c4e..00000000 --- a/test/lib/completions/iscsiadm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iscsiadm --mode " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/isql.exp b/test/lib/completions/isql.exp deleted file mode 100644 index ca40faca..00000000 --- a/test/lib/completions/isql.exp +++ /dev/null @@ -1,23 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/ODBCINI=/d} -} - - -setup - - -assert_bash_exec {OLDODBCINI=$ODBCINI; ODBCINI=$TESTDIR/fixtures/isql/odbc.ini} -assert_complete_any "isql " -sync_after_int -assert_bash_exec {ODBCINI=$OLDODBCINI; unset -v OLDODBCINI} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iwconfig.exp b/test/lib/completions/iwconfig.exp deleted file mode 100644 index 82ae11f3..00000000 --- a/test/lib/completions/iwconfig.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iwconfig --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iwlist.exp b/test/lib/completions/iwlist.exp deleted file mode 100644 index 43c919ef..00000000 --- a/test/lib/completions/iwlist.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iwlist --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iwpriv.exp b/test/lib/completions/iwpriv.exp deleted file mode 100644 index 86b1ee95..00000000 --- a/test/lib/completions/iwpriv.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "iwpriv --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/iwspy.exp b/test/lib/completions/iwspy.exp deleted file mode 100644 index 2894ca4e..00000000 --- a/test/lib/completions/iwspy.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_env_unmodified "iwspy --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/jar.exp b/test/lib/completions/jar.exp deleted file mode 100644 index d2cb476b..00000000 --- a/test/lib/completions/jar.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "jar " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/jarsigner.exp b/test/lib/completions/jarsigner.exp deleted file mode 100644 index 7ea7cb2e..00000000 --- a/test/lib/completions/jarsigner.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "jarsigner " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp deleted file mode 100644 index 62f6fd9d..00000000 --- a/test/lib/completions/java.exp +++ /dev/null @@ -1,53 +0,0 @@ -proc setup {} { - assert_bash_exec {CLASSPATH=$SRCDIR/fixtures/java/a:$SRCDIR/fixtures/java/bashcomp.jar} - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "java -" - - -sync_after_int - - -assert_complete "b bashcomp.jarred c. toplevel" "java " - - -sync_after_int - - -assert_complete "bashcomp.jarred toplevel" \ - "java -classpath $::srcdir/fixtures/java/bashcomp.jar " - - -sync_after_int - - -assert_complete "bashcomp.jarred d toplevel" \ - "java -cp $::srcdir/fixtures/java/bashcomp.jar:$::srcdir/fixtures/java/a/c " - - -sync_after_int - - -assert_no_complete "java -cp \"\" " - - -sync_after_int - - -assert_complete "a/ bashcomp.jar bashcomp.war" "java -jar $::srcdir/fixtures/java/" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp deleted file mode 100644 index 83b11d7f..00000000 --- a/test/lib/completions/javac.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "javac " -sync_after_int - -assert_complete "a/ bashcomp.jar" "javac -cp $::srcdir/fixtures/java/" -sync_after_int - - -teardown diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp deleted file mode 100644 index 79e86138..00000000 --- a/test/lib/completions/javadoc.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "javadoc " -sync_after_int - - -assert_complete {"bar bar.d/" foo.d/} "javadoc -linkoffline $::srcdir/fixtures/shared/default/" -sync_after_int - - -assert_complete {"bar bar.d/" foo.d/} "javadoc -nodeprecated -linkoffline foo $::srcdir/fixtures/shared/default/" -sync_after_int - - -teardown diff --git a/test/lib/completions/javaws.exp b/test/lib/completions/javaws.exp deleted file mode 100644 index cb29c65a..00000000 --- a/test/lib/completions/javaws.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "javaws " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/jpegoptim.exp b/test/lib/completions/jpegoptim.exp deleted file mode 100644 index 4b735e80..00000000 --- a/test/lib/completions/jpegoptim.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "jpegoptim " -sync_after_int - - -teardown diff --git a/test/lib/completions/jps.exp b/test/lib/completions/jps.exp deleted file mode 100644 index 62d5d710..00000000 --- a/test/lib/completions/jps.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "jps -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/jshint.exp b/test/lib/completions/jshint.exp deleted file mode 100644 index 553883e1..00000000 --- a/test/lib/completions/jshint.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "jshint " -sync_after_int - - -teardown diff --git a/test/lib/completions/k3b.exp b/test/lib/completions/k3b.exp deleted file mode 100644 index cde14b86..00000000 --- a/test/lib/completions/k3b.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "k3b " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/kcov.exp b/test/lib/completions/kcov.exp deleted file mode 100644 index c6c4a06d..00000000 --- a/test/lib/completions/kcov.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "kcov " -sync_after_int - -set test "--exclude-patter<TAB> should complete \"--exclude-pattern=\"" -assert_complete "--exclude-pattern=" "kcov --exclude-patter" $test -nospace -sync_after_int - -assert_complete_any "kcov -l 42," -sync_after_int - - -teardown diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp deleted file mode 100644 index fa993f5e..00000000 --- a/test/lib/completions/kdvi.exp +++ /dev/null @@ -1,27 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -# NOTE: The directory `fixtures/kdvi' contains an additional subdir `foo' -# (should be visible as completion) and an additional file `.txt' -# (shouldn't be visible as completion) -set files { - foo/ - .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z -} -assert_complete_dir $files "kdvi " "$::srcdir/fixtures/kdvi" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp deleted file mode 100644 index 9aeb8412..00000000 --- a/test/lib/completions/kill.exp +++ /dev/null @@ -1,30 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_bash_type ps]} { - assert_complete_any "kill 1" - sync_after_int -} - - -assert_complete [get_signals] "kill -s " -sync_after_int - - -set expected [get_signals -] -lappend expected "-l" "-s" -assert_complete [lsort -unique $expected] "kill -" -sync_after_int - - -teardown diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp deleted file mode 100644 index a55ac591..00000000 --- a/test/lib/completions/killall.exp +++ /dev/null @@ -1,23 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# "p": Assume that our process name completion runs ps -assert_complete_any "killall p" -sync_after_int - - -assert_complete [get_signals] "killall --signal " -sync_after_int - - -teardown diff --git a/test/lib/completions/kldload.exp b/test/lib/completions/kldload.exp deleted file mode 100644 index a1d87c97..00000000 --- a/test/lib/completions/kldload.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "kldload " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/kldunload.exp b/test/lib/completions/kldunload.exp deleted file mode 100644 index 476c5104..00000000 --- a/test/lib/completions/kldunload.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[catch {eval exec {kldstat | grep "\.ko$"}}] == 0} { - assert_complete_any "kldunload " -} else { - assert_no_complete "kldunload " -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/koji.exp b/test/lib/completions/koji.exp deleted file mode 100644 index a9673807..00000000 --- a/test/lib/completions/koji.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "koji " -sync_after_int - - -assert_complete_any "koji -" -sync_after_int - - -teardown diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp deleted file mode 100644 index 6f0feb68..00000000 --- a/test/lib/completions/kpdf.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -# NOTE: The directory `fixtures/kpdf' contains an additional subdir `foo' -# (should be visible as completion) and an additional file `.txt' -# (shouldn't be visible as completion) -set files { - foo/ .eps .ps .EPS .PS .pdf .PDF -} -assert_complete_dir $files "kpdf " "$::srcdir/fixtures/kpdf" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/kplayer.exp b/test/lib/completions/kplayer.exp deleted file mode 100644 index 4fdfa672..00000000 --- a/test/lib/completions/kplayer.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "kplayer " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ktutil.exp b/test/lib/completions/ktutil.exp deleted file mode 100644 index 709a0850..00000000 --- a/test/lib/completions/ktutil.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ktutil " -sync_after_int - -assert_complete_any "ktutil -" -sync_after_int - - -teardown diff --git a/test/lib/completions/l2ping.exp b/test/lib/completions/l2ping.exp deleted file mode 100644 index de8c58c1..00000000 --- a/test/lib/completions/l2ping.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "l2ping -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/larch.exp b/test/lib/completions/larch.exp deleted file mode 100644 index cefcbe02..00000000 --- a/test/lib/completions/larch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "larch library-" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lastlog.exp b/test/lib/completions/lastlog.exp deleted file mode 100644 index 74d75553..00000000 --- a/test/lib/completions/lastlog.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lastlog -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ld.exp b/test/lib/completions/ld.exp deleted file mode 100644 index ee660fcb..00000000 --- a/test/lib/completions/ld.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ld " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapadd.exp b/test/lib/completions/ldapadd.exp deleted file mode 100644 index bc066ab6..00000000 --- a/test/lib/completions/ldapadd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapadd -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapcompare.exp b/test/lib/completions/ldapcompare.exp deleted file mode 100644 index c693f703..00000000 --- a/test/lib/completions/ldapcompare.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapcompare -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapdelete.exp b/test/lib/completions/ldapdelete.exp deleted file mode 100644 index cc20d0e7..00000000 --- a/test/lib/completions/ldapdelete.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapdelete -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapmodrdn.exp b/test/lib/completions/ldapmodrdn.exp deleted file mode 100644 index 3ae6c399..00000000 --- a/test/lib/completions/ldapmodrdn.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapmodrdn -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldappasswd.exp b/test/lib/completions/ldappasswd.exp deleted file mode 100644 index 2dd49393..00000000 --- a/test/lib/completions/ldappasswd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldappasswd -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapsearch.exp b/test/lib/completions/ldapsearch.exp deleted file mode 100644 index 92394ecd..00000000 --- a/test/lib/completions/ldapsearch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapsearch -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapvi.exp b/test/lib/completions/ldapvi.exp deleted file mode 100644 index 54c62772..00000000 --- a/test/lib/completions/ldapvi.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapvi -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldapwhoami.exp b/test/lib/completions/ldapwhoami.exp deleted file mode 100644 index 7be41740..00000000 --- a/test/lib/completions/ldapwhoami.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldapwhoami -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ldd.exp b/test/lib/completions/ldd.exp deleted file mode 100644 index 1c3239c7..00000000 --- a/test/lib/completions/ldd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ldd " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/less.exp b/test/lib/completions/less.exp deleted file mode 100644 index 78d6ef14..00000000 --- a/test/lib/completions/less.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "less --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lftp.exp b/test/lib/completions/lftp.exp deleted file mode 100644 index bb219650..00000000 --- a/test/lib/completions/lftp.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - assert_bash_exec {HOME=$SRCDIR/fixtures/lftp} - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set expected [get_hosts] -# `lftptest' is defined in ./fixtures/lftp/.lftp/bookmarks -lappend expected lftptest -assert_complete $expected "lftp " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lftpget.exp b/test/lib/completions/lftpget.exp deleted file mode 100644 index 0eadb6e9..00000000 --- a/test/lib/completions/lftpget.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lftpget -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lilo.exp b/test/lib/completions/lilo.exp deleted file mode 100644 index 36ea2c66..00000000 --- a/test/lib/completions/lilo.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lilo -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/links.exp b/test/lib/completions/links.exp deleted file mode 100644 index 4124e2f4..00000000 --- a/test/lib/completions/links.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "links " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lintian-info.exp b/test/lib/completions/lintian-info.exp deleted file mode 100644 index 5bde97fd..00000000 --- a/test/lib/completions/lintian-info.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lintian-info " -sync_after_int - -assert_complete_any "lintian-info --" -sync_after_int - - -teardown diff --git a/test/lib/completions/lintian.exp b/test/lib/completions/lintian.exp deleted file mode 100644 index 5b1e695c..00000000 --- a/test/lib/completions/lintian.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lintian --" -sync_after_int - - -teardown diff --git a/test/lib/completions/lisp.exp b/test/lib/completions/lisp.exp deleted file mode 100644 index 5131b45d..00000000 --- a/test/lib/completions/lisp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lisp " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/list_admins.exp b/test/lib/completions/list_admins.exp deleted file mode 100644 index 3b412136..00000000 --- a/test/lib/completions/list_admins.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "list_admins -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/list_lists.exp b/test/lib/completions/list_lists.exp deleted file mode 100644 index a62dca25..00000000 --- a/test/lib/completions/list_lists.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "list_lists -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/list_members.exp b/test/lib/completions/list_members.exp deleted file mode 100644 index 8c74cdfb..00000000 --- a/test/lib/completions/list_members.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "list_members -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/list_owners.exp b/test/lib/completions/list_owners.exp deleted file mode 100644 index 65e3ba8e..00000000 --- a/test/lib/completions/list_owners.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "list_owners -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ln.exp b/test/lib/completions/ln.exp deleted file mode 100644 index 61405020..00000000 --- a/test/lib/completions/ln.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ln " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp deleted file mode 100644 index af9a71a8..00000000 --- a/test/lib/completions/look.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {look foo | grep ^foo} words {} "unsupported"]} { - assert_complete $words "look foo" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lpq.exp b/test/lib/completions/lpq.exp deleted file mode 100644 index 41fdb216..00000000 --- a/test/lib/completions/lpq.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lpq " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lpr.exp b/test/lib/completions/lpr.exp deleted file mode 100644 index 1ec46844..00000000 --- a/test/lib/completions/lpr.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lpr " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lrzip.exp b/test/lib/completions/lrzip.exp deleted file mode 100644 index 2c4218ec..00000000 --- a/test/lib/completions/lrzip.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lrzip " - - -sync_after_int - - -assert_complete_homedir "lrzip" -sync_after_int - - -teardown diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp deleted file mode 100644 index 24fc46f8..00000000 --- a/test/lib/completions/ls.exp +++ /dev/null @@ -1,36 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {ls --help} "" "" "unsupported"]} { - assert_complete_any "ls --" -} -sync_after_int - - -assert_complete_homedir "ls" -sync_after_int - - -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 -if {![find_unique_completion_pair $users part full]} { - untested "Not running, no suitable test user found: $test" -} else { - assert_complete "~$full " "ls ~$part" $test -nospace -} -sync_after_int - - -teardown diff --git a/test/lib/completions/lsof.exp b/test/lib/completions/lsof.exp deleted file mode 100644 index 551bde2a..00000000 --- a/test/lib/completions/lsof.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lsof " -sync_after_int - -assert_complete_any "lsof -" -sync_after_int - - -teardown diff --git a/test/lib/completions/lspci.exp b/test/lib/completions/lspci.exp deleted file mode 100644 index ea9e859f..00000000 --- a/test/lib/completions/lspci.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lspci -" -sync_after_int - -assert_complete_any "lspci -A " -sync_after_int - - -teardown diff --git a/test/lib/completions/lsscsi.exp b/test/lib/completions/lsscsi.exp deleted file mode 100644 index 66603142..00000000 --- a/test/lib/completions/lsscsi.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_no_complete "lsscsi " -sync_after_int - -assert_complete_any "lsscsi -" -sync_after_int - - -teardown diff --git a/test/lib/completions/lsusb.exp b/test/lib/completions/lsusb.exp deleted file mode 100644 index dddb6352..00000000 --- a/test/lib/completions/lsusb.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lsusb -" -sync_after_int - - -teardown diff --git a/test/lib/completions/lua.exp b/test/lib/completions/lua.exp deleted file mode 100644 index 864b1bfc..00000000 --- a/test/lib/completions/lua.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lua " -sync_after_int - - -teardown diff --git a/test/lib/completions/luac.exp b/test/lib/completions/luac.exp deleted file mode 100644 index d7cfb23b..00000000 --- a/test/lib/completions/luac.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "luac " -sync_after_int - - -teardown diff --git a/test/lib/completions/luseradd.exp b/test/lib/completions/luseradd.exp deleted file mode 100644 index 744314a7..00000000 --- a/test/lib/completions/luseradd.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "luseradd -" -sync_after_int - - -teardown diff --git a/test/lib/completions/luserdel.exp b/test/lib/completions/luserdel.exp deleted file mode 100644 index 70d11661..00000000 --- a/test/lib/completions/luserdel.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "luserdel " -sync_after_int - - -teardown diff --git a/test/lib/completions/lusermod.exp b/test/lib/completions/lusermod.exp deleted file mode 100644 index f96293e6..00000000 --- a/test/lib/completions/lusermod.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lusermod " -sync_after_int - - -teardown diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp deleted file mode 100644 index 2240e5eb..00000000 --- a/test/lib/completions/lvchange.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvchange --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvchange --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp deleted file mode 100644 index 678ac1be..00000000 --- a/test/lib/completions/lvcreate.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvcreate --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvcreate --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp deleted file mode 100644 index 5e8c3210..00000000 --- a/test/lib/completions/lvdisplay.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvdisplay --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvdisplay --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp deleted file mode 100644 index 7c0e329e..00000000 --- a/test/lib/completions/lvextend.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvextend --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvextend --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvm.exp b/test/lib/completions/lvm.exp deleted file mode 100644 index 91fe0dcd..00000000 --- a/test/lib/completions/lvm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lvm pv" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp deleted file mode 100644 index 30c73c5c..00000000 --- a/test/lib/completions/lvmdiskscan.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvmdiskscan --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvmdiskscan --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp deleted file mode 100644 index b9904fef..00000000 --- a/test/lib/completions/lvreduce.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvreduce --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvreduce --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp deleted file mode 100644 index 0f41d8dc..00000000 --- a/test/lib/completions/lvremove.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvremove --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvremove --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp deleted file mode 100644 index 77d6c5e0..00000000 --- a/test/lib/completions/lvrename.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvrename --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvrename --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp deleted file mode 100644 index a0e8f99e..00000000 --- a/test/lib/completions/lvresize.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvresize --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvresize --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp deleted file mode 100644 index c46a8153..00000000 --- a/test/lib/completions/lvs.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvs --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvs --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp deleted file mode 100644 index 60effb5d..00000000 --- a/test/lib/completions/lvscan.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {lvscan --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "lvscan --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lz4.exp b/test/lib/completions/lz4.exp deleted file mode 100644 index dc41f919..00000000 --- a/test/lib/completions/lz4.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lz4 " -sync_after_int - -assert_complete_homedir "lz4" -sync_after_int - - -teardown diff --git a/test/lib/completions/lzip.exp b/test/lib/completions/lzip.exp deleted file mode 100644 index fd92af62..00000000 --- a/test/lib/completions/lzip.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lzip " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp deleted file mode 100644 index 16b45d0b..00000000 --- a/test/lib/completions/lzma.exp +++ /dev/null @@ -1,30 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lzma " - - -sync_after_int - - -assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d $::srcdir/fixtures/xz/" - - -sync_after_int - - -assert_complete_homedir "lzma" -sync_after_int - - -teardown diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp deleted file mode 100644 index 3084fd3e..00000000 --- a/test/lib/completions/lzop.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "lzop " - - -sync_after_int - - -assert_complete_homedir "lzop" -sync_after_int - - -teardown diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp deleted file mode 100644 index 334132db..00000000 --- a/test/lib/completions/m4.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {m4 --help} "" "" "unsupported"]} { - assert_complete_any "m4 --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/macof.exp b/test/lib/completions/macof.exp deleted file mode 100644 index 873ae1da..00000000 --- a/test/lib/completions/macof.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "macof -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mailmanctl.exp b/test/lib/completions/mailmanctl.exp deleted file mode 100644 index 2924806a..00000000 --- a/test/lib/completions/mailmanctl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mailmanctl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mailsnarf.exp b/test/lib/completions/mailsnarf.exp deleted file mode 100644 index 9fb937f3..00000000 --- a/test/lib/completions/mailsnarf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mailsnarf -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp deleted file mode 100644 index 0c188dba..00000000 --- a/test/lib/completions/make.exp +++ /dev/null @@ -1,77 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -set test "-f Ma<TAB> should complete \"Makefile\"" -set dir $::srcdir/fixtures/make -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 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/shared/empty_dir -assert_complete_dir "" "make " $dir $test - - -sync_after_int - - -assert_complete_any "make -j " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/makepkg.exp b/test/lib/completions/makepkg.exp deleted file mode 100644 index 56e06339..00000000 --- a/test/lib/completions/makepkg.exp +++ /dev/null @@ -1,28 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "makepkg -" - - -sync_after_int - - -set test "--<TAB> should complete all long options" -set options [list --linkadd --prepend --chown] -assert_complete $options "makepkg --" $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp deleted file mode 100644 index d601c434..00000000 --- a/test/lib/completions/man.exp +++ /dev/null @@ -1,76 +0,0 @@ -proc setup {} { - 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 - /OLDMANPATH/d - } - - if {! [is_cygwin]} { - assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)} - } -} - - -setup - - -# Something we assume a system installed man page present for -set assumed_present "man" - -assert_complete "bash-completion-testcase" "man bash-completion-testcas" -sync_after_int - -assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man -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 -sync_after_int - -set desc "man $assumed_present with MANPATH having no leading/trailing colon" -assert_no_complete "man $assumed_present" "$desc should not complete" -sync_after_int - -# Trailing colon in MANPATH: append system default search path -assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=\$MANPATH:" -set desc "with trailing colon in MANPATH" - -set cmd "man $assumed_present" -assert_complete_any "$cmd" "$cmd $desc should complete" -sync_after_int - -set cmd "man bash-completion-testcas" -assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete" -sync_after_int - -assert_bash_exec "MANPATH=\$OLDMANPATH" - -# Leading colon in MANPATH: prepend system default search path -assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=:\$MANPATH" -set desc "with leading colon in MANPATH" - -set cmd "man $assumed_present" -assert_complete_any "$cmd" "$cmd $desc should complete" -sync_after_int - -set cmd "man bash-completion-testcas" -assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete" -sync_after_int - -assert_bash_exec "MANPATH=\$OLDMANPATH" - - -teardown diff --git a/test/lib/completions/mc.exp b/test/lib/completions/mc.exp deleted file mode 100644 index eb97246d..00000000 --- a/test/lib/completions/mc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mc -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp deleted file mode 100644 index e194446b..00000000 --- a/test/lib/completions/mcrypt.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mcrypt " -sync_after_int - -assert_complete_any "mcrypt -a " -sync_after_int - -assert_complete_any "mcrypt -m " -sync_after_int - - -teardown diff --git a/test/lib/completions/md5sum.exp b/test/lib/completions/md5sum.exp deleted file mode 100644 index 54ed6416..00000000 --- a/test/lib/completions/md5sum.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "md5sum " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mdadm.exp b/test/lib/completions/mdadm.exp deleted file mode 100644 index 6559aa20..00000000 --- a/test/lib/completions/mdadm.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mdadm " -sync_after_int - - -teardown diff --git a/test/lib/completions/mdecrypt.exp b/test/lib/completions/mdecrypt.exp deleted file mode 100644 index 8d9d9f59..00000000 --- a/test/lib/completions/mdecrypt.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mdecrypt " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mdtool.exp b/test/lib/completions/mdtool.exp deleted file mode 100644 index 076cb17a..00000000 --- a/test/lib/completions/mdtool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mdtool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/medusa.exp b/test/lib/completions/medusa.exp deleted file mode 100644 index 6ad2fdc3..00000000 --- a/test/lib/completions/medusa.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "medusa -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp deleted file mode 100644 index cb0ba7c5..00000000 --- a/test/lib/completions/mencoder.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/mplayer} -} - - -proc teardown {} { - assert_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDHOME=/d - } -} - - -setup - - -assert_complete_any "mencoder " -sync_after_int - -assert_complete_any "mencoder -v" -sync_after_int - - -teardown diff --git a/test/lib/completions/mii-diag.exp b/test/lib/completions/mii-diag.exp deleted file mode 100644 index 952ff632..00000000 --- a/test/lib/completions/mii-diag.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mii-diag " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mii-tool.exp b/test/lib/completions/mii-tool.exp deleted file mode 100644 index 03827edd..00000000 --- a/test/lib/completions/mii-tool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mii-tool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/minicom.exp b/test/lib/completions/minicom.exp deleted file mode 100644 index dfc96c01..00000000 --- a/test/lib/completions/minicom.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "minicom -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp deleted file mode 100644 index 049212f0..00000000 --- a/test/lib/completions/mkdir.exp +++ /dev/null @@ -1,33 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mkdir " - - -sync_after_int - - -assert_complete {bar "bar bar.d/" foo foo.d/} "mkdir $::srcdir/fixtures/shared/default/" - - -sync_after_int - - -set test "mkdir should complete files with nospace" -assert_complete {foo} "mkdir $::srcdir/fixtures/shared/default/foo.d/" $test -nospace - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mkfifo.exp b/test/lib/completions/mkfifo.exp deleted file mode 100644 index 59412a2e..00000000 --- a/test/lib/completions/mkfifo.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mkfifo " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mkinitrd.exp b/test/lib/completions/mkinitrd.exp deleted file mode 100644 index 007f278d..00000000 --- a/test/lib/completions/mkinitrd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mkinitrd " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mkisofs.exp b/test/lib/completions/mkisofs.exp deleted file mode 100644 index 98780b1e..00000000 --- a/test/lib/completions/mkisofs.exp +++ /dev/null @@ -1,48 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mkisofs " - - -sync_after_int - - -set test "-uid should complete uids" - # Try completion -set cmd "mkisofs -uid " -send "$cmd\t" -expect { - -re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-gid should complete gids" - # Try completion -set cmd "mkisofs -gid " -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/mknod.exp b/test/lib/completions/mknod.exp deleted file mode 100644 index 145f4531..00000000 --- a/test/lib/completions/mknod.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mknod " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mktemp.exp b/test/lib/completions/mktemp.exp deleted file mode 100644 index 8b0a3be2..00000000 --- a/test/lib/completions/mktemp.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mktemp -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp deleted file mode 100644 index 70d2a126..00000000 --- a/test/lib/completions/mmsitepass.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mmsitepass -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mock.exp b/test/lib/completions/mock.exp deleted file mode 100644 index 8190264a..00000000 --- a/test/lib/completions/mock.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 90e9702a..00000000 --- a/test/lib/completions/modinfo.exp +++ /dev/null @@ -1,38 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -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 - - -set test "should not complete anything for non-existent kernel" -assert_no_complete "modinfo -k you-dont-have-such-kernel in" $test - - -sync_after_int - - -set test "should complete filepaths" -assert_complete "/tmp/" "modinfo /tm" $test -nospace - - -sync_after_int - - -teardown diff --git a/test/lib/completions/modprobe.exp b/test/lib/completions/modprobe.exp deleted file mode 100644 index b0a530ef..00000000 --- a/test/lib/completions/modprobe.exp +++ /dev/null @@ -1,52 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "--al<TAB> should complete \"--all\"" -assert_complete "--all" "modprobe --al" $test - - -sync_after_int - - -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 - - -set test "should not complete anything for non-existent kernel" -assert_no_complete "modprobe -S you-dont-have-such-kernel in" $test - - -sync_after_int - - -set test "should not complete anything for non-existent module" -assert_no_complete "modprobe you-dont-have-such-module " $test - - -sync_after_int - - -set test "should complete filepaths" -assert_complete "/tmp/" "modprobe /tm" $test -nospace - - -sync_after_int - - -teardown diff --git a/test/lib/completions/module.exp b/test/lib/completions/module.exp deleted file mode 100644 index 5e36a6da..00000000 --- a/test/lib/completions/module.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "module " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mogrify.exp b/test/lib/completions/mogrify.exp deleted file mode 100644 index 84ceeff5..00000000 --- a/test/lib/completions/mogrify.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mogrify " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/monodevelop.exp b/test/lib/completions/monodevelop.exp deleted file mode 100644 index 0bfe788e..00000000 --- a/test/lib/completions/monodevelop.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "monodevelop " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/montage.exp b/test/lib/completions/montage.exp deleted file mode 100644 index 4d85e1a4..00000000 --- a/test/lib/completions/montage.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "montage " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp deleted file mode 100644 index fea99b85..00000000 --- a/test/lib/completions/mount.exp +++ /dev/null @@ -1,46 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD/d} -} - - -setup - - -assert_complete_any "mount " - - -sync_after_int - - -assert_complete_any "mount -t " - - -sync_after_int - - -set test "mount /dev/sda1 def should complete directory name" -assert_complete_dir "default/" "mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace - - -sync_after_int - - -set test "Check completing nfs mounts" -set expected [list /test/path /test/path2 /second/path] -set cmd "mount mocksrv:/" -assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIRABS/fixtures/mount/bin:$PATH";} -# This needs an explicit cword param or will output "unresolved". -assert_complete $expected $cmd $test -expect-cmd-minus / -sync_after_int -assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp deleted file mode 100644 index 8c9de756..00000000 --- a/test/lib/completions/mplayer.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/mplayer} -} - - -proc teardown {} { - assert_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDHOME=/d - } -} - - -setup - - -assert_complete_any "mplayer " -sync_after_int - -assert_complete_any "mplayer -h" -sync_after_int - - -teardown diff --git a/test/lib/completions/mr.exp b/test/lib/completions/mr.exp deleted file mode 100644 index d7d41bb6..00000000 --- a/test/lib/completions/mr.exp +++ /dev/null @@ -1,46 +0,0 @@ -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/msgsnarf.exp b/test/lib/completions/msgsnarf.exp deleted file mode 100644 index c542e33e..00000000 --- a/test/lib/completions/msgsnarf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "msgsnarf -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/msynctool.exp b/test/lib/completions/msynctool.exp deleted file mode 100644 index cb238d9f..00000000 --- a/test/lib/completions/msynctool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "msynctool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mtx.exp b/test/lib/completions/mtx.exp deleted file mode 100644 index 1de15269..00000000 --- a/test/lib/completions/mtx.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mtx " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/munin-node-configure.exp b/test/lib/completions/munin-node-configure.exp deleted file mode 100644 index 2e17f3eb..00000000 --- a/test/lib/completions/munin-node-configure.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "munin-node-configure --libdir " -sync_after_int - - -teardown diff --git a/test/lib/completions/munin-run.exp b/test/lib/completions/munin-run.exp deleted file mode 100644 index 25a639bc..00000000 --- a/test/lib/completions/munin-run.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "munin-run -" -sync_after_int - - -teardown diff --git a/test/lib/completions/munindoc.exp b/test/lib/completions/munindoc.exp deleted file mode 100644 index 62a4307c..00000000 --- a/test/lib/completions/munindoc.exp +++ /dev/null @@ -1,19 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# Assume at least munin* available -assert_complete_any "munindoc m" -sync_after_int - - -teardown diff --git a/test/lib/completions/mussh.exp b/test/lib/completions/mussh.exp deleted file mode 100644 index 24c5c1f1..00000000 --- a/test/lib/completions/mussh.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mussh -" -sync_after_int - - -teardown diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp deleted file mode 100644 index 1f4425e2..00000000 --- a/test/lib/completions/mutt.exp +++ /dev/null @@ -1,43 +0,0 @@ -proc setup {} { - save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIRABS/fixtures/mutt} -} - - -proc teardown {} { - assert_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDPWD=/d - /OLDHOME=/d - } -} - - -setup - - -assert_complete_any "mutt -" - - -sync_after_int - - -set test "mutt should complete mailboxes" -set expected {foo/ bar/ muttrc} -assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt $test - - -set test "mutt should complete aliases" -set expected {a1 a2} -assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt $test - - -sync_after_int - - -set expected "$::srcdirabs/fixtures/mutt/muttrc $::srcdirabs/fixtures/mutt/bar/muttrc_b $::srcdirabs/fixtures/mutt/foo/muttrc_f" -assert_bash_list $expected { _muttconffiles "$HOME/muttrc" "$HOME/muttrc" } "find muttrcs recursively" -sync_after_int - - -teardown diff --git a/test/lib/completions/muttng.exp b/test/lib/completions/muttng.exp deleted file mode 100644 index 32239128..00000000 --- a/test/lib/completions/muttng.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "muttng -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mv.exp b/test/lib/completions/mv.exp deleted file mode 100644 index d65c4868..00000000 --- a/test/lib/completions/mv.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mv " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp deleted file mode 100644 index b7a50b81..00000000 --- a/test/lib/completions/mysql.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mysql --" -sync_after_int - - -assert_complete_any "mysql --default-character-set=" -sync_after_int - - -teardown diff --git a/test/lib/completions/mysqladmin.exp b/test/lib/completions/mysqladmin.exp deleted file mode 100644 index ae9b8ce8..00000000 --- a/test/lib/completions/mysqladmin.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "mysqladmin -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/nc.exp b/test/lib/completions/nc.exp deleted file mode 100644 index 84e61896..00000000 --- a/test/lib/completions/nc.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nc -" -sync_after_int - - -teardown diff --git a/test/lib/completions/ncftp.exp b/test/lib/completions/ncftp.exp deleted file mode 100644 index d6683b86..00000000 --- a/test/lib/completions/ncftp.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ncftp " -sync_after_int - - -assert_complete_any "ncftp -" -sync_after_int - - -teardown diff --git a/test/lib/completions/nethogs.exp b/test/lib/completions/nethogs.exp deleted file mode 100644 index d6234070..00000000 --- a/test/lib/completions/nethogs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nethogs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/netstat.exp b/test/lib/completions/netstat.exp deleted file mode 100644 index e4ef676c..00000000 --- a/test/lib/completions/netstat.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "netstat " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/newgrp.exp b/test/lib/completions/newgrp.exp deleted file mode 100644 index a5cddb8c..00000000 --- a/test/lib/completions/newgrp.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index dfabdc50..00000000 --- a/test/lib/completions/newlist.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "newlist -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/newusers.exp b/test/lib/completions/newusers.exp deleted file mode 100644 index a1928120..00000000 --- a/test/lib/completions/newusers.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "newusers " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ngrep.exp b/test/lib/completions/ngrep.exp deleted file mode 100644 index a49543bb..00000000 --- a/test/lib/completions/ngrep.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ngrep -" -sync_after_int - -assert_complete_any "ngrep -d " -sync_after_int - - -teardown diff --git a/test/lib/completions/nl.exp b/test/lib/completions/nl.exp deleted file mode 100644 index b7255ac2..00000000 --- a/test/lib/completions/nl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nl " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/nm.exp b/test/lib/completions/nm.exp deleted file mode 100644 index 9ce73d45..00000000 --- a/test/lib/completions/nm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nm " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/nmap.exp b/test/lib/completions/nmap.exp deleted file mode 100644 index 02aab991..00000000 --- a/test/lib/completions/nmap.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nmap --v" -sync_after_int - - -teardown diff --git a/test/lib/completions/nmcli.exp b/test/lib/completions/nmcli.exp deleted file mode 100644 index b891f45e..00000000 --- a/test/lib/completions/nmcli.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nmcli " -sync_after_int - - -teardown diff --git a/test/lib/completions/nproc.exp b/test/lib/completions/nproc.exp deleted file mode 100644 index d6df0472..00000000 --- a/test/lib/completions/nproc.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_no_complete "nproc " -sync_after_int - -assert_complete_any "nproc -" -sync_after_int - - -teardown diff --git a/test/lib/completions/nslookup.exp b/test/lib/completions/nslookup.exp deleted file mode 100644 index 20b84451..00000000 --- a/test/lib/completions/nslookup.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "nslookup -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ntpdate.exp b/test/lib/completions/ntpdate.exp deleted file mode 100644 index 7a7dd716..00000000 --- a/test/lib/completions/ntpdate.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ntpdate -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/objcopy.exp b/test/lib/completions/objcopy.exp deleted file mode 100644 index 29be7e62..00000000 --- a/test/lib/completions/objcopy.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "objcopy " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/objdump.exp b/test/lib/completions/objdump.exp deleted file mode 100644 index c1f62e35..00000000 --- a/test/lib/completions/objdump.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "objdump " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/od.exp b/test/lib/completions/od.exp deleted file mode 100644 index e2712d12..00000000 --- a/test/lib/completions/od.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "od " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/oggdec.exp b/test/lib/completions/oggdec.exp deleted file mode 100644 index 18b0f949..00000000 --- a/test/lib/completions/oggdec.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "oggdec " -sync_after_int - -assert_complete_any "oggdec --" -sync_after_int - - -teardown diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp deleted file mode 100644 index 3adbbae7..00000000 --- a/test/lib/completions/openssl.exp +++ /dev/null @@ -1,35 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "Tab should complete" - # Try completion -set cmd "openssl " -send "$cmd\t" -expect { - -re "^$cmd\r\n.*$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -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/opera.exp b/test/lib/completions/opera.exp deleted file mode 100644 index 9b666403..00000000 --- a/test/lib/completions/opera.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "opera " -sync_after_int - - -teardown diff --git a/test/lib/completions/optipng.exp b/test/lib/completions/optipng.exp deleted file mode 100644 index 0a079190..00000000 --- a/test/lib/completions/optipng.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "optipng " -sync_after_int - - -teardown diff --git a/test/lib/completions/p4.exp b/test/lib/completions/p4.exp deleted file mode 100644 index 20d8fb6e..00000000 --- a/test/lib/completions/p4.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "p4 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pack200.exp b/test/lib/completions/pack200.exp deleted file mode 100644 index 537bf327..00000000 --- a/test/lib/completions/pack200.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pack200 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/passwd.exp b/test/lib/completions/passwd.exp deleted file mode 100644 index df2945b8..00000000 --- a/test/lib/completions/passwd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "passwd " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/paste.exp b/test/lib/completions/paste.exp deleted file mode 100644 index 224d9dd9..00000000 --- a/test/lib/completions/paste.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "paste " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/patch.exp b/test/lib/completions/patch.exp deleted file mode 100644 index 07e88f15..00000000 --- a/test/lib/completions/patch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "patch " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pdftotext.exp b/test/lib/completions/pdftotext.exp deleted file mode 100644 index 4c5cfca5..00000000 --- a/test/lib/completions/pdftotext.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 3a92a6b9..00000000 --- a/test/lib/completions/perl.exp +++ /dev/null @@ -1,131 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/PERL5LIB=/d} -} - - -setup - - -assert_complete_any "perl " - - -sync_after_int - - -set test "Second argument should file complete" -set cmd "perl foo $::srcdir/fixtures/shared/default/f" -send "$cmd\t" -expect { - -re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-I without space should complete directories" -set cmd "perl -I$::srcdir/fixtures/shared/default/" -send "$cmd\t" -expect { - -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-I with space should complete directories" -set cmd "perl -I $::srcdir/fixtures/shared/default/" -send "$cmd\t" -expect { - -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-x without space should complete directories" -set cmd "perl -x$::srcdir/fixtures/shared/default/b" -send "$cmd\t" -expect { - -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "-x with space should complete directories" -set cmd "perl -x $::srcdir/fixtures/shared/default/b" -send "$cmd\t" -expect { - -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - - -sync_after_int - - -set test "- should complete options" -set options { - -0 -a -c -C -d -D -e -F -h -i -I -l -m -M -n -p -P -s -S -T -u -U -v -V -w -W -x -X -} -assert_complete $options "perl -" $test - - -sync_after_int - -assert_no_complete "perl -e " -sync_after_int - -assert_complete_any "perl -V:install" -sync_after_int - -assert_complete_any "perl -V::install" -sync_after_int - -# Assuming that File::Spec and friends are always installed... - -assert_complete_any "perl -MFile" -sync_after_int - -assert_complete_any "perl -MFile::Sp" -sync_after_int - -assert_complete_any "perl -MFile::Spec::Func" -sync_after_int - -assert_complete_any "perl -M-File" -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 deleted file mode 100644 index 3197bf5c..00000000 --- a/test/lib/completions/perldoc.exp +++ /dev/null @@ -1,39 +0,0 @@ -proc setup {} { - assert_bash_exec {export PERL5LIB=$SRCDIR/fixtures/perldoc} - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "perldoc should complete word containing colons" -set cmd "perldoc File::" -send "$cmd\t" -expect { - # Assuming the module `File::Path' is always installed - -re "\\sPath\\s" { pass "$test" } - # Assuming there's no perl module named `fixtures', but only our directory - # `test/fixtures' which is presented falsely. - -re "\\sfixtures/\\s" { fail "$test" } - -re "perldoc File::File::" { fail "$test" } - -re /@ { unresolved "$test" } - default { unresolved "$test" } -} -sync_after_int - - -assert_complete_any "perldoc -" -sync_after_int - - -assert_complete "BashCompletionModule BashCompletionDoc" "perldoc BashCompletion" -sync_after_int - - -teardown diff --git a/test/lib/completions/perltidy.exp b/test/lib/completions/perltidy.exp deleted file mode 100644 index 09fa2b14..00000000 --- a/test/lib/completions/perltidy.exp +++ /dev/null @@ -1,27 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "perltidy " -sync_after_int - -assert_complete_any "perltidy -h" -sync_after_int - -assert_complete_any "perltidy -ole=" -sync_after_int - -assert_no_complete "perltidy -doesntexist=" -sync_after_int - - -teardown diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp deleted file mode 100644 index c6276f71..00000000 --- a/test/lib/completions/pgrep.exp +++ /dev/null @@ -1,19 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# "p": Assume that our process name completion runs ps -assert_complete_any "pgrep p" -sync_after_int - - -teardown diff --git a/test/lib/completions/phing.exp b/test/lib/completions/phing.exp deleted file mode 100644 index f064ea4a..00000000 --- a/test/lib/completions/phing.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "phing -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pidof.exp b/test/lib/completions/pidof.exp deleted file mode 100644 index d8ab9e8c..00000000 --- a/test/lib/completions/pidof.exp +++ /dev/null @@ -1,19 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# "p": Assume that our process name completion runs ps -assert_complete_any "pidof p" -sync_after_int - - -teardown diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp deleted file mode 100644 index 9919a4cb..00000000 --- a/test/lib/completions/pine.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pine -" -sync_after_int - - -teardown diff --git a/test/lib/completions/pinfo.exp b/test/lib/completions/pinfo.exp deleted file mode 100644 index de241ff5..00000000 --- a/test/lib/completions/pinfo.exp +++ /dev/null @@ -1,23 +0,0 @@ -proc setup {} { - assert_bash_exec {OLDINFOPATH=$INFOPATH; INFOPATH=$INFOPATH:$TESTDIR/fixtures/info:} - save_env -} - - -proc teardown {} { - assert_env_unmodified - assert_bash_exec {INFOPATH="$OLDINFOPATH"; unset -v OLDINFOPATH} -} - - -setup - - -assert_complete_any "pinfo bash" -sync_after_int - -assert_complete_any "pinfo -" -sync_after_int - - -teardown diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp deleted file mode 100644 index 9ef7f2fd..00000000 --- a/test/lib/completions/ping.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ping " -sync_after_int - -assert_complete_any "ping -" -sync_after_int - - -teardown diff --git a/test/lib/completions/pkg-config.exp b/test/lib/completions/pkg-config.exp deleted file mode 100644 index adf9a301..00000000 --- a/test/lib/completions/pkg-config.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkg-config -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pkg-get.exp b/test/lib/completions/pkg-get.exp deleted file mode 100644 index 38b2b97f..00000000 --- a/test/lib/completions/pkg-get.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkg-get " -sync_after_int - - -teardown diff --git a/test/lib/completions/pkg_deinstall.exp b/test/lib/completions/pkg_deinstall.exp deleted file mode 100644 index c2b3ae0b..00000000 --- a/test/lib/completions/pkg_deinstall.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - assert_bash_exec {PKG_DBDIR=$::srcdir/fixtures/pkgtools/db} - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set pkgs [exec bash -c "cd $::srcdir/fixtures/pkgtools/db ; compgen -d"] -assert_complete $pkgs "pkg_deinstall " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pkg_delete.exp b/test/lib/completions/pkg_delete.exp deleted file mode 100644 index 37ce4035..00000000 --- a/test/lib/completions/pkg_delete.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkg_delete " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pkg_info.exp b/test/lib/completions/pkg_info.exp deleted file mode 100644 index ad8ed84e..00000000 --- a/test/lib/completions/pkg_info.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkg_info " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pkgadd.exp b/test/lib/completions/pkgadd.exp deleted file mode 100644 index ba5eadf9..00000000 --- a/test/lib/completions/pkgadd.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkgadd " -sync_after_int - - -teardown diff --git a/test/lib/completions/pkgrm.exp b/test/lib/completions/pkgrm.exp deleted file mode 100644 index 08c685c4..00000000 --- a/test/lib/completions/pkgrm.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkgrm " -sync_after_int - - -teardown diff --git a/test/lib/completions/pkgtool.exp b/test/lib/completions/pkgtool.exp deleted file mode 100644 index c071ecd4..00000000 --- a/test/lib/completions/pkgtool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkgtool -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pkgutil.exp b/test/lib/completions/pkgutil.exp deleted file mode 100644 index e79dea15..00000000 --- a/test/lib/completions/pkgutil.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkgutil " -sync_after_int - - -teardown diff --git a/test/lib/completions/pkill.exp b/test/lib/completions/pkill.exp deleted file mode 100644 index 6faddfc3..00000000 --- a/test/lib/completions/pkill.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pkill " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/plague-client.exp b/test/lib/completions/plague-client.exp deleted file mode 100644 index ddcc8491..00000000 --- a/test/lib/completions/plague-client.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "plague-client " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pm-hibernate.exp b/test/lib/completions/pm-hibernate.exp deleted file mode 100644 index 1a20603d..00000000 --- a/test/lib/completions/pm-hibernate.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pm-hibernate -" -sync_after_int - - -teardown diff --git a/test/lib/completions/pm-is-supported.exp b/test/lib/completions/pm-is-supported.exp deleted file mode 100644 index 8bd136ff..00000000 --- a/test/lib/completions/pm-is-supported.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pm-is-supported -" -sync_after_int - - -teardown diff --git a/test/lib/completions/pm-powersave.exp b/test/lib/completions/pm-powersave.exp deleted file mode 100644 index dea37139..00000000 --- a/test/lib/completions/pm-powersave.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pm-powersave " -sync_after_int - - -teardown diff --git a/test/lib/completions/pngfix.exp b/test/lib/completions/pngfix.exp deleted file mode 100644 index d492610d..00000000 --- a/test/lib/completions/pngfix.exp +++ /dev/null @@ -1,21 +0,0 @@ -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/portinstall.exp b/test/lib/completions/portinstall.exp deleted file mode 100644 index ab14afa8..00000000 --- a/test/lib/completions/portinstall.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - assert_bash_exec {PORTSDIR=$TESTDIR/tmp; sed -e s,PORTSDIR,$PORTSDIR,g $::srcdir/fixtures/pkgtools/ports/INDEX.dist > $PORTSDIR/INDEX; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5} - save_env -} - - -proc teardown {} { - assert_bash_exec {rm $PORTSDIR/INDEX $PORTSDIR/INDEX-5} - assert_env_unmodified -} - - -setup - - -assert_complete "bash-2.05b.007_6 bash-3.1.17 bash-completion-20060301_2 shells/bash shells/bash-completion shells/bash2" "portinstall " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/portsnap.exp b/test/lib/completions/portsnap.exp deleted file mode 100644 index d6028cae..00000000 --- a/test/lib/completions/portsnap.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "portsnap " -sync_after_int - - -teardown diff --git a/test/lib/completions/portupgrade.exp b/test/lib/completions/portupgrade.exp deleted file mode 100644 index 62b5789d..00000000 --- a/test/lib/completions/portupgrade.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db} - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete "a b-c-d" "portupgrade " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/postcat.exp b/test/lib/completions/postcat.exp deleted file mode 100644 index 78636676..00000000 --- a/test/lib/completions/postcat.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "postcat " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/postconf.exp b/test/lib/completions/postconf.exp deleted file mode 100644 index a7f26714..00000000 --- a/test/lib/completions/postconf.exp +++ /dev/null @@ -1,29 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - -# Broken configs may abort output of postconf halfway through, so use -# something from early output to not trigger false positives because of -# this. For example, inet_protocols=all but no IPv6 configured: -# postconf: fatal: parameter inet_interfaces: no local interface found for ::1 -# ...and output can be cut off somewhere near lmtp_tls_secur*. -# ...or be completely missing, so all we can do is to skip. -set test "\"postconf al\" should complete al* variables" -if {[assert_exec {postconf} "" "" "untested"]} { - assert_complete_any "postconf al" -} -sync_after_int - -assert_complete_any "postconf -" -sync_after_int - - -teardown diff --git a/test/lib/completions/postfix.exp b/test/lib/completions/postfix.exp deleted file mode 100644 index d1cb7e80..00000000 --- a/test/lib/completions/postfix.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "postfix " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/postmap.exp b/test/lib/completions/postmap.exp deleted file mode 100644 index af31061f..00000000 --- a/test/lib/completions/postmap.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "postmap " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/postsuper.exp b/test/lib/completions/postsuper.exp deleted file mode 100644 index 145895e2..00000000 --- a/test/lib/completions/postsuper.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "postsuper " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/povray.exp b/test/lib/completions/povray.exp deleted file mode 100644 index 30d58e48..00000000 --- a/test/lib/completions/povray.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "povray " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pr.exp b/test/lib/completions/pr.exp deleted file mode 100644 index 478017b2..00000000 --- a/test/lib/completions/pr.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pr " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/prelink.exp b/test/lib/completions/prelink.exp deleted file mode 100644 index 4a493667..00000000 --- a/test/lib/completions/prelink.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "prelink " -sync_after_int - -assert_complete_any "prelink -" -sync_after_int - - -teardown diff --git a/test/lib/completions/protoc.exp b/test/lib/completions/protoc.exp deleted file mode 100644 index caeb8274..00000000 --- a/test/lib/completions/protoc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "protoc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/psql.exp b/test/lib/completions/psql.exp deleted file mode 100644 index 3dbffaf2..00000000 --- a/test/lib/completions/psql.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "psql -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ptx.exp b/test/lib/completions/ptx.exp deleted file mode 100644 index 220243c3..00000000 --- a/test/lib/completions/ptx.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ptx " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp deleted file mode 100644 index 8b82a160..00000000 --- a/test/lib/completions/puppet.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "puppet " -sync_after_int - -assert_complete_any "puppet agent --" -sync_after_int - - -teardown diff --git a/test/lib/completions/pushd.exp b/test/lib/completions/pushd.exp deleted file mode 100644 index 54e3ad8b..00000000 --- a/test/lib/completions/pushd.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pushd " -sync_after_int - - -teardown diff --git a/test/lib/completions/pv.exp b/test/lib/completions/pv.exp deleted file mode 100644 index 64d685ae..00000000 --- a/test/lib/completions/pv.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pv " -sync_after_int - -assert_complete_any "pv -" -sync_after_int - -assert_complete_any "pv --pidfile " -sync_after_int - - -teardown diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp deleted file mode 100644 index f317b52f..00000000 --- a/test/lib/completions/pvchange.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {pvchange --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "pvchange --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp deleted file mode 100644 index 6e36b368..00000000 --- a/test/lib/completions/pvcreate.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {pvcreate --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "pvcreate --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp deleted file mode 100644 index 7b1df0c3..00000000 --- a/test/lib/completions/pvdisplay.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {pvdisplay --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "pvdisplay --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvmove.exp b/test/lib/completions/pvmove.exp deleted file mode 100644 index 24d17006..00000000 --- a/test/lib/completions/pvmove.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pvmove --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp deleted file mode 100644 index 6d655e79..00000000 --- a/test/lib/completions/pvremove.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {pvremove --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "pvremove --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp deleted file mode 100644 index 195665fd..00000000 --- a/test/lib/completions/pvs.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {pvs --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "pvs --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pvscan.exp b/test/lib/completions/pvscan.exp deleted file mode 100644 index d3b8ad33..00000000 --- a/test/lib/completions/pvscan.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pvscan --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pwck.exp b/test/lib/completions/pwck.exp deleted file mode 100644 index e7c5706c..00000000 --- a/test/lib/completions/pwck.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pwck " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pwd.exp b/test/lib/completions/pwd.exp deleted file mode 100644 index 3690076a..00000000 --- a/test/lib/completions/pwd.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pwd -" -sync_after_int - - -teardown diff --git a/test/lib/completions/pwdx.exp b/test/lib/completions/pwdx.exp deleted file mode 100644 index 314623bd..00000000 --- a/test/lib/completions/pwdx.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pwdx " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/pwgen.exp b/test/lib/completions/pwgen.exp deleted file mode 100644 index b8882b68..00000000 --- a/test/lib/completions/pwgen.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pwgen -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/py.test.exp b/test/lib/completions/py.test.exp deleted file mode 100644 index 736b9828..00000000 --- a/test/lib/completions/py.test.exp +++ /dev/null @@ -1,21 +0,0 @@ -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/pycodestyle.exp b/test/lib/completions/pycodestyle.exp deleted file mode 100644 index a4d095e0..00000000 --- a/test/lib/completions/pycodestyle.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pycodestyle " -sync_after_int - -assert_complete_any "pycodestyle -" -sync_after_int - -assert_no_complete "pycodestyle --doesnt-exist=" -sync_after_int - - -teardown diff --git a/test/lib/completions/pydoc.exp b/test/lib/completions/pydoc.exp deleted file mode 100644 index fe573693..00000000 --- a/test/lib/completions/pydoc.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pydoc r" -sync_after_int - - -teardown diff --git a/test/lib/completions/pyflakes.exp b/test/lib/completions/pyflakes.exp deleted file mode 100644 index 22a8cf7c..00000000 --- a/test/lib/completions/pyflakes.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pyflakes " -sync_after_int - - -teardown diff --git a/test/lib/completions/pylint.exp b/test/lib/completions/pylint.exp deleted file mode 100644 index 62774220..00000000 --- a/test/lib/completions/pylint.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pylint -" -sync_after_int - - -teardown diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp deleted file mode 100644 index be0e8a2d..00000000 --- a/test/lib/completions/python.exp +++ /dev/null @@ -1,48 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "python " -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 -m json." -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 deleted file mode 100644 index 9eca0e4c..00000000 --- a/test/lib/completions/pyvenv.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "pyvenv " -sync_after_int - - -teardown diff --git a/test/lib/completions/qemu.exp b/test/lib/completions/qemu.exp deleted file mode 100644 index cd3d5938..00000000 --- a/test/lib/completions/qemu.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "qemu " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/qrunner.exp b/test/lib/completions/qrunner.exp deleted file mode 100644 index 0dec16cc..00000000 --- a/test/lib/completions/qrunner.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "qrunner -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/querybts.exp b/test/lib/completions/querybts.exp deleted file mode 100644 index 4ed09d8a..00000000 --- a/test/lib/completions/querybts.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "querybts --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/quota.exp b/test/lib/completions/quota.exp deleted file mode 100644 index 1eb9f161..00000000 --- a/test/lib/completions/quota.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "quota " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp deleted file mode 100644 index 353d204a..00000000 --- a/test/lib/completions/quotacheck.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "quotacheck -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp deleted file mode 100644 index b8279e59..00000000 --- a/test/lib/completions/quotaon.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "quotaon -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/radvdump.exp b/test/lib/completions/radvdump.exp deleted file mode 100644 index ad1363fd..00000000 --- a/test/lib/completions/radvdump.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "radvdump -" -sync_after_int - - -teardown diff --git a/test/lib/completions/rcs.exp b/test/lib/completions/rcs.exp deleted file mode 100644 index 781ac37f..00000000 --- a/test/lib/completions/rcs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rcs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rcsdiff.exp b/test/lib/completions/rcsdiff.exp deleted file mode 100644 index 23b009c6..00000000 --- a/test/lib/completions/rcsdiff.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rcsdiff " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rdesktop.exp b/test/lib/completions/rdesktop.exp deleted file mode 100644 index 32544941..00000000 --- a/test/lib/completions/rdesktop.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rdesktop -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rdict.exp b/test/lib/completions/rdict.exp deleted file mode 100644 index 5d6ad847..00000000 --- a/test/lib/completions/rdict.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rdict --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/readelf.exp b/test/lib/completions/readelf.exp deleted file mode 100644 index c2d5ee5b..00000000 --- a/test/lib/completions/readelf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "readelf --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/readonly.exp b/test/lib/completions/readonly.exp deleted file mode 100644 index cf64ca0a..00000000 --- a/test/lib/completions/readonly.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "readonly BASH_ARG" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/remove_members.exp b/test/lib/completions/remove_members.exp deleted file mode 100644 index 59f7b6c4..00000000 --- a/test/lib/completions/remove_members.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "remove_members --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp deleted file mode 100644 index b7cf4b1c..00000000 --- a/test/lib/completions/removepkg.exp +++ /dev/null @@ -1,35 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/ROOT=/d} -} - - -setup - - -set test "-<TAB> should complete all options" -set options [list -copy -keep -preserve -warn] -assert_complete $options "removepkg -" $test - - -sync_after_int - - -set test "should complete files in \$ROOT/var/log/packages/" -# set env(ROOT) [file normalize $::srcdir/fixtures/slackware] -# set dir $env(ROOT)/var/log/packages/ -set root [file normalize $::srcdir/fixtures/slackware] -set dir $root/var/log/packages/ -assert_bash_exec "ROOT=$root" -set files [split [exec bash -c "cd $dir && ls"] "\n"] -assert_complete $files "removepkg " $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp deleted file mode 100644 index 5e25ddea..00000000 --- a/test/lib/completions/renice.exp +++ /dev/null @@ -1,25 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_bash_type ps]} { - - assert_complete_any "renice 1" - sync_after_int - - assert_complete_any "renice -g " - sync_after_int - -} - - -teardown diff --git a/test/lib/completions/repomanage.exp b/test/lib/completions/repomanage.exp deleted file mode 100644 index de5169bc..00000000 --- a/test/lib/completions/repomanage.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "repomanage " -sync_after_int - - -teardown diff --git a/test/lib/completions/reportbug.exp b/test/lib/completions/reportbug.exp deleted file mode 100644 index 660778f7..00000000 --- a/test/lib/completions/reportbug.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "reportbug --m" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/reptyr.exp b/test/lib/completions/reptyr.exp deleted file mode 100644 index 35ccb91c..00000000 --- a/test/lib/completions/reptyr.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "reptyr -" -sync_after_int - - -assert_complete_any "reptyr " -sync_after_int - - -teardown diff --git a/test/lib/completions/resolvconf.exp b/test/lib/completions/resolvconf.exp deleted file mode 100644 index d1eaf246..00000000 --- a/test/lib/completions/resolvconf.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "resolvconf -" -sync_after_int - - -teardown diff --git a/test/lib/completions/rfcomm.exp b/test/lib/completions/rfcomm.exp deleted file mode 100644 index b449134c..00000000 --- a/test/lib/completions/rfcomm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rfcomm " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rfkill.exp b/test/lib/completions/rfkill.exp deleted file mode 100644 index ab0f1811..00000000 --- a/test/lib/completions/rfkill.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rfkill " -sync_after_int - -assert_complete_any "rfkill -" -sync_after_int - - -teardown diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp deleted file mode 100644 index 1210685b..00000000 --- a/test/lib/completions/ri.exp +++ /dev/null @@ -1,26 +0,0 @@ -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 -" -sync_after_int - -assert_complete "BashCompletion/ cache.ri" "ri --dump=$::srcdir/fixtures/ri/" -sync_after_int - -assert_complete "BashCompletion" "ri BashCompletio" -sync_after_int - - -teardown diff --git a/test/lib/completions/rlog.exp b/test/lib/completions/rlog.exp deleted file mode 100644 index 87984a8d..00000000 --- a/test/lib/completions/rlog.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rlog " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rm.exp b/test/lib/completions/rm.exp deleted file mode 100644 index f764a8e7..00000000 --- a/test/lib/completions/rm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rm " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rmdir.exp b/test/lib/completions/rmdir.exp deleted file mode 100644 index 1a904b64..00000000 --- a/test/lib/completions/rmdir.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rmdir " - - -sync_after_int - - -assert_complete {"bar bar.d/" foo.d/} "rmdir $::srcdir/fixtures/shared/default/" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rmlist.exp b/test/lib/completions/rmlist.exp deleted file mode 100644 index d530d117..00000000 --- a/test/lib/completions/rmlist.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rmlist -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rmmod.exp b/test/lib/completions/rmmod.exp deleted file mode 100644 index 6c563211..00000000 --- a/test/lib/completions/rmmod.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rmmod -" -sync_after_int - - -teardown diff --git a/test/lib/completions/route.exp b/test/lib/completions/route.exp deleted file mode 100644 index 76e1b5e0..00000000 --- a/test/lib/completions/route.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "route " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rpcdebug.exp b/test/lib/completions/rpcdebug.exp deleted file mode 100644 index 7f1a1c2f..00000000 --- a/test/lib/completions/rpcdebug.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rpcdebug -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rpm.exp b/test/lib/completions/rpm.exp deleted file mode 100644 index 82ab28dc..00000000 --- a/test/lib/completions/rpm.exp +++ /dev/null @@ -1,29 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rpm " - - -sync_after_int - - - # Build list of installed packages -if {[assert_exec {rpm -qa --qf=%\{NAME\}\n | sort -u} packages]} { - assert_complete $packages "rpm -q " -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rpm2tgz.exp b/test/lib/completions/rpm2tgz.exp deleted file mode 100644 index eb597982..00000000 --- a/test/lib/completions/rpm2tgz.exp +++ /dev/null @@ -1,31 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "rpm2tgz -" - - -sync_after_int - - -set test "should complete *.rpm files and dirs" -set dir $::srcdir/fixtures/slackware/home -set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ - \\( -type d -printf '%P/\\n' \\) -o \ - \\( -type f -name '*.rpm' -printf '%P\\n' \\)"] "\n"] -assert_complete_dir $files "rpm2tgz " $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rpmbuild.exp b/test/lib/completions/rpmbuild.exp deleted file mode 100644 index 4058d722..00000000 --- a/test/lib/completions/rpmbuild.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rpmbuild -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/rrdtool.exp b/test/lib/completions/rrdtool.exp deleted file mode 100644 index 3fb392e4..00000000 --- a/test/lib/completions/rrdtool.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rrdtool " -sync_after_int - - -teardown diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp deleted file mode 100644 index accc6569..00000000 --- a/test/lib/completions/rsync.exp +++ /dev/null @@ -1,28 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /_scp_path_esc=/d - } -} - - -setup - - -assert_complete_any "rsync " -sync_after_int - - -assert_complete "rsh ssh" "rsync --rsh " -sync_after_int - - -assert_complete "rsh ssh" "rsync --rsh=" -sync_after_int - - -teardown diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp deleted file mode 100644 index 81ca3206..00000000 --- a/test/lib/completions/rtcwake.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "rtcwake " -sync_after_int - - -teardown diff --git a/test/lib/completions/runuser.exp b/test/lib/completions/runuser.exp deleted file mode 100644 index 051abe1d..00000000 --- a/test/lib/completions/runuser.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "runuser " -sync_after_int - - -teardown diff --git a/test/lib/completions/sbcl-mt.exp b/test/lib/completions/sbcl-mt.exp deleted file mode 100644 index a80e543b..00000000 --- a/test/lib/completions/sbcl-mt.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt $::srcdir/fixtures/shared/default/" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sbcl.exp b/test/lib/completions/sbcl.exp deleted file mode 100644 index 3adeb6bf..00000000 --- a/test/lib/completions/sbcl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl $::srcdir/fixtures/shared/default/" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sbopkg.exp b/test/lib/completions/sbopkg.exp deleted file mode 100644 index c4dbfe26..00000000 --- a/test/lib/completions/sbopkg.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sbopkg -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index 6b06cb25..1497a7fb 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -23,11 +23,11 @@ set test "Tab should complete remote pwd" set host bash_completion # Retrieving home directory (host_pwd) from ssh-host `bash_completion' - # yields error? + # yields error? if { [catch { - exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>> /dev/null - } host_pwd] + exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>>/dev/null + } host_pwd] } { # Yes, retrieving pwd from ssh yields error; reset `host_pwd' # Indicate host pwd is unknown and test is unsupported diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp deleted file mode 100644 index a5b8c69f..00000000 --- a/test/lib/completions/screen.exp +++ /dev/null @@ -1,36 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "screen -" -sync_after_int - - -assert_complete {bar "bar bar.d/" foo foo.d/} \ - "screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs" -sync_after_int - - -assert_complete_any "screen cat" -sync_after_int - - -# Limit number of matches, assume at least vt100 and friends are there -assert_complete_any "screen -T vt" -sync_after_int - - -assert_complete_any "screen -T foo cat" -sync_after_int - - -teardown diff --git a/test/lib/completions/sdptool.exp b/test/lib/completions/sdptool.exp deleted file mode 100644 index c46a1fa2..00000000 --- a/test/lib/completions/sdptool.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sdptool " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp deleted file mode 100644 index dd480a60..00000000 --- a/test/lib/completions/sed.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {sed --help} "" "" "unsupported"]} { - assert_complete_any "sed --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/seq.exp b/test/lib/completions/seq.exp deleted file mode 100644 index 6e5ef8dc..00000000 --- a/test/lib/completions/seq.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "seq --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/service.exp b/test/lib/completions/service.exp deleted file mode 100644 index f3cf7355..00000000 --- a/test/lib/completions/service.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "service " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/set.exp b/test/lib/completions/set.exp deleted file mode 100644 index c14ecff6..00000000 --- a/test/lib/completions/set.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "set no" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/setquota.exp b/test/lib/completions/setquota.exp deleted file mode 100644 index d169e1ad..00000000 --- a/test/lib/completions/setquota.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "setquota " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 3c18ddb7..c5c0919f 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -57,8 +57,4 @@ assert_complete $expected "sftp -F spaced\\ \\ conf " sync_after_int -assert_complete "-Fspaced\\ \\ conf" "sftp -Fsp" "-F should complete filename" -sync_after_int - - teardown diff --git a/test/lib/completions/sh.exp b/test/lib/completions/sh.exp deleted file mode 100644 index e1a51bb9..00000000 --- a/test/lib/completions/sh.exp +++ /dev/null @@ -1,38 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sh -" - - -sync_after_int - - -assert_complete_any "sh +" - - -sync_after_int - - -assert_complete_any "sh -o " - - -sync_after_int - - -assert_no_complete "sh -c " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sha1sum.exp b/test/lib/completions/sha1sum.exp deleted file mode 100644 index c5983044..00000000 --- a/test/lib/completions/sha1sum.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sha1sum --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/shar.exp b/test/lib/completions/shar.exp deleted file mode 100644 index 604a2031..00000000 --- a/test/lib/completions/shar.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "shar --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sitecopy.exp b/test/lib/completions/sitecopy.exp deleted file mode 100644 index 7e0c87fe..00000000 --- a/test/lib/completions/sitecopy.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sitecopy --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/slackpkg.exp b/test/lib/completions/slackpkg.exp deleted file mode 100644 index 150f03fc..00000000 --- a/test/lib/completions/slackpkg.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "slackpkg -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/slapt-get.exp b/test/lib/completions/slapt-get.exp index 7f5375a4..4522610d 100644 --- a/test/lib/completions/slapt-get.exp +++ b/test/lib/completions/slapt-get.exp @@ -11,26 +11,6 @@ proc teardown {} { setup -assert_complete_any "slapt-get -" - - -sync_after_int - - -set test "--up<TAB> should complete \"--update --upgrade\"" -assert_complete "--update --upgrade" "slapt-get --up" $test - - -sync_after_int - - -set test "--install should not complete anything if config doesn't exist" -assert_no_complete "slapt-get -c non-existent-file --install " $test - - -sync_after_int - - set test "--install should complete available packages" set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-getrc set workdir [file normalize $::srcdir/fixtures/slackware/var/slapt-get/] diff --git a/test/lib/completions/slapt-src.exp b/test/lib/completions/slapt-src.exp index 9410f9c1..b66385ef 100644 --- a/test/lib/completions/slapt-src.exp +++ b/test/lib/completions/slapt-src.exp @@ -11,26 +11,6 @@ proc teardown {} { setup -assert_complete_any "slapt-src -" - - -sync_after_int - - -set test "--bu<TAB> should complete \"--build\"" -assert_complete "--build" "slapt-src --bu" $test - - -sync_after_int - - -set test "--ins<TAB> should complete \"--install\"" -assert_complete "--install" "slapt-src --ins" $test - - -sync_after_int - - set test "--install should complete available packages" set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-srcrc set workdir [file normalize $::srcdir/fixtures/slackware/usr/src/slapt-src/] diff --git a/test/lib/completions/smartctl.exp b/test/lib/completions/smartctl.exp deleted file mode 100644 index 24919396..00000000 --- a/test/lib/completions/smartctl.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smartctl --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbcacls.exp b/test/lib/completions/smbcacls.exp deleted file mode 100644 index d501f825..00000000 --- a/test/lib/completions/smbcacls.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbcacls -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbclient.exp b/test/lib/completions/smbclient.exp deleted file mode 100644 index 0fb8e2da..00000000 --- a/test/lib/completions/smbclient.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbclient -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbcquotas.exp b/test/lib/completions/smbcquotas.exp deleted file mode 100644 index 24be2f60..00000000 --- a/test/lib/completions/smbcquotas.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbcquotas -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbget.exp b/test/lib/completions/smbget.exp deleted file mode 100644 index 938cd0e5..00000000 --- a/test/lib/completions/smbget.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbget -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbpasswd.exp b/test/lib/completions/smbpasswd.exp deleted file mode 100644 index b6e86bbc..00000000 --- a/test/lib/completions/smbpasswd.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbpasswd -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbtar.exp b/test/lib/completions/smbtar.exp deleted file mode 100644 index e0d58f5f..00000000 --- a/test/lib/completions/smbtar.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbtar -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/smbtree.exp b/test/lib/completions/smbtree.exp deleted file mode 100644 index b234e443..00000000 --- a/test/lib/completions/smbtree.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "smbtree -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/snownews.exp b/test/lib/completions/snownews.exp deleted file mode 100644 index c8ad6741..00000000 --- a/test/lib/completions/snownews.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "snownews --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sort.exp b/test/lib/completions/sort.exp deleted file mode 100644 index a130bbc8..00000000 --- a/test/lib/completions/sort.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sort --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp deleted file mode 100644 index e13df49a..00000000 --- a/test/lib/completions/split.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {split --help} "" "" "unsupported"]} { - assert_complete_any "split --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/spovray.exp b/test/lib/completions/spovray.exp deleted file mode 100644 index 2b2c33de..00000000 --- a/test/lib/completions/spovray.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "spovray " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sqlite3.exp b/test/lib/completions/sqlite3.exp deleted file mode 100644 index af1ada82..00000000 --- a/test/lib/completions/sqlite3.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sqlite3 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ss.exp b/test/lib/completions/ss.exp deleted file mode 100644 index e64e33d9..00000000 --- a/test/lib/completions/ss.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ss -" -sync_after_int - -assert_complete_any "ss -A " -sync_after_int - -assert_complete_any "ss -A foo," -sync_after_int - - -teardown diff --git a/test/lib/completions/ssh-add.exp b/test/lib/completions/ssh-add.exp deleted file mode 100644 index 2fb2a9b4..00000000 --- a/test/lib/completions/ssh-add.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ssh-add " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp deleted file mode 100644 index 5abe303d..00000000 --- a/test/lib/completions/ssh-copy-id.exp +++ /dev/null @@ -1,26 +0,0 @@ -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_bash_exec {HOME=$OLDHOME} - assert_env_unmodified { - /OLDHOME=/d - } -} - - -setup - - -assert_complete_any "ssh-copy-id -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ssh-keygen.exp b/test/lib/completions/ssh-keygen.exp deleted file mode 100644 index fea2529e..00000000 --- a/test/lib/completions/ssh-keygen.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 c082558e..1702371c 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -19,21 +19,6 @@ proc teardown {} { setup -set test "Tab should complete both commands and hostname" - # Try completion -set cmd "ssh -F config ls" -send "$cmd\t" -set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$" -expect { - -re $expected { pass "$test" } - -re /@ { unresolved "$test at prompt" } - default { unresolved "$test" } -} - - -sync_after_int - - set test "-F without space shouldn't error" # Try completion set cmd "ssh -F" @@ -50,15 +35,6 @@ expect { sync_after_int -set test "First argument shouldn't complete with commands" -# NOTE: This test assumes there's a command "bash" and no host named "bash" -set cmd "ssh bas" -assert_complete [get_known_hosts "bas"] $cmd $test - - -sync_after_int - - set test "First argument should complete partial hostname" # 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 (:). @@ -82,11 +58,4 @@ assert_complete $hosts "ssh $char" $test -ltrim-colon-completions -expect-cmd-mi sync_after_int -set test "-F should complete filename" -assert_complete "-Fspaced\\ \\ conf" "ssh -Fsp" $test - - -sync_after_int - - teardown diff --git a/test/lib/completions/sshfs.exp b/test/lib/completions/sshfs.exp deleted file mode 100644 index 42adbd8b..00000000 --- a/test/lib/completions/sshfs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /_scp_path_esc=/d - } -} - - -setup - - -assert_complete_any "sshfs ./" -sync_after_int - - -teardown diff --git a/test/lib/completions/sshmitm.exp b/test/lib/completions/sshmitm.exp deleted file mode 100644 index 13b50673..00000000 --- a/test/lib/completions/sshmitm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sshmitm -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sshow.exp b/test/lib/completions/sshow.exp deleted file mode 100644 index 074d7b12..00000000 --- a/test/lib/completions/sshow.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sshow -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/strace.exp b/test/lib/completions/strace.exp deleted file mode 100644 index 933d1b48..00000000 --- a/test/lib/completions/strace.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "strace -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/stream.exp b/test/lib/completions/stream.exp deleted file mode 100644 index 8cbda602..00000000 --- a/test/lib/completions/stream.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "stream " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/strings.exp b/test/lib/completions/strings.exp deleted file mode 100644 index 103d5d3a..00000000 --- a/test/lib/completions/strings.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "strings " -sync_after_int - - -teardown diff --git a/test/lib/completions/strip.exp b/test/lib/completions/strip.exp deleted file mode 100644 index 00f4ab9c..00000000 --- a/test/lib/completions/strip.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "strip --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/su.exp b/test/lib/completions/su.exp deleted file mode 100644 index 55dd80d1..00000000 --- a/test/lib/completions/su.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup -assert_complete_any "su " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp index 5fdb97f1..73e485d6 100644 --- a/test/lib/completions/sudo.exp +++ b/test/lib/completions/sudo.exp @@ -11,36 +11,6 @@ proc teardown {} { setup -assert_complete_dir foo.d/ "sudo cd fo" $::srcdir/fixtures/shared/default \ - "" -nospace - - -sync_after_int - - -assert_complete_dir fixtures/ "sudo sh fix" $::srcdir "" -nospace - - -sync_after_int - - -# test that `mount` and `sudo mount` behave the same way -set test "sudo mount /dev/sda1 def should complete directory name" -assert_complete_dir "default/" "sudo mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace - - -sync_after_int - - -set test "sudo -e should complete filenames and directories" -set dir $::srcdir/fixtures/shared/default -set files {foo foo.d/} -assert_complete_dir $files "sudo -e -u root bar foo" $dir $test - - -sync_after_int - - # Find user/group suitable for testing. set failed_find_unique_completion 0 foreach ug {user group} { @@ -56,14 +26,6 @@ foreach ug {user group} { # These tests require an unique completion. if {!$failed_find_unique_completion} { - assert_complete $fulluser "sudo chown $partuser" - sync_after_int - - assert_complete $fulluser:$fullgroup "sudo chown $fulluser:$partgroup" - sync_after_int - - assert_complete "dot.user:$fullgroup" "sudo chown dot.user:$partgroup" - sync_after_int foreach prefix { "funky\\ user:" "funky.user:" "funky\\.user:" "fu\\ nky.user:" @@ -74,21 +36,6 @@ if {!$failed_find_unique_completion} { assert_complete $prefix$fullgroup "sudo chown $prefix$partgroup" $test sync_after_int } - - # Check that we give up in degenerate cases instead of spewing various junk. - - assert_no_complete "sudo chown $fulluser\\\\:$partgroup" - sync_after_int - - assert_no_complete "sudo chown $fulluser\\\\\\:$partgroup" - sync_after_int - - assert_no_complete "sudo chown $fulluser\\\\\\\\:$partgroup" - sync_after_int - - # Colons in user/groupnames are not usually allowed. - assert_no_complete "sudo chown foo:bar:$partgroup" - sync_after_int } diff --git a/test/lib/completions/svcadm.exp b/test/lib/completions/svcadm.exp deleted file mode 100644 index e7266146..00000000 --- a/test/lib/completions/svcadm.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "svcadm " -sync_after_int - - -teardown diff --git a/test/lib/completions/svk.exp b/test/lib/completions/svk.exp deleted file mode 100644 index a794a008..00000000 --- a/test/lib/completions/svk.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "svk " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/svn.exp b/test/lib/completions/svn.exp deleted file mode 100644 index d1a08ae4..00000000 --- a/test/lib/completions/svn.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "svn " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/svnadmin.exp b/test/lib/completions/svnadmin.exp deleted file mode 100644 index f20d52cf..00000000 --- a/test/lib/completions/svnadmin.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "svnadmin " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/svnlook.exp b/test/lib/completions/svnlook.exp deleted file mode 100644 index 114435ec..00000000 --- a/test/lib/completions/svnlook.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "svnlook " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sync_members.exp b/test/lib/completions/sync_members.exp deleted file mode 100644 index 817432bb..00000000 --- a/test/lib/completions/sync_members.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sync_members --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/synclient.exp b/test/lib/completions/synclient.exp deleted file mode 100644 index 1e9c7b5b..00000000 --- a/test/lib/completions/synclient.exp +++ /dev/null @@ -1,26 +0,0 @@ -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/sysbench.exp b/test/lib/completions/sysbench.exp deleted file mode 100644 index 2a0fe339..00000000 --- a/test/lib/completions/sysbench.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "sysbench " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/sysctl.exp b/test/lib/completions/sysctl.exp deleted file mode 100644 index 6aa9ffe0..00000000 --- a/test/lib/completions/sysctl.exp +++ /dev/null @@ -1,23 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {sysctl -N -a 2>/dev/null | grep ^kern | sort -u} values]} { - set test "sysctl kern should show completions" - assert_complete $values "sysctl kern" $test -expect-cmd-minus kern -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tac.exp b/test/lib/completions/tac.exp deleted file mode 100644 index d4fe7937..00000000 --- a/test/lib/completions/tac.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tac --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp deleted file mode 100644 index fd685b1a..00000000 --- a/test/lib/completions/tail.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {tail --help} "" "" "unsupported"]} { - assert_complete_any "tail --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp deleted file mode 100644 index 75434e94..00000000 --- a/test/lib/completions/tar.exp +++ /dev/null @@ -1,132 +0,0 @@ -proc setup {} { - save_env -} - -proc teardown {} { - 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/tcpdump.exp b/test/lib/completions/tcpdump.exp deleted file mode 100644 index 79158abf..00000000 --- a/test/lib/completions/tcpdump.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tcpdump -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tcpkill.exp b/test/lib/completions/tcpkill.exp deleted file mode 100644 index d3a45e43..00000000 --- a/test/lib/completions/tcpkill.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tcpkill -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tcpnice.exp b/test/lib/completions/tcpnice.exp deleted file mode 100644 index b4b93097..00000000 --- a/test/lib/completions/tcpnice.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tcpnice -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tee.exp b/test/lib/completions/tee.exp deleted file mode 100644 index 1058bb8e..00000000 --- a/test/lib/completions/tee.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tee " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/texindex.exp b/test/lib/completions/texindex.exp deleted file mode 100644 index 43b4c09a..00000000 --- a/test/lib/completions/texindex.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "texindex --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tightvncviewer.exp b/test/lib/completions/tightvncviewer.exp deleted file mode 100644 index ee987f60..00000000 --- a/test/lib/completions/tightvncviewer.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tightvncviewer " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp deleted file mode 100644 index d052458c..00000000 --- a/test/lib/completions/time.exp +++ /dev/null @@ -1,36 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "time set" - - -sync_after_int - - -set test "-p find -typ should complete find's options" -assert_complete "-type" "time -p find -typ" $test - - -sync_after_int - - -set test "it should be possible to complete file paths" -set dir $::srcdir/fixtures/shared -set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"] -assert_complete_dir $files "time ./bin/" $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/timeout.exp b/test/lib/completions/timeout.exp deleted file mode 100644 index f56c80f3..00000000 --- a/test/lib/completions/timeout.exp +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index dd88de31..00000000 --- a/test/lib/completions/tipc.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tipc " -sync_after_int - - -teardown diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp deleted file mode 100644 index 61d22b33..00000000 --- a/test/lib/completions/touch.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {touch --help} "" "" "unsupported"]} { - assert_complete_any "touch --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tox.exp b/test/lib/completions/tox.exp deleted file mode 100644 index 55106326..00000000 --- a/test/lib/completions/tox.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tox -" -sync_after_int - -assert_complete "ALL" "tox -e " -sync_after_int - -assert_complete "ALL" "tox -e foo," -sync_after_int - - -teardown diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp deleted file mode 100644 index c10c8ba1..00000000 --- a/test/lib/completions/tr.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {tr --help} "" "" "unsupported"]} { - assert_complete_any "tr --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/tracepath.exp b/test/lib/completions/tracepath.exp deleted file mode 100644 index 33b32567..00000000 --- a/test/lib/completions/tracepath.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tracepath " -sync_after_int - -assert_complete_any "tracepath -" -sync_after_int - - -teardown diff --git a/test/lib/completions/tshark.exp b/test/lib/completions/tshark.exp deleted file mode 100644 index 9e7d9d31..00000000 --- a/test/lib/completions/tshark.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tshark -" -sync_after_int - -assert_complete_any "tshark -G " -sync_after_int - -assert_complete_any "tshark -O foo,htt" -sync_after_int - - -teardown diff --git a/test/lib/completions/tune2fs.exp b/test/lib/completions/tune2fs.exp deleted file mode 100644 index df70d904..00000000 --- a/test/lib/completions/tune2fs.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "tune2fs " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/udevadm.exp b/test/lib/completions/udevadm.exp deleted file mode 100644 index 87a948a8..00000000 --- a/test/lib/completions/udevadm.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 e7703d12..03144355 100644 --- a/test/lib/completions/umount.exp +++ b/test/lib/completions/umount.exp @@ -37,12 +37,6 @@ proc teardown {} { setup -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\\} diff --git a/test/lib/completions/unace.exp b/test/lib/completions/unace.exp deleted file mode 100644 index c9d7606e..00000000 --- a/test/lib/completions/unace.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "unace -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp deleted file mode 100644 index 0c363ab5..00000000 --- a/test/lib/completions/uname.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {uname --help} "" "" "unsupported"]} { - assert_complete_any "uname --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp deleted file mode 100644 index c9aecc25..00000000 --- a/test/lib/completions/unexpand.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {unexpand --help} "" "" "unsupported"]} { - assert_complete_any "unexpand --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp deleted file mode 100644 index d516106c..00000000 --- a/test/lib/completions/uniq.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {uniq --help} "" "" "unsupported"]} { - assert_complete_any "uniq --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp deleted file mode 100644 index 96ec91d1..00000000 --- a/test/lib/completions/units.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {units --help} "" "" "unsupported"]} { - assert_complete_any "units --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/unpack200.exp b/test/lib/completions/unpack200.exp deleted file mode 100644 index b4360491..00000000 --- a/test/lib/completions/unpack200.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "unpack200 " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/unrar.exp b/test/lib/completions/unrar.exp deleted file mode 100644 index b5e27b21..00000000 --- a/test/lib/completions/unrar.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "unrar -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/unset.exp b/test/lib/completions/unset.exp deleted file mode 100644 index 42e753cb..00000000 --- a/test/lib/completions/unset.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "unset BASH_ARG" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp deleted file mode 100644 index cac4ce65..00000000 --- a/test/lib/completions/unshunt.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "unshunt --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/update-alternatives.exp b/test/lib/completions/update-alternatives.exp deleted file mode 100644 index b94d88c5..00000000 --- a/test/lib/completions/update-alternatives.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "update-alternatives --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/update-rc.d.exp b/test/lib/completions/update-rc.d.exp deleted file mode 100644 index f2eafea5..00000000 --- a/test/lib/completions/update-rc.d.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "update-rc.d -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/upgradepkg.exp b/test/lib/completions/upgradepkg.exp index 4783aec3..ffb4ba28 100644 --- a/test/lib/completions/upgradepkg.exp +++ b/test/lib/completions/upgradepkg.exp @@ -11,31 +11,6 @@ proc teardown {} { setup -assert_complete_any "upgradepkg -" - - -sync_after_int - - -set test "--<TAB> should complete all long options" -set options [list --dry-run --install-new --reinstall --verbose] -assert_complete $options "upgradepkg --" $test - - -sync_after_int - - -set test "should complete *.t\[gbxl\]z files and dirs" -set dir $::srcdir/fixtures/slackware/home -set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ - \\( -type d -printf '%P/\\n' \\) -o \ - \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] -assert_complete_dir $files "upgradepkg " $dir $test - - -sync_after_int - - set test "should complete *.t\[gbxl\]z files and dirs after % sign" set oldpkg "xx-2.0-i486-2" set dir $::srcdir/fixtures/slackware/home diff --git a/test/lib/completions/urlsnarf.exp b/test/lib/completions/urlsnarf.exp deleted file mode 100644 index ed543629..00000000 --- a/test/lib/completions/urlsnarf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "urlsnarf -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/uscan.exp b/test/lib/completions/uscan.exp deleted file mode 100644 index f96ee971..00000000 --- a/test/lib/completions/uscan.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "uscan -" -sync_after_int - - -teardown diff --git a/test/lib/completions/useradd.exp b/test/lib/completions/useradd.exp deleted file mode 100644 index c4f4957e..00000000 --- a/test/lib/completions/useradd.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_no_complete "useradd " -sync_after_int - -assert_complete_any "useradd -" -sync_after_int - - -teardown diff --git a/test/lib/completions/userdel.exp b/test/lib/completions/userdel.exp deleted file mode 100644 index 2a46246c..00000000 --- a/test/lib/completions/userdel.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# "r": root -assert_complete_any "userdel r" -sync_after_int - -assert_complete_any "userdel -" -sync_after_int - - -teardown diff --git a/test/lib/completions/usermod.exp b/test/lib/completions/usermod.exp deleted file mode 100644 index d7daf992..00000000 --- a/test/lib/completions/usermod.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "usermod " -sync_after_int - -assert_complete_any "usermod -" -sync_after_int - - -teardown diff --git a/test/lib/completions/valgrind.exp b/test/lib/completions/valgrind.exp deleted file mode 100644 index 6e3702b6..00000000 --- a/test/lib/completions/valgrind.exp +++ /dev/null @@ -1,50 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -# b: assuming we have at least bash that starts with b in $PATH -assert_complete_any "valgrind b" - - -sync_after_int - - -assert_complete_any "valgrind -" - - -sync_after_int - - -set test "--tool=memche<TAB> should complete \"memcheck\"" -assert_complete "--tool=memcheck" "valgrind --tool=memche" $test - - -sync_after_int - - -set test "--tool=helgrind --history-l<TAB> should complete \"--history-level=\"" -assert_complete "--history-level=" "valgrind --tool=helgrind --history-l" $test -nospace - - -sync_after_int - - -set test "it should be possible to complete file paths" -set dir $::srcdir/fixtures/shared -set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"] -assert_complete_dir $files "valgrind --log-file=v\\ 0.log ./bin/" $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vdir.exp b/test/lib/completions/vdir.exp deleted file mode 100644 index c0e5ee43..00000000 --- a/test/lib/completions/vdir.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vdir " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp deleted file mode 100644 index 14162ee0..00000000 --- a/test/lib/completions/vgcfgbackup.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgcfgbackup --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgcfgbackup -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp deleted file mode 100644 index 2cf5f1ca..00000000 --- a/test/lib/completions/vgcfgrestore.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgcfgrestore --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgcfgrestore -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgchange.exp b/test/lib/completions/vgchange.exp deleted file mode 100644 index b6c0e1df..00000000 --- a/test/lib/completions/vgchange.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vgchange -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp deleted file mode 100644 index b2c86da8..00000000 --- a/test/lib/completions/vgck.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgck --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgck -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp deleted file mode 100644 index f432229e..00000000 --- a/test/lib/completions/vgconvert.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgconvert --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgconvert -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp deleted file mode 100644 index 6f3b3e37..00000000 --- a/test/lib/completions/vgcreate.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vgcreate -" -sync_after_int - - -assert_no_complete "vgcreate __does_not_exist__" -sync_after_int - - -teardown diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp deleted file mode 100644 index 5fd20596..00000000 --- a/test/lib/completions/vgdisplay.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgdisplay --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgdisplay -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp deleted file mode 100644 index e6e45d00..00000000 --- a/test/lib/completions/vgexport.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgexport --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgexport -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp deleted file mode 100644 index 18dc2016..00000000 --- a/test/lib/completions/vgextend.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgextend --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgextend -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp deleted file mode 100644 index f4c1f833..00000000 --- a/test/lib/completions/vgimport.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgimport --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgimport -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp deleted file mode 100644 index a8366848..00000000 --- a/test/lib/completions/vgmerge.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgmerge --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgmerge -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp deleted file mode 100644 index b8c3d57f..00000000 --- a/test/lib/completions/vgmknodes.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgmknodes --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgmknodes -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp deleted file mode 100644 index fc349680..00000000 --- a/test/lib/completions/vgreduce.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgreduce --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgreduce -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp deleted file mode 100644 index 0ec1011f..00000000 --- a/test/lib/completions/vgremove.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgremove --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgremove -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp deleted file mode 100644 index 62e7d3e6..00000000 --- a/test/lib/completions/vgrename.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgrename --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgrename -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp deleted file mode 100644 index 8a6cf650..00000000 --- a/test/lib/completions/vgs.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgs --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgs -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp deleted file mode 100644 index a26838fc..00000000 --- a/test/lib/completions/vgscan.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {vgscan --help} "" "" "untested"]} { # may fail as non-root - assert_complete_any "vgscan -" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vgsplit.exp b/test/lib/completions/vgsplit.exp deleted file mode 100644 index b183cfda..00000000 --- a/test/lib/completions/vgsplit.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vgsplit -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vi.exp b/test/lib/completions/vi.exp deleted file mode 100644 index db3e3deb..00000000 --- a/test/lib/completions/vi.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vi " -sync_after_int - - -assert_complete {libfoo.conf foo.txt} "vi $::srcdir/fixtures/shared/ld.so.conf.d/" -sync_after_int - - -teardown diff --git a/test/lib/completions/vipw.exp b/test/lib/completions/vipw.exp deleted file mode 100644 index c29ad9b1..00000000 --- a/test/lib/completions/vipw.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vipw -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vmstat.exp b/test/lib/completions/vmstat.exp deleted file mode 100644 index f749322a..00000000 --- a/test/lib/completions/vmstat.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup -assert_complete_any "vmstat -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vncviewer.exp b/test/lib/completions/vncviewer.exp deleted file mode 100644 index 8c51e0b2..00000000 --- a/test/lib/completions/vncviewer.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified { - /declare -f _vncviewer_bootstrap/d - } -} - - -setup - - -assert_complete_any "vncviewer " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/vpnc.exp b/test/lib/completions/vpnc.exp deleted file mode 100644 index 451d8093..00000000 --- a/test/lib/completions/vpnc.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "vpnc -" -sync_after_int - - -teardown diff --git a/test/lib/completions/watch.exp b/test/lib/completions/watch.exp deleted file mode 100644 index 02ae8f1b..00000000 --- a/test/lib/completions/watch.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "watch -" -sync_after_int - - -teardown diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp deleted file mode 100644 index b261b6a7..00000000 --- a/test/lib/completions/wc.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {wc --help} "" "" "unsupported"]} { - assert_complete_any "wc --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/webmitm.exp b/test/lib/completions/webmitm.exp deleted file mode 100644 index adb97cc2..00000000 --- a/test/lib/completions/webmitm.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "webmitm -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/wget.exp b/test/lib/completions/wget.exp deleted file mode 100644 index 457ae2ce..00000000 --- a/test/lib/completions/wget.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "wget --" - - -sync_after_int - - -assert_no_complete "wget " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp deleted file mode 100644 index 6cca6795..00000000 --- a/test/lib/completions/who.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -if {[assert_exec {who --help} "" "" "unsupported"]} { - assert_complete_any "who --" -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/wine.exp b/test/lib/completions/wine.exp deleted file mode 100644 index 2cc60c48..00000000 --- a/test/lib/completions/wine.exp +++ /dev/null @@ -1,31 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -set test "should complete *.exe, *.com files and dirs" -set dir $::srcdir/fixtures/shared/default -assert_complete_dir {"bar bar.d/" foo.d/} "wine " $dir $test - - -sync_after_int - - -set test "should complete any files and dirs after executable" -set dir $::srcdir/fixtures/shared/default -set files {bar "bar bar.d/" foo foo.d/} -assert_complete_dir $files "wine notepad " $dir $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/withlist.exp b/test/lib/completions/withlist.exp deleted file mode 100644 index e1f91f6a..00000000 --- a/test/lib/completions/withlist.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "withlist --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/wodim.exp b/test/lib/completions/wodim.exp deleted file mode 100644 index 55f63c30..00000000 --- a/test/lib/completions/wodim.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "wodim " -sync_after_int - - -teardown diff --git a/test/lib/completions/wol.exp b/test/lib/completions/wol.exp deleted file mode 100644 index a4ac9e4e..00000000 --- a/test/lib/completions/wol.exp +++ /dev/null @@ -1,29 +0,0 @@ -proc setup {} { - # See fixtures/shared/bin/{arp,ifconfig} - assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/fixtures/shared/bin:$PATH";} - save_env -} - - -proc teardown {} { - assert_env_unmodified - assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} -} - - -setup - - -assert_complete "00:00:00:00:00:00 11:11:11:11:11:11 22:22:22:22:22:22 33:33:33:33:33:33" "wol " - - -sync_after_int - - -assert_complete "00:00:00:00:00:00" "wol 00:" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/write.exp b/test/lib/completions/write.exp deleted file mode 100644 index 4503f6cc..00000000 --- a/test/lib/completions/write.exp +++ /dev/null @@ -1,19 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -# "r": root -assert_complete_any "write r" -sync_after_int - - -teardown diff --git a/test/lib/completions/wsimport.exp b/test/lib/completions/wsimport.exp deleted file mode 100644 index 36bf35c1..00000000 --- a/test/lib/completions/wsimport.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "wsimport " -sync_after_int - - -teardown diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp deleted file mode 100644 index 0080967c..00000000 --- a/test/lib/completions/wtf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "wtf A" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/wvdial.exp b/test/lib/completions/wvdial.exp deleted file mode 100644 index 5b52daa8..00000000 --- a/test/lib/completions/wvdial.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "wvdial -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xdg-mime.exp b/test/lib/completions/xdg-mime.exp deleted file mode 100644 index 015c586e..00000000 --- a/test/lib/completions/xdg-mime.exp +++ /dev/null @@ -1,39 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xdg-mime " -sync_after_int - -assert_complete_any "xdg-mime -" -sync_after_int - -assert_complete_any "xdg-mime query " -sync_after_int - -assert_complete_any "xdg-mime query filetype " -sync_after_int - -assert_complete_any "xdg-mime query default " -sync_after_int - -assert_complete_any "xdg-mime default foo.desktop " -sync_after_int - -assert_complete_any "xdg-mime install --mode " -sync_after_int - -assert_complete_any "xdg-mime uninstall " -sync_after_int - - -teardown diff --git a/test/lib/completions/xdg-settings.exp b/test/lib/completions/xdg-settings.exp deleted file mode 100644 index 99a5838d..00000000 --- a/test/lib/completions/xdg-settings.exp +++ /dev/null @@ -1,24 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xdg-settings " -sync_after_int - -assert_complete_any "xdg-settings --" -sync_after_int - -assert_complete_any "xdg-settings get " -sync_after_int - - -teardown diff --git a/test/lib/completions/xfreerdp.exp b/test/lib/completions/xfreerdp.exp deleted file mode 100644 index f61cfcad..00000000 --- a/test/lib/completions/xfreerdp.exp +++ /dev/null @@ -1,28 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "Tab should complete options" -set cmd "xfreerdp --" -send "$cmd\t" -set expected "^$cmd\r\n--data.*--kbd-list.*--plugin\r\n/@$cmd$" -expect { - -re $expected { pass "$test" } - -re /@ { unresolved "$test at prompt" } - default { unresolved "$test" } -} - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xgamma.exp b/test/lib/completions/xgamma.exp deleted file mode 100644 index c4c2228e..00000000 --- a/test/lib/completions/xgamma.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "-gam<TAB> should complete \"-gamma\"" -assert_complete "-gamma" "xgamma -gam" $test - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xm.exp b/test/lib/completions/xm.exp deleted file mode 100644 index 5a0c58e0..00000000 --- a/test/lib/completions/xm.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xm " -sync_after_int - - -teardown diff --git a/test/lib/completions/xmllint.exp b/test/lib/completions/xmllint.exp deleted file mode 100644 index 20daab6d..00000000 --- a/test/lib/completions/xmllint.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xmllint " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xmlwf.exp b/test/lib/completions/xmlwf.exp deleted file mode 100644 index 6c306f34..00000000 --- a/test/lib/completions/xmlwf.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xmlwf " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xmms.exp b/test/lib/completions/xmms.exp deleted file mode 100644 index 1f1f6d57..00000000 --- a/test/lib/completions/xmms.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xmms --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xmodmap.exp b/test/lib/completions/xmodmap.exp deleted file mode 100644 index 2bf4da1c..00000000 --- a/test/lib/completions/xmodmap.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xmodmap " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xpovray.exp b/test/lib/completions/xpovray.exp deleted file mode 100644 index 53a5fcd0..00000000 --- a/test/lib/completions/xpovray.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xpovray " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp deleted file mode 100644 index e76a5665..00000000 --- a/test/lib/completions/xrandr.exp +++ /dev/null @@ -1,21 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xrandr " -sync_after_int - -assert_no_complete "xrandr --mode " -sync_after_int - - -teardown diff --git a/test/lib/completions/xrdb.exp b/test/lib/completions/xrdb.exp deleted file mode 100644 index f02625dc..00000000 --- a/test/lib/completions/xrdb.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xrdb " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xsltproc.exp b/test/lib/completions/xsltproc.exp deleted file mode 100644 index 2c558ff1..00000000 --- a/test/lib/completions/xsltproc.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xsltproc " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp deleted file mode 100644 index 6432ed25..00000000 --- a/test/lib/completions/xvnc4viewer.exp +++ /dev/null @@ -1,45 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -set test "Tab should complete options" -set options { - -AcceptClipboard -AutoSelect -DebugDelay -display - -DotWhenNoCursor -FullColor -FullColour -FullScreen - -geometry -help -listen -Log - -LowColourLevel -MenuKey -name -Parent - -passwd -PasswordFile -PointerEventInterval -PreferredEncoding - -SendClipboard -SendPrimary -Shared -UseLocalCursor - -via -ViewOnly -WMDecorationHeight -WMDecorationWidth - -ZlibLevel -} -assert_complete $options {vncviewer -} $test - - -sync_after_int - - -set expected {hextile raw zrle} -assert_complete $expected "xvnc4viewer -PreferredEncoding " - - -sync_after_int - - -set expected {hextile raw zrle} -assert_complete $expected "xvnc4viewer --preferredencoding " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/xxd.exp b/test/lib/completions/xxd.exp deleted file mode 100644 index 6f12c0c0..00000000 --- a/test/lib/completions/xxd.exp +++ /dev/null @@ -1,18 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xxd " -sync_after_int - - -teardown diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp deleted file mode 100644 index ba9ccd3a..00000000 --- a/test/lib/completions/xz.exp +++ /dev/null @@ -1,37 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified {/OLDPWD=/d} -} - - -setup - - -assert_complete_any "xz " - - -sync_after_int - - -assert_complete_dir "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \ - "xz -d " $::srcdir/fixtures/xz - - -sync_after_int - - -assert_complete_dir "a/ bashcomp.tar" "xz " $::srcdir/fixtures/xz - - -sync_after_int - - -assert_complete_homedir "xz" -sync_after_int - - -teardown diff --git a/test/lib/completions/xzdec.exp b/test/lib/completions/xzdec.exp deleted file mode 100644 index 578cba7d..00000000 --- a/test/lib/completions/xzdec.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "xzdec " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ypcat.exp b/test/lib/completions/ypcat.exp deleted file mode 100644 index a8249dc2..00000000 --- a/test/lib/completions/ypcat.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ypcat " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ypmatch.exp b/test/lib/completions/ypmatch.exp deleted file mode 100644 index ac264c18..00000000 --- a/test/lib/completions/ypmatch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "ypmatch foo " - - -sync_after_int - - -teardown diff --git a/test/lib/completions/yum-arch.exp b/test/lib/completions/yum-arch.exp deleted file mode 100644 index 85c47c22..00000000 --- a/test/lib/completions/yum-arch.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "yum-arch -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/yum.exp b/test/lib/completions/yum.exp deleted file mode 100644 index 899ecddb..00000000 --- a/test/lib/completions/yum.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "yum -" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp deleted file mode 100644 index 8e17e92b..00000000 --- a/test/lib/completions/zopfli.exp +++ /dev/null @@ -1,22 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "zopfli " -sync_after_int - - -assert_complete_homedir "zopfli" -sync_after_int - - -teardown diff --git a/test/lib/completions/zopflipng.exp b/test/lib/completions/zopflipng.exp deleted file mode 100644 index 9c421a14..00000000 --- a/test/lib/completions/zopflipng.exp +++ /dev/null @@ -1,18 +0,0 @@ -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 9321c5ca..899d74b6 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -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 { @@ -508,39 +508,6 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} { } -# Make sure the specified command executed from within Tcl/Expect. -# Fail the test with status UNSUPPORTED if Tcl fails with error "POSIX/ENOENT -# (No such file or directory)", or with the given Tcl failure status command -# (default "unresolved") if other error occurs. -# NOTE: Further tests are assumed if executing the command is successful. The -# test isn't immediately declared to have PASSED if the command is -# executed successful. -# @param string $command -# @param string $stdout (optional) Reference to variable to hold stdout. -# @param string $test (optional) Test title -# @param string $failcmd (optional, default "unresolved") Failure command -# @see assert_bash_exec() -proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} { - if {$test == ""} {set test "$cmd should execute successfully"} - upvar $stdout results - set status [catch {eval exec $cmd} results] - if {$status == 0} { - set result true - } else { - set result false - # Command not found (POSIX/ENOENT = no such file or directory)? - if {[lindex $::errorCode 0] == "POSIX" && [lindex $::errorCode 1] == "ENOENT"} { - # Yes, command not found; - # Indicate test is unsupported - unsupported "$test" - } else { - $failcmd "$test" - } - } - return $result -} - - # Check that no completion is attempted on a certain command. # Params: # @cmd The command to attempt to complete. @@ -584,24 +551,6 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} { } -# Check that ~part completes to ~full/ if home dir exists. -# @param string $cmd The command to attempt home dir completion for. -# @param string $test Optional parameter with test name. -# @param string $prompt (optional) Bash prompt. Default is "/@" -proc assert_complete_homedir {{cmd} {test ""} {prompt /@}} { - if {[string length $test] == 0} { - set test "$cmd should complete ~part to ~full/ if home dir exists" - } - assert_bash_exec {for u in $(compgen -u); do \ - eval test -d ~$u && echo $u; unset u; done} {} /@ users - if {![find_unique_completion_pair $users part full]} { - untested "Not running, no suitable test user found: $test" - } else { - assert_complete "~$full/" "$cmd ~$part" $test -nospace - } -} - - # Source/run file with additional tests if completion for the specified command # is installed in bash, and the command is available. # @param string $command Command to check completion availability for. @@ -680,26 +629,6 @@ proc get_hosts_avahi {} { } -# Get signals -# This function is written in analogy to the bash function `_signals()' in -# `bash_completion'. -# @param prefix -# @return list Signals starting with `SIG', but with the `SIG' prefix removed. -proc get_signals {{prefix ""}} { - set signals {} - foreach signal [exec bash -c {compgen -A signal}] { - # Does signal start with `SIG'? - if {[string range $signal 0 [expr [string length "SIG"] - 1]] == "SIG"} { - # Remove `SIG' prefix - set signal [string range $signal 3 end] - # Add signal (with dash (-) prefix) to list - lappend signals $prefix$signal - } - } - return $signals -} - - # Initialize tcl globals with bash variables proc init_tcl_bash_globals {} { global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS LC_CTYPE @@ -717,7 +646,7 @@ proc init_tcl_bash_globals {} { # @return boolean True (1) if completion is installed, False (0) if not. proc assert_install_completion_for {command} { set test "$command should have completion installed in bash" - set cmd "__load_completion $command ; 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 { @@ -811,27 +740,6 @@ proc match_items {items {args {}}} { } - -# Get real command. -# - arg: $1 Command -# - return: Command found, empty string if not found -proc realcommand {cmd} { - set result "" - if [string length [set path [auto_execok $cmd]]] { - if {[string length [auto_execok realpath]]} { - set result [exec realpath $path] - } elseif {[string length [auto_execok greadlink]]} { - set result [exec greadlink -f $path] - } elseif {[string length [auto_execok readlink]]} { - set result [exec readlink -f $path] - } else { - set result $path - } - } - return $result -} - - # Generate filename to save environment to. # @param string $file File-basename to save environment to. If the file has a # `.exp' suffix, it is removed. E.g.: @@ -1043,10 +951,11 @@ proc start_interactive_test {} { init_bash_xtrace } global OPT_BUFFER_SIZE - if {[info exists OPT_BUFFER_SIZE]} { - verbose "Changing default expect match buffer size to $OPT_BUFFER_SIZE" - match_max $OPT_BUFFER_SIZE + if {![info exists OPT_BUFFER_SIZE]} { + set OPT_BUFFER_SIZE 20000 } + verbose "Changing default expect match buffer size to $OPT_BUFFER_SIZE" + match_max $OPT_BUFFER_SIZE global OPT_TIMEOUT if {[info exists OPT_TIMEOUT]} { global timeout diff --git a/test/lib/library.sh b/test/lib/library.sh index 0a671595..ed5a85d4 100644 --- a/test/lib/library.sh +++ b/test/lib/library.sh @@ -2,7 +2,6 @@ # @param $1 Char to add to $COMP_WORDBREAKS -# @see remove_comp_wordbreak_char() add_comp_wordbreak_char() { [[ "${COMP_WORDBREAKS//[^$1]}" ]] || COMP_WORDBREAKS+=$1 } # add_comp_wordbreak_char() @@ -37,30 +36,3 @@ echo_array() { local name=$1[@] printf "%s\n" "${!name}" | sort } # echo_array() - - -# Check if current bash version meets specified minimum -# @param $1 (integer) Major version number -# @param $2 (integer) Minor version number -# @param $3 (integer) Patch level -# @return 0 if success, > 0 if not -is_bash_version_minimal() { - [[ ( - ${BASH_VERSINFO[0]} -gt $1 - ) || ( - ${BASH_VERSINFO[0]} -eq $1 && - ${BASH_VERSINFO[1]} -gt $2 - ) || ( - ${BASH_VERSINFO[0]} -eq $1 && - ${BASH_VERSINFO[1]} -eq $2 && - ${BASH_VERSINFO[2]} -ge $3 - ) - ]] -} # is_bash_version_minimal() - - -# @param $1 Char to remove from $COMP_WORDBREAKS -# @see add_comp_wordbreak_char() -remove_comp_wordbreak_char() { - COMP_WORDBREAKS=${COMP_WORDBREAKS//$1} -} # remove_comp_wordbreak_char() diff --git a/test/log/.gitignore b/test/log/.gitignore deleted file mode 100644 index 72e8ffc0..00000000 --- a/test/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/test/requirements.txt b/test/requirements.txt new file mode 100644 index 00000000..23ced801 --- /dev/null +++ b/test/requirements.txt @@ -0,0 +1,5 @@ +black>=19.3b0 +pexpect>=4 +pytest>=3.5 +pytest-xdist +typing;python_version<"3.5" @@ -10,7 +10,7 @@ usage() { echo echo "Interesting options:" echo " --tool_exec= Test against a different bash executable." - echo " --buffer_size Change expect match buffer size from the default of 2000 bytes." + echo " --buffer-size Change expect match buffer size from our default of 20000 bytes." 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." diff --git a/test/run-shellcheck b/test/run-shellcheck new file mode 100755 index 00000000..cae7b809 --- /dev/null +++ b/test/run-shellcheck @@ -0,0 +1,4 @@ +#!/bin/sh -eu +cd "$(dirname $0)/.." +exec docker run --network none -tv "$PWD:/mnt:ro" \ + koalaman/shellcheck -S error "$@" diff --git a/test/runLint b/test/runLint index 2db8f358..8699d7a0 100755 --- a/test/runLint +++ b/test/runLint @@ -5,7 +5,7 @@ gitgrep() local out=$(git grep -I -P -n "$1" | \ grep -E '^(bash_completion|completions/|test/)' | \ grep -Fv 'test/runLint') - if [ -n "$out" ] ; then + if [ -n "$out" ]; then printf '***** %s\n' "$2" printf '%s\n\n' "$out" fi @@ -43,3 +43,5 @@ gitgrep $cmdstart'[ef]grep\b' \ gitgrep '(?<!command)'$cmdstart'(grep|ls|sed)(\s|$)' \ 'invoke grep, ls, and sed through "command", e.g. "command grep"' + +gitgrep '<<<' 'herestrings use temp files, use some other way' diff --git a/test/t/Makefile.am b/test/t/Makefile.am new file mode 100644 index 00000000..fb7665f1 --- /dev/null +++ b/test/t/Makefile.am @@ -0,0 +1,680 @@ +SUBDIRS = unit + +EXTRA_DIST = \ + conftest.py \ + test_2to3.py \ + test_7z.py \ + test_a2ps.py \ + test_a2x.py \ + test_abook.py \ + test_aclocal.py \ + test_acpi.py \ + test_acroread.py \ + test_adb.py \ + test_add_members.py \ + test_alias.py \ + test_alpine.py \ + test_animate.py \ + test_ant.py \ + test_apache2ctl.py \ + test_appdata_validate.py \ + test_apt_build.py \ + test_apt_cache.py \ + test_apt_get.py \ + test_aptitude.py \ + test_arch.py \ + test_arp.py \ + test_arping.py \ + test_arpspoof.py \ + test_asciidoc.py \ + test_aspell.py \ + test_autoconf.py \ + test_autoheader.py \ + test_automake.py \ + test_autoreconf.py \ + test_autorpm.py \ + test_autoscan.py \ + test_autoupdate.py \ + test_avctrl.py \ + test_awk.py \ + test_badblocks.py \ + test_base64.py \ + test_bash.py \ + test_bc.py \ + test_bind.py \ + test_bison.py \ + test_bk.py \ + test_brctl.py \ + test_btdownloadcurses_py.py \ + test_btdownloadgui_py.py \ + test_btdownloadheadless_py.py \ + test_bts.py \ + test_bzip2.py \ + test_cal.py \ + test_cancel.py \ + test_cardctl.py \ + test_cat.py \ + test_cc.py \ + test_ccache.py \ + test_ccze.py \ + test_cd.py \ + test_cdrecord.py \ + test_cfagent.py \ + test_cfrun.py \ + test_chage.py \ + test_change_pw.py \ + test_check_db.py \ + test_check_perms.py \ + test_checksec.py \ + test_chfn.py \ + test_chgrp.py \ + test_chkconfig.py \ + test_chmod.py \ + test_chown.py \ + test_chpasswd.py \ + test_chromium_browser.py \ + test_chronyc.py \ + test_chroot.py \ + test_chrpath.py \ + test_chsh.py \ + test_ci.py \ + test_ciptool.py \ + test_civclient.py \ + test_civserver.py \ + test_cksfv.py \ + test_cleanarch.py \ + test_clisp.py \ + test_clone_member.py \ + test_co.py \ + test_compare.py \ + test_complete.py \ + test_composite.py \ + test_config_list.py \ + test_configure.py \ + test_conjure.py \ + test_convert.py \ + test_cowsay.py \ + test_cp.py \ + test_cpan2dist.py \ + test_cpio.py \ + test_cplusplus.py \ + test_cppcheck.py \ + test_createdb.py \ + test_createuser.py \ + test_crontab.py \ + test_cryptsetup.py \ + test_csplit.py \ + test_curl.py \ + test_cut.py \ + test_cvs.py \ + test_cvsps.py \ + test_date.py \ + test_dcop.py \ + test_dd.py \ + test_declare.py \ + test_deja_dup.py \ + test_desktop_file_validate.py \ + test_df.py \ + test_dfutool.py \ + test_dhclient.py \ + test_dict.py \ + test_diff.py \ + test_dir.py \ + test_display.py \ + test_dmesg.py \ + test_dnssec_keygen.py \ + test_dnsspoof.py \ + test_dot.py \ + test_dpkg.py \ + test_dpkg_deb.py \ + test_dpkg_reconfigure.py \ + test_dpkg_source.py \ + test_dropdb.py \ + test_dropuser.py \ + test_dselect.py \ + test_dsniff.py \ + test_du.py \ + test_dumpdb.py \ + test_dumpe2fs.py \ + test_e2freefrag.py \ + test_e2label.py \ + test_ebtables.py \ + test_ecryptfs_migrate_home.py \ + test_eject.py \ + test_enscript.py \ + test_env.py \ + test_eog.py \ + test_ether_wake.py \ + test_etherwake.py \ + test_evince.py \ + test_expand.py \ + test_explodepkg.py \ + test_export.py \ + test_faillog.py \ + test_fbgs.py \ + test_fbi.py \ + test_feh.py \ + test_file.py \ + test_file_roller.py \ + test_filefrag.py \ + test_filesnarf.py \ + test_find.py \ + test_find_member.py \ + test_finger.py \ + test_fio.py \ + test_firefox.py \ + test_flake8.py \ + test_fmt.py \ + test_fold.py \ + test_freebsd_update.py \ + test_freeciv.py \ + test_freeciv_server.py \ + test_function.py \ + test_fusermount.py \ + test_g4.py \ + test_g77.py \ + test_gcc.py \ + test_gcj.py \ + test_gcl.py \ + test_gdb.py \ + test_genaliases.py \ + test_gendiff.py \ + test_genisoimage.py \ + test_geoiplookup.py \ + test_getconf.py \ + test_getent.py \ + test_gkrellm.py \ + test_gm.py \ + test_gmplayer.py \ + test_gnatmake.py \ + test_gnokii.py \ + test_gnome_mplayer.py \ + test_gnome_screenshot.py \ + test_gpasswd.py \ + test_gpc.py \ + test_gperf.py \ + test_gpg.py \ + test_gpg2.py \ + test_gpgv.py \ + test_gphoto2.py \ + test_gplusplus.py \ + test_gprof.py \ + test_grep.py \ + test_groupadd.py \ + test_groupdel.py \ + test_groupmems.py \ + test_groupmod.py \ + test_growisofs.py \ + test_grpck.py \ + test_grub.py \ + test_gzip.py \ + test_hciattach.py \ + test_hciconfig.py \ + test_hcitool.py \ + test_hddtemp.py \ + test_head.py \ + test_hexdump.py \ + test_hid2hci.py \ + test_host.py \ + test_hostname.py \ + test_hping2.py \ + test_hping3.py \ + test_htop.py \ + test_htpasswd.py \ + test_hunspell.py \ + test_hwclock.py \ + test_iconv.py \ + test_id.py \ + test_identify.py \ + test_idn.py \ + test_ifdown.py \ + test_ifstat.py \ + test_iftop.py \ + test_ifup.py \ + test_import.py \ + test_info.py \ + test_inject.py \ + test_inotifywait.py \ + test_inotifywatch.py \ + test_insmod.py \ + test_installpkg.py \ + test_interdiff.py \ + test_invoke_rc_d.py \ + test_ionice.py \ + test_ip.py \ + test_iperf.py \ + test_ipmitool.py \ + test_ipsec.py \ + test_iptables.py \ + test_ipv6calc.py \ + test_irb.py \ + test_iscsiadm.py \ + test_isort.py \ + test_isql.py \ + test_iwconfig.py \ + test_iwlist.py \ + test_iwpriv.py \ + test_iwspy.py \ + test_jar.py \ + test_jarsigner.py \ + test_java.py \ + test_javac.py \ + test_javadoc.py \ + test_javaws.py \ + test_jpegoptim.py \ + test_jps.py \ + test_jq.py \ + test_jshint.py \ + test_json_xs.py \ + test_jsonschema.py \ + test_k3b.py \ + test_kcov.py \ + test_kdvi.py \ + test_kill.py \ + test_killall.py \ + test_kldload.py \ + test_kldunload.py \ + test_koji.py \ + test_kpdf.py \ + test_kplayer.py \ + test_ktutil.py \ + test_l2ping.py \ + test_larch.py \ + test_lastlog.py \ + test_ld.py \ + test_ldapadd.py \ + test_ldapcompare.py \ + test_ldapdelete.py \ + test_ldapmodrdn.py \ + test_ldappasswd.py \ + test_ldapsearch.py \ + test_ldapvi.py \ + test_ldapwhoami.py \ + test_ldd.py \ + test_less.py \ + test_lftp.py \ + test_lftpget.py \ + test_lilo.py \ + test_links.py \ + test_lintian.py \ + test_lintian_info.py \ + test_lisp.py \ + test_list_admins.py \ + test_list_lists.py \ + test_list_members.py \ + test_list_owners.py \ + test_ln.py \ + test_locale_gen.py \ + test_look.py \ + test_lpq.py \ + test_lpr.py \ + test_lrzip.py \ + test_ls.py \ + test_lsof.py \ + test_lspci.py \ + test_lsscsi.py \ + test_lsusb.py \ + test_lua.py \ + test_luac.py \ + test_luseradd.py \ + test_luserdel.py \ + test_lusermod.py \ + test_lvchange.py \ + test_lvcreate.py \ + test_lvdisplay.py \ + test_lvextend.py \ + test_lvm.py \ + test_lvmdiskscan.py \ + test_lvreduce.py \ + test_lvremove.py \ + test_lvrename.py \ + test_lvresize.py \ + test_lvs.py \ + test_lvscan.py \ + test_lz4.py \ + test_lzip.py \ + test_lzma.py \ + test_lzop.py \ + test_m4.py \ + test_macof.py \ + test_mailmanctl.py \ + test_mailsnarf.py \ + test_make.py \ + test_makepkg.py \ + test_man.py \ + test_mc.py \ + test_mcrypt.py \ + test_md5sum.py \ + test_mdadm.py \ + test_mdecrypt.py \ + test_mdtool.py \ + test_medusa.py \ + test_mencoder.py \ + test_mii_diag.py \ + test_mii_tool.py \ + test_minicom.py \ + test_mkdir.py \ + test_mkfifo.py \ + test_mkinitrd.py \ + test_mkisofs.py \ + test_mknod.py \ + test_mktemp.py \ + test_mmsitepass.py \ + test_mock.py \ + test_modinfo.py \ + test_modprobe.py \ + test_module.py \ + test_mogrify.py \ + test_monodevelop.py \ + test_montage.py \ + test_mount.py \ + test_mplayer.py \ + test_mr.py \ + test_msgsnarf.py \ + test_msynctool.py \ + test_mtx.py \ + test_munin_node_configure.py \ + test_munin_run.py \ + test_munindoc.py \ + test_mussh.py \ + test_mutt.py \ + test_muttng.py \ + test_mv.py \ + test_mypy.py \ + test_mysql.py \ + test_mysqladmin.py \ + test_nc.py \ + test_ncftp.py \ + test_nethogs.py \ + test_netstat.py \ + test_newgrp.py \ + test_newlist.py \ + test_newusers.py \ + test_ngrep.py \ + test_nl.py \ + test_nm.py \ + test_nmap.py \ + test_nmcli.py \ + test_nproc.py \ + test_nslookup.py \ + test_nsupdate.py \ + test_ntpdate.py \ + test_objcopy.py \ + test_objdump.py \ + test_od.py \ + test_oggdec.py \ + test_op.py \ + test_openssl.py \ + test_opera.py \ + test_optipng.py \ + test_p4.py \ + test_pack200.py \ + test_passwd.py \ + test_paste.py \ + test_patch.py \ + test_pdftotext.py \ + test_perl.py \ + test_perlcritic.py \ + test_perldoc.py \ + test_perltidy.py \ + test_pgrep.py \ + test_phing.py \ + test_pidof.py \ + test_pine.py \ + test_pinfo.py \ + test_ping.py \ + test_pkg_config.py \ + test_pkg_deinstall.py \ + test_pkg_delete.py \ + test_pkg_get.py \ + test_pkg_info.py \ + test_pkgadd.py \ + test_pkgrm.py \ + test_pkgtool.py \ + test_pkgutil.py \ + test_pkill.py \ + test_plague_client.py \ + test_pm_hibernate.py \ + test_pm_is_supported.py \ + test_pm_powersave.py \ + test_pngfix.py \ + test_portinstall.py \ + test_portsnap.py \ + test_portupgrade.py \ + test_postcat.py \ + test_postconf.py \ + test_postfix.py \ + test_postmap.py \ + test_postsuper.py \ + test_povray.py \ + test_pr.py \ + test_prelink.py \ + test_protoc.py \ + test_psql.py \ + test_ptx.py \ + test_puppet.py \ + test_pushd.py \ + test_pv.py \ + test_pvchange.py \ + test_pvcreate.py \ + test_pvdisplay.py \ + test_pvmove.py \ + test_pvremove.py \ + test_pvs.py \ + test_pvscan.py \ + test_pwck.py \ + test_pwd.py \ + test_pwdx.py \ + test_pwgen.py \ + test_pycodestyle.py \ + test_pydoc.py \ + test_pydocstyle.py \ + test_pyflakes.py \ + test_pylint.py \ + test_pylint_3.py \ + test_pytest.py \ + test_python.py \ + test_python3.py \ + test_pyvenv.py \ + test_qemu.py \ + test_qrunner.py \ + test_querybts.py \ + test_quota.py \ + test_quotacheck.py \ + test_quotaon.py \ + test_radvdump.py \ + test_rcs.py \ + test_rcsdiff.py \ + test_rdesktop.py \ + test_rdict.py \ + test_readelf.py \ + test_readonly.py \ + test_remove_members.py \ + test_removepkg.py \ + test_renice.py \ + test_repomanage.py \ + test_reportbug.py \ + test_reptyr.py \ + test_resolvconf.py \ + test_rfcomm.py \ + test_rfkill.py \ + test_ri.py \ + test_rlog.py \ + test_rm.py \ + test_rmdir.py \ + test_rmlist.py \ + test_rmmod.py \ + test_route.py \ + test_rpcdebug.py \ + test_rpm.py \ + test_rpm2tgz.py \ + test_rpmbuild.py \ + test_rrdtool.py \ + test_rsync.py \ + test_rtcwake.py \ + test_runuser.py \ + test_sbcl.py \ + test_sbcl_mt.py \ + test_sbopkg.py \ + test_screen.py \ + test_scrub.py \ + test_sdptool.py \ + test_sed.py \ + test_seq.py \ + test_service.py \ + test_set.py \ + test_setquota.py \ + test_sftp.py \ + test_sh.py \ + test_sha1sum.py \ + test_shar.py \ + test_shellcheck.py \ + test_sitecopy.py \ + test_slackpkg.py \ + test_slapt_get.py \ + test_slapt_src.py \ + test_smartctl.py \ + test_smbcacls.py \ + test_smbclient.py \ + test_smbcquotas.py \ + test_smbget.py \ + test_smbpasswd.py \ + test_smbtar.py \ + test_smbtree.py \ + test_snownews.py \ + test_sort.py \ + test_split.py \ + test_spovray.py \ + test_sqlite3.py \ + test_ss.py \ + test_ssh.py \ + test_ssh_add.py \ + test_ssh_copy_id.py \ + test_ssh_keygen.py \ + test_sshfs.py \ + test_sshmitm.py \ + test_sshow.py \ + test_strace.py \ + test_stream.py \ + test_strings.py \ + test_strip.py \ + test_su.py \ + test_sudo.py \ + test_svcadm.py \ + test_svk.py \ + test_svn.py \ + test_svnadmin.py \ + test_svnlook.py \ + test_sync_members.py \ + test_synclient.py \ + test_sysbench.py \ + test_sysctl.py \ + test_tac.py \ + test_tail.py \ + test_tar.py \ + test_tcpdump.py \ + test_tcpkill.py \ + test_tcpnice.py \ + test_tee.py \ + test_texindex.py \ + test_tightvncviewer.py \ + test_time.py \ + test_timeout.py \ + test_tipc.py \ + test_touch.py \ + test_tox.py \ + test_tr.py \ + test_tracepath.py \ + test_tshark.py \ + test_tune2fs.py \ + test_udevadm.py \ + test_ulimit.py \ + test_umount.py \ + test_unace.py \ + test_uname.py \ + test_unexpand.py \ + test_uniq.py \ + test_units.py \ + test_unpack200.py \ + test_unrar.py \ + test_unset.py \ + test_unshunt.py \ + test_update_alternatives.py \ + test_update_rc_d.py \ + test_upgradepkg.py \ + test_urlsnarf.py \ + test_uscan.py \ + test_useradd.py \ + test_userdel.py \ + test_usermod.py \ + test_valgrind.py \ + test_vdir.py \ + test_vgcfgbackup.py \ + test_vgcfgrestore.py \ + test_vgchange.py \ + test_vgck.py \ + test_vgconvert.py \ + test_vgcreate.py \ + test_vgdisplay.py \ + test_vgexport.py \ + test_vgextend.py \ + test_vgimport.py \ + test_vgmerge.py \ + test_vgmknodes.py \ + test_vgreduce.py \ + test_vgremove.py \ + test_vgrename.py \ + test_vgs.py \ + test_vgscan.py \ + test_vgsplit.py \ + test_vi.py \ + test_vipw.py \ + test_vmstat.py \ + test_vncviewer.py \ + test_vpnc.py \ + test_watch.py \ + test_wc.py \ + test_webmitm.py \ + test_wget.py \ + test_who.py \ + test_wine.py \ + test_withlist.py \ + test_wodim.py \ + test_wol.py \ + test_write.py \ + test_wsimport.py \ + test_wtf.py \ + test_wvdial.py \ + test_xdg_mime.py \ + test_xdg_settings.py \ + test_xfreerdp.py \ + test_xgamma.py \ + test_xm.py \ + test_xmllint.py \ + test_xmlwf.py \ + test_xmms.py \ + test_xmodmap.py \ + test_xpovray.py \ + test_xrandr.py \ + test_xrdb.py \ + test_xsltproc.py \ + test_xvnc4viewer.py \ + test_xxd.py \ + test_xz.py \ + test_xzdec.py \ + test_ypcat.py \ + test_ypmatch.py \ + test_yum.py \ + test_yum_arch.py \ + test_zopfli.py \ + test_zopflipng.py + +all: + +PYTEST = pytest + +check-local: + $(PYTEST) $(PYTESTFLAGS) $(srcdir) + +clean-local: + $(RM) -R __pycache__ diff --git a/test/t/conftest.py b/test/t/conftest.py new file mode 100644 index 00000000..0969a313 --- /dev/null +++ b/test/t/conftest.py @@ -0,0 +1,461 @@ +import difflib +import os +import re +import shlex +from typing import Iterable, List, Optional, Tuple, Union + +import pexpect +import pytest + + +PS1 = "/@" +MAGIC_MARK = "__MaGiC-maRKz!__" + + +def find_unique_completion_pair( + items: Iterable[str] +) -> Optional[Tuple[str, str]]: + result = None + bestscore = 0 + sitems = sorted(set(items)) + for i in range(len(sitems)): + cur = sitems[i] + curlen = len(cur) + prv = sitems[i - 1] if i != 0 else "" + prvlen = len(prv) + nxt = sitems[i + 1] if i < len(sitems) - 1 else "" + nxtlen = len(nxt) + diffprv = prv == "" + diffnxt = nxt == "" + # Analyse each item of the list and look for the minimum length of the + # partial prefix which is distinct from both nxt and prv. The list + # is sorted so the prefix will be unique in the entire list. + for j in range(curlen): + curchar = cur[j] + if not diffprv and (j >= prvlen or prv[j] != curchar): + diffprv = True + if not diffnxt and (j >= nxtlen or nxt[j] != curchar): + diffnxt = True + if diffprv and diffnxt: + break + # At the end of the loop, j is the index of last character of + # the unique partial prefix. The length is one plus that. + parlen = j + 1 + if parlen >= curlen: + continue + # Try to find the most "readable pair"; look for a long pair where + # part is about half of full. + if parlen < curlen / 2: + parlen = int(curlen / 2) + score = curlen - parlen + if score > bestscore: + bestscore = score + result = (cur[:parlen], cur) + return result + + +@pytest.fixture(scope="class") +def part_full_user(bash: pexpect.spawn) -> Optional[Tuple[str, str]]: + res = ( + assert_bash_exec(bash, "compgen -u", want_output=True).strip().split() + ) + pair = find_unique_completion_pair(res) + if not pair: + pytest.skip("No suitable test user found") + return pair + + +@pytest.fixture(scope="class") +def part_full_group(bash: pexpect.spawn) -> Optional[Tuple[str, str]]: + res = ( + assert_bash_exec(bash, "compgen -g", want_output=True).strip().split() + ) + pair = find_unique_completion_pair(res) + if not pair: + pytest.skip("No suitable test user found") + return pair + + +@pytest.fixture(scope="class") +def bash(request) -> pexpect.spawn: + + logfile = None + if os.environ.get("BASHCOMP_TEST_LOGFILE"): + logfile = open(os.environ.get("BASHCOMP_TEST_LOGFILE"), "w") + testdir = os.path.abspath( + os.path.join(os.path.dirname(__file__), os.pardir) + ) + env = os.environ.copy() + env.update( + dict( + SRCDIR=testdir, # TODO needed at least by bashrc + SRCDIRABS=testdir, # TODO needed? + PS1=PS1, + INPUTRC="%s/config/inputrc" % testdir, + TERM="dumb", + BASH_COMPLETION_COMPAT_DIR="%s/fixtures/shared/empty_dir" + % testdir, + LC_COLLATE="C", # to match Python's default locale unaware sort + ) + ) + + fixturesdir = os.path.join(testdir, "fixtures") + os.chdir(fixturesdir) + + # Start bash + bash = pexpect.spawn( + "%s --norc" % os.environ.get("BASHCOMP_TEST_BASH", "bash"), + maxread=os.environ.get("BASHCOMP_TEST_PEXPECT_MAXREAD", 20000), + logfile=logfile, + cwd=fixturesdir, + env=env, + encoding="utf-8", # TODO? or native or...? + # FIXME: Tests shouldn't depend on dimensions, but it's difficult to + # expect robustly enough for Bash to wrap lines anywhere (e.g. inside + # MAGIC_MARK). Increase window width to reduce wrapping. + dimensions=(24, 160), + # TODO? codec_errors="replace", + ) + bash.expect_exact(PS1) + + # Load bashrc and bash_completion + assert_bash_exec(bash, "source '%s/config/bashrc'" % testdir) + assert_bash_exec(bash, "source '%s/../bash_completion'" % testdir) + + # Use command name from marker if set, or grab from test filename + cmd = None + cmd_found = False + marker = request.node.get_closest_marker("bashcomp") + if marker: + cmd = marker.kwargs.get("cmd") + cmd_found = "cmd" in marker.kwargs + # Run pre-test commands, early so they're usable in skipif + for pre_cmd in marker.kwargs.get("pre_cmds", []): + assert_bash_exec(bash, pre_cmd) + # Process skip conditions + skipif = marker.kwargs.get("skipif") + if skipif: + try: + assert_bash_exec(bash, skipif) + except AssertionError: + pass + else: + bash.close() + pytest.skip(skipif) + return + if not cmd_found: + match = re.search( + r"^test_(.+)\.py$", os.path.basename(str(request.fspath)) + ) + if match: + cmd = match.group(1) + + if (cmd_found and cmd is None) or is_testable(bash, cmd): + before_env = get_env(bash) + yield bash + # Not exactly sure why, but some errors leave bash in state where + # getting the env here would fail and trash our test output. So + # reset to a good state first (Ctrl+C, expect prompt). + bash.sendintr() + bash.expect_exact(PS1) + diff_env( + before_env, + get_env(bash), + marker.kwargs.get("ignore_env") if marker else "", + ) + + if marker: + for post_cmd in marker.kwargs.get("post_cmds", []): + assert_bash_exec(bash, post_cmd) + + # Clean up + bash.close() + if logfile: + logfile.close() + + +def is_testable(bash: pexpect.spawn, cmd: str) -> bool: + if not cmd: + pytest.fail("Could not resolve name of command to test") + return False + if not is_bash_type(bash, cmd): + pytest.skip("Command %s not found" % cmd) + return False + if not load_completion_for(bash, cmd): + pytest.skip("No completion for command %s" % cmd) + return False + return True + + +def is_bash_type(bash: pexpect.spawn, cmd: str) -> bool: + typecmd = "type %s &>/dev/null && echo -n 0 || echo -n 1" % cmd + bash.sendline(typecmd) + bash.expect_exact(typecmd + "\r\n") + result = bash.expect_exact(["0", "1"]) == 0 + bash.expect_exact(PS1) + return result + + +def load_completion_for(bash: pexpect.spawn, cmd: str) -> bool: + try: + # Allow __load_completion to fail so we can test completions + # that are directly loaded in bash_completion without a separate file. + assert_bash_exec(bash, "__load_completion %s || :" % cmd) + assert_bash_exec(bash, "complete -p %s &>/dev/null" % cmd) + except AssertionError: + return False + return True + + +def assert_bash_exec( + bash: pexpect.spawn, cmd: str, want_output: bool = False +) -> str: + + # Send command + bash.sendline(cmd) + bash.expect_exact(cmd) + + # Find prompt, output is before it + bash.expect_exact("\r\n" + PS1) + output = bash.before + + # Retrieve exit status + echo = "echo $?" + bash.sendline(echo) + got = bash.expect( + [ + r"^%s\r\n(\d+)\r\n%s" % (re.escape(echo), re.escape(PS1)), + PS1, + pexpect.EOF, + pexpect.TIMEOUT, + ] + ) + status = bash.match.group(1) if got == 0 else "unknown" + + assert status == "0", 'Error running "%s": exit status=%s, output="%s"' % ( + cmd, + status, + output, + ) + if output: + assert want_output, ( + 'Unexpected output from "%s": exit status=%s, output="%s"' + % (cmd, status, output) + ) + else: + assert not want_output, ( + 'Expected output from "%s": exit status=%s, output="%s"' + % (cmd, status, output) + ) + + return output + + +def get_env(bash: pexpect.spawn) -> List[str]: + return ( + assert_bash_exec( + bash, + "{ (set -o posix ; set); declare -F; shopt -p; set -o; }", + want_output=True, + ) + .strip() + .splitlines() + ) + + +def diff_env(before: List[str], after: List[str], ignore: str): + diff = [ + x + for x in difflib.unified_diff(before, after, n=0, lineterm="") + # Remove unified diff markers: + if not re.search(r"^(---|\+\+\+|@@ )", x) + # Ignore variables expected to change: + and not re.search("^[-+](_|PPID|BASH_REMATCH|OLDPWD)=", x) + # Ignore likely completion functions added by us: + and not re.search(r"^\+declare -f _.+", x) + # ...and additional specified things: + and not re.search(ignore or "^$", x) + ] + # For some reason, COMP_WORDBREAKS gets added to the list after + # saving. Remove its changes, and note that it may take two lines. + for i in range(0, len(diff)): + if re.match("^[-+]COMP_WORDBREAKS=", diff[i]): + if i < len(diff) and not re.match(r"^\+[\w]+=", diff[i + 1]): + del diff[i + 1] + del diff[i] + break + assert not diff, "Environment should not be modified" + + +class CompletionResult: + """ + Class to hold completion results. + """ + + def __init__(self, output: str, items: Optional[Iterable[str]] = None): + """ + When items are specified, they are used as the base for comparisons + provided by this class. When not, regular expressions are used instead. + This is because it is not always possible to unambiguously split a + completion output string into individual items, for example when the + items contain whitespace. + + :param output: All completion output as-is. + :param items: Completions as individual items. Should be specified + only in cases where the completions are robustly known to be + exactly the specified ones. + """ + self.output = output + self._items = None if items is None else sorted(items) + + def endswith(self, suffix: str) -> bool: + return self.output.endswith(suffix) + + def __eq__(self, expected: Union[str, Iterable[str]]) -> bool: + """ + Returns True if completion contains expected items, and no others. + + Defining __eq__ this way is quite ugly, but facilitates concise + testing code. + """ + expiter = [expected] if isinstance(expected, str) else sorted(expected) + if self._items is not None: + return self._items == expiter + return bool( + re.match( + r"^\s*" + r"\s+".join(re.escape(x) for x in expiter) + r"\s*$", + self.output, + ) + ) + + def __contains__(self, item: str) -> bool: + if self._items is not None: + return item in self._items + return bool( + re.search(r"(^|\s)%s(\s|$)" % re.escape(item), self.output) + ) + + def __iter__(self) -> Iterable[str]: + """ + Note that iteration over items may not be accurate when items were not + specified to the constructor, if individual items in the output contain + whitespace. In those cases, it errs on the side of possibly returning + more items than there actually are, and intends to never return fewer. + """ + return iter( + self._items + if self._items is not None + else re.split(r" {2,}|\r\n", self.output.strip()) + ) + + def __len__(self) -> int: + """ + Uses __iter__, see caveat in it. While possibly inaccurate, this is + good enough for truthiness checks. + """ + return len(list(iter(self))) + + def __repr__(self) -> str: + return "<CompletionResult %s>" % list(self) + + +def assert_complete( + bash: pexpect.spawn, cmd: str, **kwargs +) -> CompletionResult: + skipif = kwargs.get("skipif") + if skipif: + try: + assert_bash_exec(bash, skipif) + except AssertionError: + pass + else: + pytest.skip(skipif) + return CompletionResult("", []) + cwd = kwargs.get("cwd") + if cwd: + assert_bash_exec(bash, "cd '%s'" % cwd) + env_prefix = "_BASHCOMP_TEST_" + env = kwargs.get("env", {}) + if env: + # Back up environment and apply new one + assert_bash_exec( + bash, + " ".join('%s%s="$%s"' % (env_prefix, k, k) for k in env.keys()), + ) + assert_bash_exec( + bash, + "export %s" % " ".join("%s=%s" % (k, v) for k, v in env.items()), + ) + bash.send(cmd + "\t") + bash.expect_exact(cmd) + bash.send(MAGIC_MARK) + got = bash.expect( + [ + # 0: multiple lines, result in .before + r"\r\n" + re.escape(PS1 + cmd) + ".*" + MAGIC_MARK, + # 1: no completion + r"^" + MAGIC_MARK, + # 2: on same line, result in .match + r"^([^\r]+)%s$" % MAGIC_MARK, + pexpect.EOF, + pexpect.TIMEOUT, + ] + ) + if got == 0: + output = bash.before + if output.endswith(MAGIC_MARK): + output = bash.before[: -len(MAGIC_MARK)] + result = CompletionResult(output) + elif got == 2: + output = bash.match.group(1) + result = CompletionResult(output, [shlex.split(cmd + output)[-1]]) + else: + # TODO: warn about EOF/TIMEOUT? + result = CompletionResult("", []) + bash.sendintr() + bash.expect_exact(PS1) + if env: + # Restore environment, and clean up backup + # TODO: Test with declare -p if a var was set, backup only if yes, and + # similarly restore only backed up vars. Should remove some need + # for ignore_env. + assert_bash_exec( + bash, + "export %s" + % " ".join('%s="$%s%s"' % (k, env_prefix, k) for k in env.keys()), + ) + assert_bash_exec( + bash, + "unset -v %s" + % " ".join("%s%s" % (env_prefix, k) for k in env.keys()), + ) + if cwd: + assert_bash_exec(bash, "cd - >/dev/null") + return result + + +@pytest.fixture +def completion(request, bash: pexpect.spawn) -> CompletionResult: + marker = request.node.get_closest_marker("complete") + if not marker: + return CompletionResult("", []) + for pre_cmd in marker.kwargs.get("pre_cmds", []): + assert_bash_exec(bash, pre_cmd) + return assert_complete(bash, marker.args[0], **marker.kwargs) + + +def in_docker() -> bool: + return os.path.exists("/.dockerenv") + + +class TestUnitBase: + def _test_unit( + self, func, bash, comp_words, comp_cword, comp_line, comp_point, arg="" + ): + assert_bash_exec( + bash, + "COMP_WORDS=%s COMP_CWORD=%d COMP_LINE=%s COMP_POINT=%d" + % (comp_words, comp_cword, shlex.quote(comp_line), comp_point), + ) + output = assert_bash_exec(bash, func % arg, want_output=True) + return output.strip() diff --git a/test/t/test_2to3.py b/test/t/test_2to3.py new file mode 100644 index 00000000..966ed1f5 --- /dev/null +++ b/test/t/test_2to3.py @@ -0,0 +1,7 @@ +import pytest + + +class Test2to3: + @pytest.mark.complete("2to3 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_7z.py b/test/t/test_7z.py new file mode 100644 index 00000000..7d68c7b2 --- /dev/null +++ b/test/t/test_7z.py @@ -0,0 +1,34 @@ +import pytest + + +class Test7z: + @pytest.mark.complete("7z ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("7z a ar -tzi") + def test_2(self, completion): + assert completion == "-tzip" + + @pytest.mark.xfail # TODO: whitespace split issue + @pytest.mark.complete(r"7z x -wa\ ", cwd="_filedir") + def test_3(self, completion): + assert completion == r"-wa\ b/" + assert not completion.endswith(" ") + + @pytest.mark.complete("7z x ", cwd="7z") + def test_4(self, completion): + assert completion == "a.7z" + + @pytest.mark.complete("7z d a.7z ", cwd="7z") + def test_5(self, completion): + assert completion == "abc" + + @pytest.mark.complete("7z a -air@", cwd="7z") + def test_6(self, completion): + assert completion == sorted("-air@a.7z -air@f.txt".split()) + + @pytest.mark.complete("7z a -o") + def test_7(self, completion): + assert "-o7z/" in completion + assert all(x.endswith("/") for x in completion) diff --git a/test/t/test_a2ps.py b/test/t/test_a2ps.py new file mode 100644 index 00000000..9d885461 --- /dev/null +++ b/test/t/test_a2ps.py @@ -0,0 +1,7 @@ +import pytest + + +class TestA2ps: + @pytest.mark.complete("a2ps ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_a2x.py b/test/t/test_a2x.py new file mode 100644 index 00000000..3741e28d --- /dev/null +++ b/test/t/test_a2x.py @@ -0,0 +1,7 @@ +import pytest + + +class TestA2x: + @pytest.mark.complete("a2x ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_abook.py b/test/t/test_abook.py new file mode 100644 index 00000000..1df910cf --- /dev/null +++ b/test/t/test_abook.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAbook: + @pytest.mark.complete("abook -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_aclocal.py b/test/t/test_aclocal.py new file mode 100644 index 00000000..cb3aca1b --- /dev/null +++ b/test/t/test_aclocal.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAclocal: + @pytest.mark.complete("aclocal ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_acpi.py b/test/t/test_acpi.py new file mode 100644 index 00000000..8da4eaf4 --- /dev/null +++ b/test/t/test_acpi.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAcpi: + @pytest.mark.complete("acpi -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_acroread.py b/test/t/test_acroread.py new file mode 100644 index 00000000..471b93c2 --- /dev/null +++ b/test/t/test_acroread.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAcroread: + @pytest.mark.complete("acroread ", cwd="fixtures/acroread") + def test_1(self, completion): + assert completion == "foo.d/ t.pdf".split() diff --git a/test/t/test_adb.py b/test/t/test_adb.py new file mode 100644 index 00000000..081a1047 --- /dev/null +++ b/test/t/test_adb.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAdb: + @pytest.mark.complete("adb ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_add_members.py b/test/t/test_add_members.py new file mode 100644 index 00000000..095a5ded --- /dev/null +++ b/test/t/test_add_members.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAddMembers: + @pytest.mark.complete("add_members -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_alias.py b/test/t/test_alias.py new file mode 100644 index 00000000..da9ecc33 --- /dev/null +++ b/test/t/test_alias.py @@ -0,0 +1,17 @@ +import pytest + + +@pytest.mark.bashcomp( + pre_cmds=("unalias -a", "alias foo=bar", "alias bar='foo foo'"), + post_cmds=("unalias -a",), +) +class TestAlias: + @pytest.mark.complete("alias ") + def test_1(self, completion): + assert completion == "bar foo".split() + + @pytest.mark.xfail # TODO: Would like this completion to work + @pytest.mark.complete("alias foo=") + def test_2(self, completion): + assert completion == "foo='bar'" + assert not completion.endswith(" ") diff --git a/test/t/test_alpine.py b/test/t/test_alpine.py new file mode 100644 index 00000000..a8a83a0b --- /dev/null +++ b/test/t/test_alpine.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAlpine: + @pytest.mark.complete("alpine -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_animate.py b/test/t/test_animate.py new file mode 100644 index 00000000..2103606e --- /dev/null +++ b/test/t/test_animate.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAnimate: + @pytest.mark.complete("animate ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ant.py b/test/t/test_ant.py new file mode 100644 index 00000000..e18b6eb4 --- /dev/null +++ b/test/t/test_ant.py @@ -0,0 +1,26 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^\+ANT_ARGS=") +class TestAnt: + @pytest.mark.complete("ant -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ant ", cwd="ant") + def test_2(self, completion): + assert completion == "bashcomp clean init realclean".split() + + @pytest.mark.complete("ant -f build-with-import.xml ", cwd="ant") + def test_3(self, completion): + assert completion == "build-with-import imported-build".split() + + @pytest.mark.complete( + "ant ", cwd="ant", env=dict(ANT_ARGS="'-f named-build.xml'") + ) + def test_4(self, completion): + assert completion == "named-build" + + @pytest.mark.complete("ant -l ") + def test_5(self, completion): + assert completion diff --git a/test/t/test_apache2ctl.py b/test/t/test_apache2ctl.py new file mode 100644 index 00000000..856a0e4d --- /dev/null +++ b/test/t/test_apache2ctl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestApache2ctl: + @pytest.mark.complete("apache2ctl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_appdata_validate.py b/test/t/test_appdata_validate.py new file mode 100644 index 00000000..d57aa992 --- /dev/null +++ b/test/t/test_appdata_validate.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="appdata-validate") +class TestAppdataValidate: + @pytest.mark.complete("appdata-validate ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_apt_build.py b/test/t/test_apt_build.py new file mode 100644 index 00000000..8346e110 --- /dev/null +++ b/test/t/test_apt_build.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="apt-build") +class TestAptBuild: + @pytest.mark.complete("apt-build ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_apt_cache.py b/test/t/test_apt_cache.py new file mode 100644 index 00000000..0cb50ef6 --- /dev/null +++ b/test/t/test_apt_cache.py @@ -0,0 +1,13 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="apt-cache") +class TestAptCache: + @pytest.mark.complete("apt-cache ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("apt-cache showsrc [") + def test_2(self, completion): + # Doesn't actually fail on grep errors, but takes a long time. + assert not completion diff --git a/test/t/test_apt_get.py b/test/t/test_apt_get.py new file mode 100644 index 00000000..ccdff6cd --- /dev/null +++ b/test/t/test_apt_get.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="apt-get") +class TestAptGet: + @pytest.mark.complete("apt-get ") + def test_1(self, completion): + assert all(x in completion for x in "install update".split()) + + @pytest.mark.complete("apt-get install ./", cwd="dpkg") + def test_2(self, completion): + assert completion == "./bash-completion-test-subject.deb" diff --git a/test/t/test_aptitude.py b/test/t/test_aptitude.py new file mode 100644 index 00000000..c59c3580 --- /dev/null +++ b/test/t/test_aptitude.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAptitude: + @pytest.mark.complete("aptitude ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_arch.py b/test/t/test_arch.py new file mode 100644 index 00000000..69e0b1ae --- /dev/null +++ b/test/t/test_arch.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestArch: + @pytest.mark.complete("arch -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_arp.py b/test/t/test_arp.py new file mode 100644 index 00000000..35963d75 --- /dev/null +++ b/test/t/test_arp.py @@ -0,0 +1,14 @@ +import pytest + +from conftest import in_docker + + +class TestArp: + @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") + @pytest.mark.complete("arp ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("arp -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_arping.py b/test/t/test_arping.py new file mode 100644 index 00000000..850344be --- /dev/null +++ b/test/t/test_arping.py @@ -0,0 +1,11 @@ +import pytest + + +class TestArping: + @pytest.mark.complete("arping ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("arping -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_arpspoof.py b/test/t/test_arpspoof.py new file mode 100644 index 00000000..9fcf20b7 --- /dev/null +++ b/test/t/test_arpspoof.py @@ -0,0 +1,7 @@ +import pytest + + +class TestArpspoof: + @pytest.mark.complete("arpspoof -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_asciidoc.py b/test/t/test_asciidoc.py new file mode 100644 index 00000000..b295a27d --- /dev/null +++ b/test/t/test_asciidoc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAsciidoc: + @pytest.mark.complete("asciidoc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_aspell.py b/test/t/test_aspell.py new file mode 100644 index 00000000..b7a03c41 --- /dev/null +++ b/test/t/test_aspell.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAspell: + @pytest.mark.complete("aspell ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autoconf.py b/test/t/test_autoconf.py new file mode 100644 index 00000000..9b98b625 --- /dev/null +++ b/test/t/test_autoconf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutoconf: + @pytest.mark.complete("autoconf ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autoheader.py b/test/t/test_autoheader.py new file mode 100644 index 00000000..57ad8af1 --- /dev/null +++ b/test/t/test_autoheader.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutoheader: + @pytest.mark.complete("autoheader ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_automake.py b/test/t/test_automake.py new file mode 100644 index 00000000..5d25c6a7 --- /dev/null +++ b/test/t/test_automake.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutomake: + @pytest.mark.complete("automake ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autoreconf.py b/test/t/test_autoreconf.py new file mode 100644 index 00000000..10e2a2e8 --- /dev/null +++ b/test/t/test_autoreconf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutoreconf: + @pytest.mark.complete("autoreconf ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autorpm.py b/test/t/test_autorpm.py new file mode 100644 index 00000000..185585e0 --- /dev/null +++ b/test/t/test_autorpm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutorpm: + @pytest.mark.complete("autorpm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autoscan.py b/test/t/test_autoscan.py new file mode 100644 index 00000000..b2667543 --- /dev/null +++ b/test/t/test_autoscan.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutoscan: + @pytest.mark.complete("autoscan ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_autoupdate.py b/test/t/test_autoupdate.py new file mode 100644 index 00000000..13fd8d4d --- /dev/null +++ b/test/t/test_autoupdate.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAutoupdate: + @pytest.mark.complete("autoupdate ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_avctrl.py b/test/t/test_avctrl.py new file mode 100644 index 00000000..6ff1ec38 --- /dev/null +++ b/test/t/test_avctrl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAvctrl: + @pytest.mark.complete("avctrl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_awk.py b/test/t/test_awk.py new file mode 100644 index 00000000..ad2034d1 --- /dev/null +++ b/test/t/test_awk.py @@ -0,0 +1,7 @@ +import pytest + + +class TestAwk: + @pytest.mark.complete("awk ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_badblocks.py b/test/t/test_badblocks.py new file mode 100644 index 00000000..57a559de --- /dev/null +++ b/test/t/test_badblocks.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBadblocks: + @pytest.mark.complete("badblocks ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_base64.py b/test/t/test_base64.py new file mode 100644 index 00000000..efc35ebb --- /dev/null +++ b/test/t/test_base64.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBase64: + @pytest.mark.complete("base64 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_bash.py b/test/t/test_bash.py new file mode 100644 index 00000000..d6e6959a --- /dev/null +++ b/test/t/test_bash.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBash: + @pytest.mark.complete("bash --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_bc.py b/test/t/test_bc.py new file mode 100644 index 00000000..effcbaea --- /dev/null +++ b/test/t/test_bc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBc: + @pytest.mark.complete("bc --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_bind.py b/test/t/test_bind.py new file mode 100644 index 00000000..f97a246e --- /dev/null +++ b/test/t/test_bind.py @@ -0,0 +1,11 @@ +import pytest + + +class TestBind: + @pytest.mark.complete("bind -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("bind k") + def test_2(self, completion): + assert completion diff --git a/test/t/test_bison.py b/test/t/test_bison.py new file mode 100644 index 00000000..47c4908c --- /dev/null +++ b/test/t/test_bison.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBison: + @pytest.mark.complete("bison --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_bk.py b/test/t/test_bk.py new file mode 100644 index 00000000..8ab44b68 --- /dev/null +++ b/test/t/test_bk.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBk: + @pytest.mark.complete("bk ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_brctl.py b/test/t/test_brctl.py new file mode 100644 index 00000000..7c773e97 --- /dev/null +++ b/test/t/test_brctl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestBrctl: + @pytest.mark.complete("brctl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_btdownloadcurses_py.py b/test/t/test_btdownloadcurses_py.py new file mode 100644 index 00000000..0b65519a --- /dev/null +++ b/test/t/test_btdownloadcurses_py.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="btdownloadcurses.py") +class TestBtdownloadcursesPy: + @pytest.mark.complete("btdownloadcurses.py ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_btdownloadgui_py.py b/test/t/test_btdownloadgui_py.py new file mode 100644 index 00000000..c1b1b38a --- /dev/null +++ b/test/t/test_btdownloadgui_py.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="btdownloadgui.py") +class TestBtdownloadguiPy: + @pytest.mark.complete("btdownloadgui.py ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_btdownloadheadless_py.py b/test/t/test_btdownloadheadless_py.py new file mode 100644 index 00000000..f84592fa --- /dev/null +++ b/test/t/test_btdownloadheadless_py.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="btdownloadheadless.py") +class TestBtdownloadheadlessPy: + @pytest.mark.complete("btdownloadheadless.py ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_bts.py b/test/t/test_bts.py new file mode 100644 index 00000000..53dd62fc --- /dev/null +++ b/test/t/test_bts.py @@ -0,0 +1,11 @@ +import pytest + + +class TestBts: + @pytest.mark.complete("bts ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("bts -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_bzip2.py b/test/t/test_bzip2.py new file mode 100644 index 00000000..d1cad249 --- /dev/null +++ b/test/t/test_bzip2.py @@ -0,0 +1,11 @@ +import pytest + + +class TestBzip2: + @pytest.mark.complete("bzip2 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("bzip2 ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_cal.py b/test/t/test_cal.py new file mode 100644 index 00000000..27102c7a --- /dev/null +++ b/test/t/test_cal.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCal: + @pytest.mark.complete("cal ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cancel.py b/test/t/test_cancel.py new file mode 100644 index 00000000..4aeafd2c --- /dev/null +++ b/test/t/test_cancel.py @@ -0,0 +1,34 @@ +import pytest + +from conftest import assert_bash_exec + + +class TestCancel: + @pytest.fixture(scope="class") + def added_job(self, request, bash): + try: + got = ( + assert_bash_exec( + bash, "lp -H hold shared/default/foo", want_output=True + ) + .strip() + .split() + ) + except AssertionError: + pytest.skip("Could not add test print job") + return + if len(got) > 3: + request.addfinalizer( + lambda: assert_bash_exec(bash, "cancel %s" % got[3]) + ) + + @pytest.mark.complete("cancel ") + def test_1(self, bash, completion, added_job): + got = ( + assert_bash_exec( + bash, "lpstat | awk '{print $1}'", want_output=True + ) + .strip() + .split() + ) + assert completion == sorted(got) diff --git a/test/t/test_cardctl.py b/test/t/test_cardctl.py new file mode 100644 index 00000000..df28b6bd --- /dev/null +++ b/test/t/test_cardctl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCardctl: + @pytest.mark.complete("cardctl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cat.py b/test/t/test_cat.py new file mode 100644 index 00000000..94245e8f --- /dev/null +++ b/test/t/test_cat.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCat: + @pytest.mark.complete("cat ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cc.py b/test/t/test_cc.py new file mode 100644 index 00000000..12f6b2b5 --- /dev/null +++ b/test/t/test_cc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCc: + @pytest.mark.complete("cc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ccache.py b/test/t/test_ccache.py new file mode 100644 index 00000000..573e3e44 --- /dev/null +++ b/test/t/test_ccache.py @@ -0,0 +1,27 @@ +import pytest + + +class TestCcache: + @pytest.mark.complete("ccache -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ccache --clea") + def test_2(self, completion): + assert all(x in completion for x in "--cleanup --clear".split()) + + @pytest.mark.complete("ccache stt") + def test_3(self, completion): + assert "stty" in completion + + @pytest.mark.complete("ccache --zero-stats stt") + def test_4(self, completion): + assert "stty" in completion + + @pytest.mark.complete("ccache --hel") + def test_5(self, completion): + assert "--help" in completion + + @pytest.mark.complete("ccache --zero-stats ls --hel") + def test_6(self, completion): + assert "--help" in completion diff --git a/test/t/test_ccze.py b/test/t/test_ccze.py new file mode 100644 index 00000000..c54a1fa1 --- /dev/null +++ b/test/t/test_ccze.py @@ -0,0 +1,19 @@ +import pytest + + +class TestCcze: + @pytest.mark.complete("ccze ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ccze -? ") + def test_2(self, completion): + assert not completion + + @pytest.mark.complete("ccze -o ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("ccze --plugin=") + def test_4(self, completion): + assert completion diff --git a/test/t/test_cd.py b/test/t/test_cd.py new file mode 100644 index 00000000..fd532312 --- /dev/null +++ b/test/t/test_cd.py @@ -0,0 +1,22 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^\+CDPATH=$") +class TestCd: + @pytest.mark.complete("cd shared/default/") + def test_1(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("cd fo", env=dict(CDPATH="shared/default")) + def test_2(self, completion): + assert completion == "foo.d/" + + @pytest.mark.complete("cd fo") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete( + "cd ", cwd="shared/default/foo.d", env=dict(CDPATH="") + ) + def test_4(self, completion): + assert not completion # No subdirs nor CDPATH diff --git a/test/t/test_cdrecord.py b/test/t/test_cdrecord.py new file mode 100644 index 00000000..d9d2da1f --- /dev/null +++ b/test/t/test_cdrecord.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCdrecord: + @pytest.mark.complete("cdrecord -d") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cfagent.py b/test/t/test_cfagent.py new file mode 100644 index 00000000..f4b477bc --- /dev/null +++ b/test/t/test_cfagent.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCfagent: + @pytest.mark.complete("cfagent -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cfrun.py b/test/t/test_cfrun.py new file mode 100644 index 00000000..a647d76b --- /dev/null +++ b/test/t/test_cfrun.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCfrun: + @pytest.mark.complete("cfrun -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_chage.py b/test/t/test_chage.py new file mode 100644 index 00000000..6ef34435 --- /dev/null +++ b/test/t/test_chage.py @@ -0,0 +1,7 @@ +import pytest + + +class TestChage: + @pytest.mark.complete("chage ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_change_pw.py b/test/t/test_change_pw.py new file mode 100644 index 00000000..69909af0 --- /dev/null +++ b/test/t/test_change_pw.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestChangePw: + @pytest.mark.complete("change_pw -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_check_db.py b/test/t/test_check_db.py new file mode 100644 index 00000000..a9f4844b --- /dev/null +++ b/test/t/test_check_db.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCheckDb: + @pytest.mark.complete("check_db -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_check_perms.py b/test/t/test_check_perms.py new file mode 100644 index 00000000..813ae4ce --- /dev/null +++ b/test/t/test_check_perms.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCheckPerms: + @pytest.mark.complete("check_perms -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_checksec.py b/test/t/test_checksec.py new file mode 100644 index 00000000..4fce13ff --- /dev/null +++ b/test/t/test_checksec.py @@ -0,0 +1,7 @@ +import pytest + + +class TestChecksec: + @pytest.mark.complete("checksec -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_chfn.py b/test/t/test_chfn.py new file mode 100644 index 00000000..ca719b8e --- /dev/null +++ b/test/t/test_chfn.py @@ -0,0 +1,7 @@ +import pytest + + +class TestChfn: + @pytest.mark.complete("chfn ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_chgrp.py b/test/t/test_chgrp.py new file mode 100644 index 00000000..87a583e7 --- /dev/null +++ b/test/t/test_chgrp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestChgrp: + @pytest.mark.complete("chgrp ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_chkconfig.py b/test/t/test_chkconfig.py new file mode 100644 index 00000000..c610a5d5 --- /dev/null +++ b/test/t/test_chkconfig.py @@ -0,0 +1,15 @@ +import pytest + + +class TestChkconfig: + @pytest.mark.complete("chkconfig -") + def test_1(self, completion): + assert completion + + # systemd may not be running e.g. in a docker container, and listing + # services will then fail. + @pytest.mark.complete( + "chkconfig ", skipif="! systemctl list-units &>/dev/null" + ) + def test_2(self, completion): + assert completion diff --git a/test/t/test_chmod.py b/test/t/test_chmod.py new file mode 100644 index 00000000..ed59cf13 --- /dev/null +++ b/test/t/test_chmod.py @@ -0,0 +1,25 @@ +import pytest + + +class TestChmod: + + # No completion here until mode completion is implemented + @pytest.mark.complete("chmod ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("chmod 755 ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("chmod -") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("chmod -x ") + def test_4(self, completion): + assert completion + + @pytest.mark.complete("chmod -77 ") + def test_5(self, completion): + assert completion diff --git a/test/t/test_chown.py b/test/t/test_chown.py new file mode 100644 index 00000000..37221cfa --- /dev/null +++ b/test/t/test_chown.py @@ -0,0 +1,82 @@ +import getpass + +import pytest + +from conftest import assert_bash_exec, assert_complete + + +@pytest.mark.bashcomp( + pre_cmds=( + # Fake root command to get all users/groups completed at least for now + "root_command=sudo", + ) +) +class TestChown: + @pytest.mark.xfail( + getpass.getuser() != "root", reason="Only root can chown to all users" + ) + @pytest.mark.complete("chown ") + def test_1(self, bash, completion): + users = sorted( + assert_bash_exec(bash, "compgen -A user", want_output=True).split() + ) + assert completion == users + + @pytest.mark.complete("chown foo: shared/default/") + def test_2(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.complete("chown :foo shared/default/") + def test_3(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + def test_4(self, bash, part_full_user): + part, full = part_full_user + completion = assert_complete(bash, "chown %s" % part) + assert completion == full + assert completion.endswith(" ") + + def test_5(self, bash, part_full_user, part_full_group): + _, user = part_full_user + partgroup, fullgroup = part_full_group + completion = assert_complete(bash, "chown %s:%s" % (user, partgroup)) + assert completion == "%s:%s" % (user, fullgroup) + assert completion.output.endswith(" ") + + def test_6(self, bash, part_full_group): + part, full = part_full_group + completion = assert_complete(bash, "chown dot.user:%s" % part) + assert completion == "dot.user:%s" % full + assert completion.output.endswith(" ") + + @pytest.mark.xfail # TODO check escaping, whitespace + def test_7(self, bash, part_full_group): + """Test preserving special chars in $prefix$partgroup<TAB>.""" + part, full = part_full_group + for prefix in ( + r"funky\ user:", + "funky.user:", + r"funky\.user:", + r"fu\ nky.user:", + r"f\ o\ o\.\bar:", + r"foo\_b\ a\.r\ :", + ): + completion = assert_complete(bash, "chown %s%s" % (prefix, part)) + assert completion == "%s%s" % (prefix, full) + assert completion.output.endswith(" ") + + def test_8(self, bash, part_full_user, part_full_group): + """Test giving up on degenerate cases instead of spewing junk.""" + _, user = part_full_user + partgroup, _ = part_full_group + for x in range(2, 5): + completion = assert_complete( + bash, "chown %s%s:%s" % (user, x * "\\", partgroup) + ) + assert not completion + + def test_9(self, bash, part_full_group): + """Test graceful fail on colon in user/group name.""" + part, _ = part_full_group + completion = assert_complete(bash, "chown foo:bar:%s" % part) + assert not completion diff --git a/test/t/test_chpasswd.py b/test/t/test_chpasswd.py new file mode 100644 index 00000000..ce16a75d --- /dev/null +++ b/test/t/test_chpasswd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestChpasswd: + @pytest.mark.complete("chpasswd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_chromium_browser.py b/test/t/test_chromium_browser.py new file mode 100644 index 00000000..75cabdaf --- /dev/null +++ b/test/t/test_chromium_browser.py @@ -0,0 +1,13 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="chromium-browser") +class TestChromiumBrowser: + @pytest.mark.complete("chromium-browser ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("chromium-browser -") + def test_2(self, completion): + assert completion + assert not completion.endswith(" ") diff --git a/test/t/test_chronyc.py b/test/t/test_chronyc.py new file mode 100644 index 00000000..fdc91ac5 --- /dev/null +++ b/test/t/test_chronyc.py @@ -0,0 +1,11 @@ +import pytest + + +class TestChronyc: + @pytest.mark.complete("chronyc ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("chronyc -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_chroot.py b/test/t/test_chroot.py new file mode 100644 index 00000000..99ca56b0 --- /dev/null +++ b/test/t/test_chroot.py @@ -0,0 +1,12 @@ +import pytest + + +class TestChroot: + @pytest.mark.complete("chroot ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("/bin/chroot shared/default/") + def test_2(self, completion): + """Should complete dirs only, also when invoked using full path.""" + assert completion == ["bar bar.d/", "foo.d/"] diff --git a/test/t/test_chrpath.py b/test/t/test_chrpath.py new file mode 100644 index 00000000..036a1a41 --- /dev/null +++ b/test/t/test_chrpath.py @@ -0,0 +1,11 @@ +import pytest + + +class TestChrpath: + @pytest.mark.complete("chrpath ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("chrpath -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_chsh.py b/test/t/test_chsh.py new file mode 100644 index 00000000..26e3a0a3 --- /dev/null +++ b/test/t/test_chsh.py @@ -0,0 +1,11 @@ +import pytest + + +class TestChsh: + @pytest.mark.complete("chsh ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("chsh -s ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_ci.py b/test/t/test_ci.py new file mode 100644 index 00000000..f941b2cc --- /dev/null +++ b/test/t/test_ci.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCi: + @pytest.mark.complete("ci ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ciptool.py b/test/t/test_ciptool.py new file mode 100644 index 00000000..0ff54442 --- /dev/null +++ b/test/t/test_ciptool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCiptool: + @pytest.mark.complete("ciptool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_civclient.py b/test/t/test_civclient.py new file mode 100644 index 00000000..cff70f47 --- /dev/null +++ b/test/t/test_civclient.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCivclient: + @pytest.mark.complete("civclient -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_civserver.py b/test/t/test_civserver.py new file mode 100644 index 00000000..b822ddef --- /dev/null +++ b/test/t/test_civserver.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCivserver: + @pytest.mark.complete("civserver -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cksfv.py b/test/t/test_cksfv.py new file mode 100644 index 00000000..b4df8767 --- /dev/null +++ b/test/t/test_cksfv.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCksfv: + @pytest.mark.complete("cksfv -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cleanarch.py b/test/t/test_cleanarch.py new file mode 100644 index 00000000..95b268e2 --- /dev/null +++ b/test/t/test_cleanarch.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestCleanarch: + @pytest.mark.complete("cleanarch -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_clisp.py b/test/t/test_clisp.py new file mode 100644 index 00000000..3fcb2593 --- /dev/null +++ b/test/t/test_clisp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestClisp: + @pytest.mark.complete("clisp ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_clone_member.py b/test/t/test_clone_member.py new file mode 100644 index 00000000..8f54298a --- /dev/null +++ b/test/t/test_clone_member.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCloneMember: + @pytest.mark.complete("clone_member -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_co.py b/test/t/test_co.py new file mode 100644 index 00000000..0404b45f --- /dev/null +++ b/test/t/test_co.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCo: + @pytest.mark.complete("co ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_compare.py b/test/t/test_compare.py new file mode 100644 index 00000000..172c8dab --- /dev/null +++ b/test/t/test_compare.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCompare: + @pytest.mark.complete("compare ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_complete.py b/test/t/test_complete.py new file mode 100644 index 00000000..036f954e --- /dev/null +++ b/test/t/test_complete.py @@ -0,0 +1,7 @@ +import pytest + + +class TestComplete: + @pytest.mark.complete("complete -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_composite.py b/test/t/test_composite.py new file mode 100644 index 00000000..58f4e398 --- /dev/null +++ b/test/t/test_composite.py @@ -0,0 +1,7 @@ +import pytest + + +class TestComposite: + @pytest.mark.complete("composite ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_config_list.py b/test/t/test_config_list.py new file mode 100644 index 00000000..d17fadc6 --- /dev/null +++ b/test/t/test_config_list.py @@ -0,0 +1,7 @@ +import pytest + + +class TestConfigList: + @pytest.mark.complete("config_list -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_configure.py b/test/t/test_configure.py new file mode 100644 index 00000000..17bc9d48 --- /dev/null +++ b/test/t/test_configure.py @@ -0,0 +1,17 @@ +import pytest + + +@pytest.mark.bashcomp( + pre_cmds=( + # Make sure our own ./configure is in PATH + "PATH=$PWD/../..:$PATH", + ) +) +class TestConfigure: + @pytest.mark.complete("configure --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("configure --prefix ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_conjure.py b/test/t/test_conjure.py new file mode 100644 index 00000000..3dcc0dbc --- /dev/null +++ b/test/t/test_conjure.py @@ -0,0 +1,7 @@ +import pytest + + +class TestConjure: + @pytest.mark.complete("conjure ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_convert.py b/test/t/test_convert.py new file mode 100644 index 00000000..90dfb477 --- /dev/null +++ b/test/t/test_convert.py @@ -0,0 +1,11 @@ +import pytest + + +class TestConvert: + @pytest.mark.complete("convert ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("convert -format ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_cowsay.py b/test/t/test_cowsay.py new file mode 100644 index 00000000..2920d9ea --- /dev/null +++ b/test/t/test_cowsay.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCowsay: + @pytest.mark.complete("cowsay ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cp.py b/test/t/test_cp.py new file mode 100644 index 00000000..a25998fc --- /dev/null +++ b/test/t/test_cp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCp: + @pytest.mark.complete("cp ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cpan2dist.py b/test/t/test_cpan2dist.py new file mode 100644 index 00000000..13feae9e --- /dev/null +++ b/test/t/test_cpan2dist.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCpan2dist: + @pytest.mark.complete("cpan2dist -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cpio.py b/test/t/test_cpio.py new file mode 100644 index 00000000..69bb5702 --- /dev/null +++ b/test/t/test_cpio.py @@ -0,0 +1,16 @@ +import pytest + +from conftest import assert_bash_exec + + +class TestCpio: + @pytest.mark.complete("cpio --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("cpio -R ") + def test_2(self, bash, completion): + users = sorted( + assert_bash_exec(bash, "compgen -A user", want_output=True).split() + ) + assert completion == users diff --git a/test/t/test_cplusplus.py b/test/t/test_cplusplus.py new file mode 100644 index 00000000..a2dd3ede --- /dev/null +++ b/test/t/test_cplusplus.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="c++") +class TestCPlusPlus: + @pytest.mark.complete("c++ ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cppcheck.py b/test/t/test_cppcheck.py new file mode 100644 index 00000000..d5e3af9b --- /dev/null +++ b/test/t/test_cppcheck.py @@ -0,0 +1,31 @@ +import pytest + + +class TestCppcheck: + @pytest.mark.complete("cppcheck ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("cppcheck -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("cppcheck -DFOO=BAR ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("cppcheck -D ") + def test_4(self, completion): + assert not completion + + @pytest.mark.complete("cppcheck --enable=al") + def test_5(self, completion): + assert completion == "--enable=all" + + @pytest.mark.complete("cppcheck --enable=xx,styl") + def test_6(self, completion): + assert completion == "--enable=xx,style" + + @pytest.mark.complete("cppcheck --enable=xx,yy,styl") + def test_7(self, completion): + assert completion == "--enable=xx,yy,style" diff --git a/test/t/test_createdb.py b/test/t/test_createdb.py new file mode 100644 index 00000000..7e226438 --- /dev/null +++ b/test/t/test_createdb.py @@ -0,0 +1,9 @@ +import pytest + + +class TestCreatedb: + + # --help can fail due to missing package dependencies, e.g. on Ubuntu 14 + @pytest.mark.complete("createdb -", skipif="! createdb --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_createuser.py b/test/t/test_createuser.py new file mode 100644 index 00000000..f25f10f7 --- /dev/null +++ b/test/t/test_createuser.py @@ -0,0 +1,11 @@ +import pytest + + +class TestCreateuser: + + # --help can fail due to missing package dependencies, e.g. on Ubuntu 14 + @pytest.mark.complete( + "createuser -", skipif="! createuser --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_crontab.py b/test/t/test_crontab.py new file mode 100644 index 00000000..098fd9e0 --- /dev/null +++ b/test/t/test_crontab.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCrontab: + @pytest.mark.complete("crontab ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cryptsetup.py b/test/t/test_cryptsetup.py new file mode 100644 index 00000000..235ac4fc --- /dev/null +++ b/test/t/test_cryptsetup.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCryptsetup: + @pytest.mark.complete("cryptsetup ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_csplit.py b/test/t/test_csplit.py new file mode 100644 index 00000000..54eab34c --- /dev/null +++ b/test/t/test_csplit.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCsplit: + @pytest.mark.complete("csplit ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_curl.py b/test/t/test_curl.py new file mode 100644 index 00000000..324fba2a --- /dev/null +++ b/test/t/test_curl.py @@ -0,0 +1,19 @@ +import pytest + + +class TestCurl: + @pytest.mark.complete("curl --h") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("curl -o f", cwd="shared/default/foo.d") + def test_2(self, completion): + assert completion == "foo" + + @pytest.mark.complete("curl -LRo f", cwd="shared/default/foo.d") + def test_3(self, completion): + assert completion == "foo" + + @pytest.mark.complete("curl --o f") + def test_4(self, completion): + assert not completion diff --git a/test/t/test_cut.py b/test/t/test_cut.py new file mode 100644 index 00000000..31fa636a --- /dev/null +++ b/test/t/test_cut.py @@ -0,0 +1,7 @@ +import pytest + + +class TestCut: + @pytest.mark.complete("cut ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_cvs.py b/test/t/test_cvs.py new file mode 100644 index 00000000..825acbf5 --- /dev/null +++ b/test/t/test_cvs.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/cvs",)) +class TestCvs: + @pytest.mark.complete("cvs ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("cvs -d ") + def test_2(self, completion): + assert [x for x in completion if ":pserver:" in x] + + @pytest.mark.complete("cvs diff foo/", cwd="cvs") + def test_3(self, completion): + assert completion == "foo/bar" diff --git a/test/t/test_cvsps.py b/test/t/test_cvsps.py new file mode 100644 index 00000000..0a4da9ba --- /dev/null +++ b/test/t/test_cvsps.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/cvs",)) +class TestCvsps: + @pytest.mark.complete("cvsps -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("cvsps ") + def test_2(self, completion): + assert [x for x in completion if ":pserver:" in x] diff --git a/test/t/test_date.py b/test/t/test_date.py new file mode 100644 index 00000000..8df574e9 --- /dev/null +++ b/test/t/test_date.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDate: + @pytest.mark.complete("date ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dcop.py b/test/t/test_dcop.py new file mode 100644 index 00000000..669725e2 --- /dev/null +++ b/test/t/test_dcop.py @@ -0,0 +1,14 @@ +import subprocess + +import pytest + + +class TestDcop: + @pytest.mark.complete("dcop ") + def test_1(self, completion): + try: + subprocess.check_call("dcop &>/dev/null", shell=True) + except BaseException: + assert not completion + else: + assert completion diff --git a/test/t/test_dd.py b/test/t/test_dd.py new file mode 100644 index 00000000..616f4d4a --- /dev/null +++ b/test/t/test_dd.py @@ -0,0 +1,11 @@ +import pytest + + +class TestDd: + @pytest.mark.complete("dd --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("dd bs") + def test_2(self, completion): + assert completion == "bs=" diff --git a/test/t/test_declare.py b/test/t/test_declare.py new file mode 100644 index 00000000..b17affc2 --- /dev/null +++ b/test/t/test_declare.py @@ -0,0 +1,20 @@ +import pytest + + +class TestDeclare: + @pytest.mark.complete("declare -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("declare +") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("declare -p BASH_ARG") + def test_3(self, completion): + # bash 5.0 has BASH_ARGV0 too + assert all(x in completion for x in "BASH_ARGC BASH_ARGV".split()) + + @pytest.mark.complete("declare -f _parse_") + def test_4(self, completion): + assert "_parse_help" in completion diff --git a/test/t/test_deja_dup.py b/test/t/test_deja_dup.py new file mode 100644 index 00000000..1da29e99 --- /dev/null +++ b/test/t/test_deja_dup.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="deja-dup") +class TestDejaDup: + @pytest.mark.complete("deja-dup -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("deja-dup --help ") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_desktop_file_validate.py b/test/t/test_desktop_file_validate.py new file mode 100644 index 00000000..e007a956 --- /dev/null +++ b/test/t/test_desktop_file_validate.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="desktop-file-validate") +class TestDesktopFileValidate: + @pytest.mark.complete("desktop-file-validate ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_df.py b/test/t/test_df.py new file mode 100644 index 00000000..247311cc --- /dev/null +++ b/test/t/test_df.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDf: + @pytest.mark.complete("df ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dfutool.py b/test/t/test_dfutool.py new file mode 100644 index 00000000..7b450bde --- /dev/null +++ b/test/t/test_dfutool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDfutool: + @pytest.mark.complete("dfutool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dhclient.py b/test/t/test_dhclient.py new file mode 100644 index 00000000..fdfbd473 --- /dev/null +++ b/test/t/test_dhclient.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDhclient: + @pytest.mark.complete("dhclient -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dict.py b/test/t/test_dict.py new file mode 100644 index 00000000..65f6b129 --- /dev/null +++ b/test/t/test_dict.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDict: + @pytest.mark.complete("dict -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_diff.py b/test/t/test_diff.py new file mode 100644 index 00000000..25157bd9 --- /dev/null +++ b/test/t/test_diff.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDiff: + @pytest.mark.complete("diff --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dir.py b/test/t/test_dir.py new file mode 100644 index 00000000..3026d502 --- /dev/null +++ b/test/t/test_dir.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDir: + @pytest.mark.complete("dir ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_display.py b/test/t/test_display.py new file mode 100644 index 00000000..9f5c1004 --- /dev/null +++ b/test/t/test_display.py @@ -0,0 +1,11 @@ +import pytest + + +class TestDisplay: + @pytest.mark.complete("display ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("display -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_dmesg.py b/test/t/test_dmesg.py new file mode 100644 index 00000000..4416fe1c --- /dev/null +++ b/test/t/test_dmesg.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDmesg: + @pytest.mark.complete("dmesg -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dnssec_keygen.py b/test/t/test_dnssec_keygen.py new file mode 100644 index 00000000..d52e3af0 --- /dev/null +++ b/test/t/test_dnssec_keygen.py @@ -0,0 +1,80 @@ +import pytest + + +@pytest.mark.bashcomp( + cmd="dnssec-keygen", pre_cmds=("PATH=$PATH:$PWD/dnssec-keygen",) +) +class TestDnssecKeygen: + @pytest.mark.complete("dnssec-keygen -") + def test_1(self, completion): + assert completion + assert not any(x.endswith(":") for x in completion) + + @pytest.mark.complete("dnssec-keygen -a ") + def test_2(self, completion): + assert completion + assert "HMAC-MD5" in completion + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen -n ") + def test_3(self, completion): + assert completion + assert "HOST" in completion + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen -f ") + def test_4(self, completion): + assert completion + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete( + "dnssec-keygen -a ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_6(self, completion): + assert completion == sorted( + "RSA RSAMD5 DSA RSASHA1 NSEC3RSASHA1 NSEC3DSA " + "RSASHA256 RSASHA512 ECCGOST " + "ECDSAP256SHA256 ECDSAP384SHA384 " + "ED25519 ED448 DH " + "HMAC-MD5 HMAC-SHA1 HMAC-SHA224 HMAC-SHA256 " + "HMAC-SHA384 HMAC-SHA512".split() + ) + + @pytest.mark.complete( + "dnssec-keygen -n ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_7(self, completion): + assert completion == sorted("ZONE HOST ENTITY USER OTHER".split()) + + @pytest.mark.complete( + "dnssec-keygen -f ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_8(self, completion): + assert completion == sorted("KSK REVOKE".split()) + + @pytest.mark.complete( + "dnssec-keygen -T ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_9(self, completion): + assert completion == sorted("DNSKEY KEY".split()) + + @pytest.mark.complete( + "dnssec-keygen -t ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_10(self, completion): + assert completion == sorted( + "AUTHCONF NOAUTHCONF NOAUTH NOCONF".split() + ) + + @pytest.mark.complete( + "dnssec-keygen -m ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_11(self, completion): + assert completion == sorted("usage trace record size mctx".split()) diff --git a/test/t/test_dnsspoof.py b/test/t/test_dnsspoof.py new file mode 100644 index 00000000..fae6c430 --- /dev/null +++ b/test/t/test_dnsspoof.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDnsspoof: + @pytest.mark.complete("dnsspoof -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dot.py b/test/t/test_dot.py new file mode 100644 index 00000000..a4aa6742 --- /dev/null +++ b/test/t/test_dot.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDot: + @pytest.mark.complete("dot ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dpkg.py b/test/t/test_dpkg.py new file mode 100644 index 00000000..e609ee86 --- /dev/null +++ b/test/t/test_dpkg.py @@ -0,0 +1,17 @@ +import pytest + + +class TestDpkg: + @pytest.mark.complete("dpkg --c") + def test_1(self, completion): + assert completion + + @pytest.mark.complete( + "dpkg -L ", skipif='test -z "$(dpkg -l 2>/dev/null)"' + ) + def test_2(self, completion): + assert completion + + @pytest.mark.complete("dpkg -i ~") + def test_3(self, completion): + assert completion diff --git a/test/t/test_dpkg_deb.py b/test/t/test_dpkg_deb.py new file mode 100644 index 00000000..4bd7368b --- /dev/null +++ b/test/t/test_dpkg_deb.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="dpkg-deb") +class TestDpkgDeb: + @pytest.mark.complete("dpkg-deb --c") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dpkg_reconfigure.py b/test/t/test_dpkg_reconfigure.py new file mode 100644 index 00000000..46347b3f --- /dev/null +++ b/test/t/test_dpkg_reconfigure.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="dpkg-reconfigure") +class TestDpkgReconfigure: + @pytest.mark.complete("dpkg-reconfigure --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dpkg_source.py b/test/t/test_dpkg_source.py new file mode 100644 index 00000000..f2d5f19b --- /dev/null +++ b/test/t/test_dpkg_source.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="dpkg-source") +class TestDpkgSource: + @pytest.mark.complete("dpkg-source -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dropdb.py b/test/t/test_dropdb.py new file mode 100644 index 00000000..7e0b7929 --- /dev/null +++ b/test/t/test_dropdb.py @@ -0,0 +1,9 @@ +import pytest + + +class TestDropdb: + + # --help can fail due to missing package dependencies, e.g. on Ubuntu 14 + @pytest.mark.complete("dropdb -", skipif="! dropdb --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dropuser.py b/test/t/test_dropuser.py new file mode 100644 index 00000000..83a99d94 --- /dev/null +++ b/test/t/test_dropuser.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDropuser: + @pytest.mark.complete("dropuser ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dselect.py b/test/t/test_dselect.py new file mode 100644 index 00000000..3145cc40 --- /dev/null +++ b/test/t/test_dselect.py @@ -0,0 +1,11 @@ +import pytest + + +class TestDselect: + @pytest.mark.complete("dselect ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("dselect -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_dsniff.py b/test/t/test_dsniff.py new file mode 100644 index 00000000..978c4365 --- /dev/null +++ b/test/t/test_dsniff.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDsniff: + @pytest.mark.complete("dsniff -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_du.py b/test/t/test_du.py new file mode 100644 index 00000000..c014b069 --- /dev/null +++ b/test/t/test_du.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDu: + @pytest.mark.complete("du ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dumpdb.py b/test/t/test_dumpdb.py new file mode 100644 index 00000000..50776827 --- /dev/null +++ b/test/t/test_dumpdb.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestDumpdb: + @pytest.mark.complete("dumpdb ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_dumpe2fs.py b/test/t/test_dumpe2fs.py new file mode 100644 index 00000000..fa7590e6 --- /dev/null +++ b/test/t/test_dumpe2fs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestDumpe2fs: + @pytest.mark.complete("dumpe2fs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_e2freefrag.py b/test/t/test_e2freefrag.py new file mode 100644 index 00000000..6685382d --- /dev/null +++ b/test/t/test_e2freefrag.py @@ -0,0 +1,7 @@ +import pytest + + +class TestE2freefrag: + @pytest.mark.complete("e2freefrag ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_e2label.py b/test/t/test_e2label.py new file mode 100644 index 00000000..ca436a65 --- /dev/null +++ b/test/t/test_e2label.py @@ -0,0 +1,7 @@ +import pytest + + +class TestE2label: + @pytest.mark.complete("e2label ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ebtables.py b/test/t/test_ebtables.py new file mode 100644 index 00000000..bcca3cbe --- /dev/null +++ b/test/t/test_ebtables.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEbtables: + @pytest.mark.complete("ebtables -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ecryptfs_migrate_home.py b/test/t/test_ecryptfs_migrate_home.py new file mode 100644 index 00000000..fd49ca8b --- /dev/null +++ b/test/t/test_ecryptfs_migrate_home.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="ecryptfs-migrate-home") +class TestEcryptfsMigrateHome: + @pytest.mark.complete("ecryptfs-migrate-home ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_eject.py b/test/t/test_eject.py new file mode 100644 index 00000000..037ea98e --- /dev/null +++ b/test/t/test_eject.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEject: + @pytest.mark.complete("eject -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_enscript.py b/test/t/test_enscript.py new file mode 100644 index 00000000..2e4ff51a --- /dev/null +++ b/test/t/test_enscript.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEnscript: + @pytest.mark.complete("enscript --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_env.py b/test/t/test_env.py new file mode 100644 index 00000000..57ed9769 --- /dev/null +++ b/test/t/test_env.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEnv: + @pytest.mark.complete("env --", skipif="! env --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_eog.py b/test/t/test_eog.py new file mode 100644 index 00000000..c095934f --- /dev/null +++ b/test/t/test_eog.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEog: + @pytest.mark.complete("eog ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ether_wake.py b/test/t/test_ether_wake.py new file mode 100644 index 00000000..b9dac0b4 --- /dev/null +++ b/test/t/test_ether_wake.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="ether-wake") +class TestEtherWake: + @pytest.mark.complete("ether-wake ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_etherwake.py b/test/t/test_etherwake.py new file mode 100644 index 00000000..b444b433 --- /dev/null +++ b/test/t/test_etherwake.py @@ -0,0 +1,7 @@ +import pytest + + +class TestEtherwake: + @pytest.mark.complete("etherwake -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_evince.py b/test/t/test_evince.py new file mode 100644 index 00000000..0dc44f38 --- /dev/null +++ b/test/t/test_evince.py @@ -0,0 +1,18 @@ +import pytest + + +class TestEvince: + @pytest.mark.complete("evince ", cwd="evince") + def test_1(self, completion): + # .txt should not be here + assert completion == sorted( + "foo/ .bmp .BMP .cbr .CBR .cbz .CBZ .djv .DJV .djvu .DJVU .dvi " + ".DVI .dvi.bz2 .dvi.BZ2 .DVI.bz2 .DVI.BZ2 .dvi.gz .dvi.GZ " + ".DVI.gz .DVI.GZ .eps .EPS .eps.bz2 .eps.BZ2 .EPS.bz2 .EPS.BZ2 " + ".eps.gz .eps.GZ .EPS.gz .EPS.GZ .gif .GIF .ico .ICO .jpeg " + ".JPEG .jpg .JPG .miff .MIFF .pbm .PBM .pcx .PCX .pdf .PDF " + ".pdf.bz2 .pdf.BZ2 .PDF.bz2 .PDF.BZ2 .pdf.gz .pdf.GZ .PDF.gz " + ".PDF.GZ .pgm .PGM .png .PNG .pnm .PNM .ppm .PPM .ps .PS " + ".ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ " + ".tga .TGA .tif .TIF .tiff .TIFF .xpm .XPM .xwd .XWD".split() + ) diff --git a/test/t/test_expand.py b/test/t/test_expand.py new file mode 100644 index 00000000..004c018b --- /dev/null +++ b/test/t/test_expand.py @@ -0,0 +1,7 @@ +import pytest + + +class TestExpand: + @pytest.mark.complete("expand --", skipif="! expand --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_explodepkg.py b/test/t/test_explodepkg.py new file mode 100644 index 00000000..29463dfd --- /dev/null +++ b/test/t/test_explodepkg.py @@ -0,0 +1,18 @@ +import fnmatch +import os + +import pytest + + +class TestExplodepkg: + @pytest.mark.complete("explodepkg ", cwd="slackware/home") + def test_1(self, completion): + expected = sorted( + x + for x in os.listdir("slackware/home") + if os.path.isdir("./%s" % x) + or ( + os.path.isfile("./%s" % x) and fnmatch.fnmatch(x, "*.t[bglx]z") + ) + ) + assert completion == expected diff --git a/test/t/test_export.py b/test/t/test_export.py new file mode 100644 index 00000000..59dfdb2e --- /dev/null +++ b/test/t/test_export.py @@ -0,0 +1,36 @@ +import pytest + + +class TestExport: + @pytest.mark.complete("export BASH") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("export -n BASH") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("export -p ") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete("export FOO=", cwd="shared/default") + def test_4(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.complete("export FOO=f", cwd="shared/default") + def test_5(self, completion): + assert completion == ["foo", "foo.d/"] + + @pytest.mark.complete("export -fn _ex") + def test_6(self, completion): + assert "_expand" in completion + assert "_export" in completion + + @pytest.mark.complete(r"export FOO=$BASH") + def test_7(self, completion): + assert completion + + @pytest.mark.complete("export -") + def test_8(self, completion): + assert completion diff --git a/test/t/test_faillog.py b/test/t/test_faillog.py new file mode 100644 index 00000000..d9799d57 --- /dev/null +++ b/test/t/test_faillog.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFaillog: + @pytest.mark.complete("faillog -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_fbgs.py b/test/t/test_fbgs.py new file mode 100644 index 00000000..53ff7412 --- /dev/null +++ b/test/t/test_fbgs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFbgs: + @pytest.mark.complete("fbgs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_fbi.py b/test/t/test_fbi.py new file mode 100644 index 00000000..e27fef51 --- /dev/null +++ b/test/t/test_fbi.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFbi: + @pytest.mark.complete("fbi ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_feh.py b/test/t/test_feh.py new file mode 100644 index 00000000..1802e25f --- /dev/null +++ b/test/t/test_feh.py @@ -0,0 +1,29 @@ +import pytest + + +class TestFeh: + @pytest.mark.complete("feh ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete( + "feh --lis", skipif="feh --help 2>&1 | grep -qF 'man feh'" + ) + def test_2(self, completion): + assert completion + + @pytest.mark.complete("feh -S pix") + def test_3(self, completion): + assert completion == "pixels" + + @pytest.mark.complete("feh --zoom ma") + def test_4(self, completion): + assert completion == "max" + + @pytest.mark.complete("feh -g 640") + def test_5(self, completion): + assert completion == "0 1 2 3 4 5 6 7 8 9 x".split() + + @pytest.mark.complete("feh -g 640x48") + def test_6(self, completion): + assert completion == "0 1 2 3 4 5 6 7 8 9".split() diff --git a/test/t/test_file.py b/test/t/test_file.py new file mode 100644 index 00000000..cfd2c100 --- /dev/null +++ b/test/t/test_file.py @@ -0,0 +1,11 @@ +import pytest + + +class TestFile: + @pytest.mark.complete("file ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("file -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_file_roller.py b/test/t/test_file_roller.py new file mode 100644 index 00000000..80a1bbc7 --- /dev/null +++ b/test/t/test_file_roller.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="file-roller") +class TestFileRoller: + @pytest.mark.complete("file-roller ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_filefrag.py b/test/t/test_filefrag.py new file mode 100644 index 00000000..860b2512 --- /dev/null +++ b/test/t/test_filefrag.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFilefrag: + @pytest.mark.complete("filefrag ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_filesnarf.py b/test/t/test_filesnarf.py new file mode 100644 index 00000000..cd399d4a --- /dev/null +++ b/test/t/test_filesnarf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFilesnarf: + @pytest.mark.complete("filesnarf -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_find.py b/test/t/test_find.py new file mode 100644 index 00000000..a94e0e0d --- /dev/null +++ b/test/t/test_find.py @@ -0,0 +1,28 @@ +import pytest + + +class TestFind: + @pytest.mark.complete("find ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("find -fstype ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("find -") + def test_3(self, completion): + assert completion + + @pytest.mark.xfail # TODO: whitespace split issue + @pytest.mark.complete("find -wholename ", cwd="shared/default") + def test_4(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo foo.d/"] + + @pytest.mark.complete("find -uid ") + def test_5(self, completion): + assert not [x for x in completion if not x.isdigit()] + + @pytest.mark.complete("find -gid ") + def test_6(self, completion): + assert not [x for x in completion if not x.isdigit()] diff --git a/test/t/test_find_member.py b/test/t/test_find_member.py new file mode 100644 index 00000000..bfcf5887 --- /dev/null +++ b/test/t/test_find_member.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFindMember: + @pytest.mark.complete("find_member -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_finger.py b/test/t/test_finger.py new file mode 100644 index 00000000..e3cdfacd --- /dev/null +++ b/test/t/test_finger.py @@ -0,0 +1,14 @@ +import pytest + +from conftest import assert_bash_exec + + +class TestFinger: + @pytest.mark.complete("finger ") + def test_1(self, bash, completion): + users_at = sorted( + assert_bash_exec( + bash, "compgen -A user -S @", want_output=True + ).split() + ) + assert completion == users_at diff --git a/test/t/test_fio.py b/test/t/test_fio.py new file mode 100644 index 00000000..8dd6f789 --- /dev/null +++ b/test/t/test_fio.py @@ -0,0 +1,15 @@ +import pytest + + +class TestFio: + @pytest.mark.complete("fio ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("fio --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("fio --debug=foo,") + def test_3(self, completion): + assert completion diff --git a/test/t/test_firefox.py b/test/t/test_firefox.py new file mode 100644 index 00000000..cbba2c6c --- /dev/null +++ b/test/t/test_firefox.py @@ -0,0 +1,12 @@ +import pytest + + +class TestFirefox: + @pytest.mark.complete("firefox ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("firefox -") + def test_2(self, completion): + assert completion + assert not completion.endswith(" ") diff --git a/test/t/test_flake8.py b/test/t/test_flake8.py new file mode 100644 index 00000000..9922fb85 --- /dev/null +++ b/test/t/test_flake8.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(skipif="! flake8 --help &>/dev/null") +class TestFlake8: + @pytest.mark.complete("flake8 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("flake8 -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("flake8 --doesnt-exist=") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_fmt.py b/test/t/test_fmt.py new file mode 100644 index 00000000..dc3473ba --- /dev/null +++ b/test/t/test_fmt.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFmt: + @pytest.mark.complete("fmt -", skipif="! fmt --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_fold.py b/test/t/test_fold.py new file mode 100644 index 00000000..9a8fd2aa --- /dev/null +++ b/test/t/test_fold.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFold: + @pytest.mark.complete("fold --", skipif="! fold --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_freebsd_update.py b/test/t/test_freebsd_update.py new file mode 100644 index 00000000..911a49a5 --- /dev/null +++ b/test/t/test_freebsd_update.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="freebsd-update") +class TestFreebsdUpdate: + @pytest.mark.complete("freebsd-update ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_freeciv.py b/test/t/test_freeciv.py new file mode 100644 index 00000000..1027e43c --- /dev/null +++ b/test/t/test_freeciv.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFreeciv: + @pytest.mark.complete("freeciv -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_freeciv_server.py b/test/t/test_freeciv_server.py new file mode 100644 index 00000000..5546a5e9 --- /dev/null +++ b/test/t/test_freeciv_server.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="freeciv-server") +class TestFreecivServer: + @pytest.mark.complete("freeciv-server -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_function.py b/test/t/test_function.py new file mode 100644 index 00000000..4401f022 --- /dev/null +++ b/test/t/test_function.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFunction: + @pytest.mark.complete("function _parse_") + def test_1(self, completion): + assert completion diff --git a/test/t/test_fusermount.py b/test/t/test_fusermount.py new file mode 100644 index 00000000..3781586d --- /dev/null +++ b/test/t/test_fusermount.py @@ -0,0 +1,7 @@ +import pytest + + +class TestFusermount: + @pytest.mark.complete("fusermount ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_g4.py b/test/t/test_g4.py new file mode 100644 index 00000000..739c77db --- /dev/null +++ b/test/t/test_g4.py @@ -0,0 +1,7 @@ +import pytest + + +class TestG4: + @pytest.mark.complete("g4 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_g77.py b/test/t/test_g77.py new file mode 100644 index 00000000..45da6244 --- /dev/null +++ b/test/t/test_g77.py @@ -0,0 +1,7 @@ +import pytest + + +class TestG77: + @pytest.mark.complete("g77 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gcc.py b/test/t/test_gcc.py new file mode 100644 index 00000000..67f4ee57 --- /dev/null +++ b/test/t/test_gcc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGcc: + @pytest.mark.complete("gcc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gcj.py b/test/t/test_gcj.py new file mode 100644 index 00000000..17e2f445 --- /dev/null +++ b/test/t/test_gcj.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGcj: + @pytest.mark.complete("gcj ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gcl.py b/test/t/test_gcl.py new file mode 100644 index 00000000..f1e7a5ff --- /dev/null +++ b/test/t/test_gcl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGcl: + @pytest.mark.complete("gcl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gdb.py b/test/t/test_gdb.py new file mode 100644 index 00000000..2ad12c48 --- /dev/null +++ b/test/t/test_gdb.py @@ -0,0 +1,14 @@ +import pytest + + +class TestGdb: + @pytest.mark.complete("gdb - ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("gdb foo ", cwd="gdb") + def test_2(self, completion): + assert completion == sorted( + "core core.12345 " + "core.weston.1000.deadbeef.5308.1555362132000000".split() + ) diff --git a/test/t/test_genaliases.py b/test/t/test_genaliases.py new file mode 100644 index 00000000..e2f24d65 --- /dev/null +++ b/test/t/test_genaliases.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestGenaliases: + @pytest.mark.complete("genaliases -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gendiff.py b/test/t/test_gendiff.py new file mode 100644 index 00000000..0e2ab4c3 --- /dev/null +++ b/test/t/test_gendiff.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGendiff: + @pytest.mark.complete("gendiff ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_genisoimage.py b/test/t/test_genisoimage.py new file mode 100644 index 00000000..ba16cea2 --- /dev/null +++ b/test/t/test_genisoimage.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGenisoimage: + @pytest.mark.complete("genisoimage ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_geoiplookup.py b/test/t/test_geoiplookup.py new file mode 100644 index 00000000..d114d55f --- /dev/null +++ b/test/t/test_geoiplookup.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGeoiplookup: + @pytest.mark.complete("geoiplookup -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_getconf.py b/test/t/test_getconf.py new file mode 100644 index 00000000..6f9192d2 --- /dev/null +++ b/test/t/test_getconf.py @@ -0,0 +1,23 @@ +import pytest + + +class TestGetconf: + @pytest.mark.complete("getconf P") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("getconf -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("getconf -a ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("getconf -v ") + def test_4(self, completion): + assert completion + + @pytest.mark.complete("getconf PATH_MAX ") + def test_5(self, completion): + assert completion diff --git a/test/t/test_getent.py b/test/t/test_getent.py new file mode 100644 index 00000000..fa84880c --- /dev/null +++ b/test/t/test_getent.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGetent: + @pytest.mark.complete("getent ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gkrellm.py b/test/t/test_gkrellm.py new file mode 100644 index 00000000..8ab4b5a7 --- /dev/null +++ b/test/t/test_gkrellm.py @@ -0,0 +1,10 @@ +import os + +import pytest + + +@pytest.mark.xfail(not os.environ.get("DISPLAY"), reason="X display required") +class TestGkrellm: + @pytest.mark.complete("gkrellm -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gm.py b/test/t/test_gm.py new file mode 100644 index 00000000..82d16702 --- /dev/null +++ b/test/t/test_gm.py @@ -0,0 +1,19 @@ +import pytest + + +class TestGm: + @pytest.mark.complete("gm ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("gm help ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("gm time ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("gm version ") + def test_4(self, completion): + assert not completion diff --git a/test/t/test_gmplayer.py b/test/t/test_gmplayer.py new file mode 100644 index 00000000..211ef515 --- /dev/null +++ b/test/t/test_gmplayer.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGmplayer: + @pytest.mark.complete("gmplayer ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gnatmake.py b/test/t/test_gnatmake.py new file mode 100644 index 00000000..c9f5609f --- /dev/null +++ b/test/t/test_gnatmake.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGnatmake: + @pytest.mark.complete("gnatmake ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gnokii.py b/test/t/test_gnokii.py new file mode 100644 index 00000000..106005f9 --- /dev/null +++ b/test/t/test_gnokii.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGnokii: + @pytest.mark.complete("gnokii ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gnome_mplayer.py b/test/t/test_gnome_mplayer.py new file mode 100644 index 00000000..5ee952c1 --- /dev/null +++ b/test/t/test_gnome_mplayer.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="gnome-mplayer") +class TestGnomeMplayer: + @pytest.mark.complete("gnome-mplayer ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gnome_screenshot.py b/test/t/test_gnome_screenshot.py new file mode 100644 index 00000000..476f57f1 --- /dev/null +++ b/test/t/test_gnome_screenshot.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="gnome-screenshot") +class TestGnomeScreenshot: + @pytest.mark.complete("gnome-screenshot --help") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gpasswd.py b/test/t/test_gpasswd.py new file mode 100644 index 00000000..43826a58 --- /dev/null +++ b/test/t/test_gpasswd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGpasswd: + @pytest.mark.complete("gpasswd ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gpc.py b/test/t/test_gpc.py new file mode 100644 index 00000000..9903ef45 --- /dev/null +++ b/test/t/test_gpc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGpc: + @pytest.mark.complete("gpc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gperf.py b/test/t/test_gperf.py new file mode 100644 index 00000000..f8267bf7 --- /dev/null +++ b/test/t/test_gperf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGperf: + @pytest.mark.complete("gperf --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gpg.py b/test/t/test_gpg.py new file mode 100644 index 00000000..8ead5e9a --- /dev/null +++ b/test/t/test_gpg.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGpg: + @pytest.mark.complete("gpg ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gpg2.py b/test/t/test_gpg2.py new file mode 100644 index 00000000..6a7ff333 --- /dev/null +++ b/test/t/test_gpg2.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGpg2: + @pytest.mark.complete("gpg2 --h") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gpgv.py b/test/t/test_gpgv.py new file mode 100644 index 00000000..05feb71f --- /dev/null +++ b/test/t/test_gpgv.py @@ -0,0 +1,15 @@ +import pytest + + +class TestGpgv: + @pytest.mark.complete("gpgv ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("gpgv -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("gpgv foo.sig foo ") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_gphoto2.py b/test/t/test_gphoto2.py new file mode 100644 index 00000000..830e6f6f --- /dev/null +++ b/test/t/test_gphoto2.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGphoto2: + @pytest.mark.complete("gphoto2 --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gplusplus.py b/test/t/test_gplusplus.py new file mode 100644 index 00000000..eeeb1bff --- /dev/null +++ b/test/t/test_gplusplus.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="g++") +class TestGPlusPlus: + @pytest.mark.complete("g++ ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gprof.py b/test/t/test_gprof.py new file mode 100644 index 00000000..417e0914 --- /dev/null +++ b/test/t/test_gprof.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGprof: + @pytest.mark.complete("gprof --", skipif="! gprof --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_grep.py b/test/t/test_grep.py new file mode 100644 index 00000000..d7d742ec --- /dev/null +++ b/test/t/test_grep.py @@ -0,0 +1,16 @@ +import pytest + + +class TestGrep: + @pytest.mark.complete("grep --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("grep --no-complete-dir f", cwd="shared/default") + def test_2(self, completion): + """ + Test --no-*dir isn't restricted to dirs only. + + Not really a grep option, but tests _longopt. + """ + assert completion == "foo foo.d/".split() diff --git a/test/t/test_groupadd.py b/test/t/test_groupadd.py new file mode 100644 index 00000000..efea4677 --- /dev/null +++ b/test/t/test_groupadd.py @@ -0,0 +1,11 @@ +import pytest + + +class TestGroupadd: + @pytest.mark.complete("groupadd ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("groupadd -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_groupdel.py b/test/t/test_groupdel.py new file mode 100644 index 00000000..1409e6cc --- /dev/null +++ b/test/t/test_groupdel.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGroupdel: + @pytest.mark.complete("groupdel ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_groupmems.py b/test/t/test_groupmems.py new file mode 100644 index 00000000..2faff633 --- /dev/null +++ b/test/t/test_groupmems.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGroupmems: + @pytest.mark.complete("groupmems -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_groupmod.py b/test/t/test_groupmod.py new file mode 100644 index 00000000..08b1d2e2 --- /dev/null +++ b/test/t/test_groupmod.py @@ -0,0 +1,11 @@ +import pytest + + +class TestGroupmod: + @pytest.mark.complete("groupmod ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("groupmod -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_growisofs.py b/test/t/test_growisofs.py new file mode 100644 index 00000000..7ce19f6b --- /dev/null +++ b/test/t/test_growisofs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGrowisofs: + @pytest.mark.complete("growisofs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_grpck.py b/test/t/test_grpck.py new file mode 100644 index 00000000..0d6a5cef --- /dev/null +++ b/test/t/test_grpck.py @@ -0,0 +1,11 @@ +import pytest + + +class TestGrpck: + @pytest.mark.complete("grpck ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("grpck -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_grub.py b/test/t/test_grub.py new file mode 100644 index 00000000..8ecd0209 --- /dev/null +++ b/test/t/test_grub.py @@ -0,0 +1,7 @@ +import pytest + + +class TestGrub: + @pytest.mark.complete("grub --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_gzip.py b/test/t/test_gzip.py new file mode 100644 index 00000000..3c2ecb6f --- /dev/null +++ b/test/t/test_gzip.py @@ -0,0 +1,11 @@ +import pytest + + +class TestGzip: + @pytest.mark.complete("gzip ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("gzip ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_hciattach.py b/test/t/test_hciattach.py new file mode 100644 index 00000000..2dc10956 --- /dev/null +++ b/test/t/test_hciattach.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHciattach: + @pytest.mark.complete("hciattach ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hciconfig.py b/test/t/test_hciconfig.py new file mode 100644 index 00000000..2a3f1fdf --- /dev/null +++ b/test/t/test_hciconfig.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHciconfig: + @pytest.mark.complete("hciconfig ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hcitool.py b/test/t/test_hcitool.py new file mode 100644 index 00000000..8725533f --- /dev/null +++ b/test/t/test_hcitool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHcitool: + @pytest.mark.complete("hcitool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hddtemp.py b/test/t/test_hddtemp.py new file mode 100644 index 00000000..e80a46cc --- /dev/null +++ b/test/t/test_hddtemp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHddtemp: + @pytest.mark.complete("hddtemp -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_head.py b/test/t/test_head.py new file mode 100644 index 00000000..a287034a --- /dev/null +++ b/test/t/test_head.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHead: + @pytest.mark.complete("head --", skipif="! head --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hexdump.py b/test/t/test_hexdump.py new file mode 100644 index 00000000..82b6d2ba --- /dev/null +++ b/test/t/test_hexdump.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHexdump: + @pytest.mark.complete("hexdump -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hid2hci.py b/test/t/test_hid2hci.py new file mode 100644 index 00000000..66766fbd --- /dev/null +++ b/test/t/test_hid2hci.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/lib/udev:$PATH",)) +class TestHid2hci: + @pytest.mark.complete("hid2hci -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_host.py b/test/t/test_host.py new file mode 100644 index 00000000..555a36f5 --- /dev/null +++ b/test/t/test_host.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHost: + @pytest.mark.complete("host -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hostname.py b/test/t/test_hostname.py new file mode 100644 index 00000000..5ccdf458 --- /dev/null +++ b/test/t/test_hostname.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHostname: + @pytest.mark.complete("hostname -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hping2.py b/test/t/test_hping2.py new file mode 100644 index 00000000..77e2ee26 --- /dev/null +++ b/test/t/test_hping2.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHping2: + @pytest.mark.complete("hping2 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_hping3.py b/test/t/test_hping3.py new file mode 100644 index 00000000..a979cfa7 --- /dev/null +++ b/test/t/test_hping3.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHping3: + @pytest.mark.complete("hping3 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_htop.py b/test/t/test_htop.py new file mode 100644 index 00000000..62022bbd --- /dev/null +++ b/test/t/test_htop.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHtop: + @pytest.mark.complete("htop -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_htpasswd.py b/test/t/test_htpasswd.py new file mode 100644 index 00000000..c17c0585 --- /dev/null +++ b/test/t/test_htpasswd.py @@ -0,0 +1,19 @@ +import pytest + + +class TestHtpasswd: + @pytest.mark.complete("htpasswd ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("htpasswd -n htpasswd/ht") + def test_2(self, completion): + assert not completion + + @pytest.mark.complete("htpasswd ", cwd="htpasswd") + def test_3(self, completion): + assert completion == "htpasswd" + + @pytest.mark.complete("htpasswd -D htpasswd ", cwd="htpasswd") + def test_4(self, completion): + assert completion == "foo quux".split() diff --git a/test/t/test_hunspell.py b/test/t/test_hunspell.py new file mode 100644 index 00000000..94ea1020 --- /dev/null +++ b/test/t/test_hunspell.py @@ -0,0 +1,11 @@ +import pytest + + +class TestHunspell: + @pytest.mark.complete("hunspell ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("hunspell -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_hwclock.py b/test/t/test_hwclock.py new file mode 100644 index 00000000..a9cb30fa --- /dev/null +++ b/test/t/test_hwclock.py @@ -0,0 +1,7 @@ +import pytest + + +class TestHwclock: + @pytest.mark.complete("hwclock -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iconv.py b/test/t/test_iconv.py new file mode 100644 index 00000000..dc5f8961 --- /dev/null +++ b/test/t/test_iconv.py @@ -0,0 +1,11 @@ +import pytest + + +class TestIconv: + @pytest.mark.complete("iconv -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("iconv -f UTF") + def test_2(self, completion): + assert completion diff --git a/test/t/test_id.py b/test/t/test_id.py new file mode 100644 index 00000000..41f2868a --- /dev/null +++ b/test/t/test_id.py @@ -0,0 +1,7 @@ +import pytest + + +class TestId: + @pytest.mark.complete("id -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_identify.py b/test/t/test_identify.py new file mode 100644 index 00000000..12fba008 --- /dev/null +++ b/test/t/test_identify.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIdentify: + @pytest.mark.complete("identify -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_idn.py b/test/t/test_idn.py new file mode 100644 index 00000000..1fd1ce02 --- /dev/null +++ b/test/t/test_idn.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIdn: + @pytest.mark.complete("idn -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ifdown.py b/test/t/test_ifdown.py new file mode 100644 index 00000000..16447be5 --- /dev/null +++ b/test/t/test_ifdown.py @@ -0,0 +1,14 @@ +import pytest + +from conftest import in_docker + + +class TestIfdown: + @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") + @pytest.mark.complete("ifdown ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ifdown bash-completion ") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_ifstat.py b/test/t/test_ifstat.py new file mode 100644 index 00000000..e4d828ee --- /dev/null +++ b/test/t/test_ifstat.py @@ -0,0 +1,19 @@ +import pytest + + +class TestIfstat: + @pytest.mark.complete("ifstat -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete( + "ifstat -i ", skipif="ifstat -v | command grep -qF iproute2" + ) + def test_2(self, completion): + assert completion + + @pytest.mark.complete( + "ifstat -d ", skipif="ifstat -v | command grep -qF iproute2" + ) + def test_3(self, completion): + assert completion diff --git a/test/t/test_iftop.py b/test/t/test_iftop.py new file mode 100644 index 00000000..9a25c28a --- /dev/null +++ b/test/t/test_iftop.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIftop: + @pytest.mark.complete("iftop ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ifup.py b/test/t/test_ifup.py new file mode 100644 index 00000000..62d8eb4a --- /dev/null +++ b/test/t/test_ifup.py @@ -0,0 +1,18 @@ +import pytest + +from conftest import in_docker + + +class TestIfup: + @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") + @pytest.mark.complete("ifup ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ifup --", skipif="! ifup --help &>/dev/null") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("ifup bash-completion ") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_import.py b/test/t/test_import.py new file mode 100644 index 00000000..2e860650 --- /dev/null +++ b/test/t/test_import.py @@ -0,0 +1,7 @@ +import pytest + + +class TestImport: + @pytest.mark.complete("import ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_info.py b/test/t/test_info.py new file mode 100644 index 00000000..b52b682e --- /dev/null +++ b/test/t/test_info.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("INFOPATH+=:$PWD/info:",)) +class TestInfo: + @pytest.mark.complete("info bash") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("info -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_inject.py b/test/t/test_inject.py new file mode 100644 index 00000000..37680dca --- /dev/null +++ b/test/t/test_inject.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestInject: + @pytest.mark.complete("inject ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_inotifywait.py b/test/t/test_inotifywait.py new file mode 100644 index 00000000..fe647ad6 --- /dev/null +++ b/test/t/test_inotifywait.py @@ -0,0 +1,15 @@ +import pytest + + +class TestInotifywait: + @pytest.mark.complete("inotifywait ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("inotifywait --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("inotifywait -e ") + def test_3(self, completion): + assert completion diff --git a/test/t/test_inotifywatch.py b/test/t/test_inotifywatch.py new file mode 100644 index 00000000..e0e686e8 --- /dev/null +++ b/test/t/test_inotifywatch.py @@ -0,0 +1,15 @@ +import pytest + + +class TestInotifywatch: + @pytest.mark.complete("inotifywatch ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("inotifywatch --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("inotifywatch -e ") + def test_3(self, completion): + assert len(completion) > 1 diff --git a/test/t/test_insmod.py b/test/t/test_insmod.py new file mode 100644 index 00000000..9636185d --- /dev/null +++ b/test/t/test_insmod.py @@ -0,0 +1,7 @@ +import pytest + + +class TestInsmod: + @pytest.mark.complete("insmod ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_installpkg.py b/test/t/test_installpkg.py new file mode 100644 index 00000000..4e5ab27c --- /dev/null +++ b/test/t/test_installpkg.py @@ -0,0 +1,39 @@ +import fnmatch +import os + +import pytest + + +class TestInstallpkg: + @pytest.mark.complete("installpkg -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("installpkg --") + def test_2(self, completion): + assert ( + completion == "--ask --infobox --md5sum --menu " + "--priority --root --tagfile --terse --warn".split() + ) + + @pytest.mark.complete("installpkg --root ") + def test_3(self, completion): + dirs = sorted(x for x in os.listdir(".") if os.path.isdir("./%s" % x)) + assert completion == ["%s/" % x for x in dirs] + + @pytest.mark.complete("installpkg --root ") + def test_4(self, completion): + expected = sorted( + [ + "%s/" % x + for x in os.listdir("slackware/home") + if os.path.isdir("./%s" % x) + ] + + [ + x + for x in os.listdir("slackware/home") + if os.path.isfile("./%s" % x) + and fnmatch.fnmatch(x, "*.t[bglx]z") + ] + ) + assert completion == expected diff --git a/test/t/test_interdiff.py b/test/t/test_interdiff.py new file mode 100644 index 00000000..e681fd6c --- /dev/null +++ b/test/t/test_interdiff.py @@ -0,0 +1,7 @@ +import pytest + + +class TestInterdiff: + @pytest.mark.complete("interdiff ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_invoke_rc_d.py b/test/t/test_invoke_rc_d.py new file mode 100644 index 00000000..61e2987b --- /dev/null +++ b/test/t/test_invoke_rc_d.py @@ -0,0 +1,14 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="invoke-rc.d") +class TestInvokeRcD: + @pytest.mark.complete("invoke-rc.d ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("invoke-rc.d --no-fallback --") + def test_2(self, completion): + """Test already specified option is not offered.""" + assert completion + assert "--no-fallback" not in completion diff --git a/test/t/test_ionice.py b/test/t/test_ionice.py new file mode 100644 index 00000000..ae047043 --- /dev/null +++ b/test/t/test_ionice.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIonice: + @pytest.mark.complete("ionice -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ip.py b/test/t/test_ip.py new file mode 100644 index 00000000..20752505 --- /dev/null +++ b/test/t/test_ip.py @@ -0,0 +1,11 @@ +import pytest + + +class TestIp: + @pytest.mark.complete("ip ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ip a ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_iperf.py b/test/t/test_iperf.py new file mode 100644 index 00000000..23f4df55 --- /dev/null +++ b/test/t/test_iperf.py @@ -0,0 +1,20 @@ +import pytest + + +class TestIperf: + @pytest.mark.complete("iperf ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("iperf --bind ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("iperf --client foo --") + def test_3(self, completion): + assert completion + assert "--daemon" not in completion + + @pytest.mark.complete("iperf --server --") + def test_4(self, completion): + assert "--daemon" in completion diff --git a/test/t/test_iperf3.py b/test/t/test_iperf3.py new file mode 100644 index 00000000..cd93a996 --- /dev/null +++ b/test/t/test_iperf3.py @@ -0,0 +1,20 @@ +import pytest + + +class TestIperf3: + @pytest.mark.complete("iperf3 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("iperf3 --bind ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("iperf3 --client foo --") + def test_3(self, completion): + assert completion + assert "--daemon" not in completion + + @pytest.mark.complete("iperf3 --server --") + def test_4(self, completion): + assert "--daemon" in completion diff --git a/test/t/test_ipmitool.py b/test/t/test_ipmitool.py new file mode 100644 index 00000000..5f50ec79 --- /dev/null +++ b/test/t/test_ipmitool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIpmitool: + @pytest.mark.complete("ipmitool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ipsec.py b/test/t/test_ipsec.py new file mode 100644 index 00000000..5ff29c74 --- /dev/null +++ b/test/t/test_ipsec.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIpsec: + @pytest.mark.complete("ipsec ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iptables.py b/test/t/test_iptables.py new file mode 100644 index 00000000..7a30bb82 --- /dev/null +++ b/test/t/test_iptables.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIptables: + @pytest.mark.complete("iptables -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ipv6calc.py b/test/t/test_ipv6calc.py new file mode 100644 index 00000000..435af149 --- /dev/null +++ b/test/t/test_ipv6calc.py @@ -0,0 +1,11 @@ +import pytest + + +class TestIpv6calc: + @pytest.mark.complete("ipv6calc -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ipv6calc --in ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_irb.py b/test/t/test_irb.py new file mode 100644 index 00000000..31c46e20 --- /dev/null +++ b/test/t/test_irb.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIrb: + @pytest.mark.complete("irb ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iscsiadm.py b/test/t/test_iscsiadm.py new file mode 100644 index 00000000..932ffeb5 --- /dev/null +++ b/test/t/test_iscsiadm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIscsiadm: + @pytest.mark.complete("iscsiadm --mode") + def test_1(self, completion): + assert completion diff --git a/test/t/test_isort.py b/test/t/test_isort.py new file mode 100644 index 00000000..4fae3244 --- /dev/null +++ b/test/t/test_isort.py @@ -0,0 +1,11 @@ +import pytest + + +class TestIsort: + @pytest.mark.complete("isort ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("isort -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_isql.py b/test/t/test_isql.py new file mode 100644 index 00000000..7ff0bdb4 --- /dev/null +++ b/test/t/test_isql.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("ODBCINI=isql/odbc.ini",)) +class TestIsql: + @pytest.mark.complete("isql ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iwconfig.py b/test/t/test_iwconfig.py new file mode 100644 index 00000000..3ac4b31a --- /dev/null +++ b/test/t/test_iwconfig.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIwconfig: + @pytest.mark.complete("iwconfig --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iwlist.py b/test/t/test_iwlist.py new file mode 100644 index 00000000..77ffb99c --- /dev/null +++ b/test/t/test_iwlist.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIwlist: + @pytest.mark.complete("iwlist --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iwpriv.py b/test/t/test_iwpriv.py new file mode 100644 index 00000000..dac214ae --- /dev/null +++ b/test/t/test_iwpriv.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIwpriv: + @pytest.mark.complete("iwpriv --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_iwspy.py b/test/t/test_iwspy.py new file mode 100644 index 00000000..398df371 --- /dev/null +++ b/test/t/test_iwspy.py @@ -0,0 +1,7 @@ +import pytest + + +class TestIwspy: + @pytest.mark.complete("iwspy --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_jar.py b/test/t/test_jar.py new file mode 100644 index 00000000..5d4ed8a9 --- /dev/null +++ b/test/t/test_jar.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJar: + @pytest.mark.complete("jar ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_jarsigner.py b/test/t/test_jarsigner.py new file mode 100644 index 00000000..a6efa6a3 --- /dev/null +++ b/test/t/test_jarsigner.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJarsigner: + @pytest.mark.complete("jarsigner ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_java.py b/test/t/test_java.py new file mode 100644 index 00000000..81f07c68 --- /dev/null +++ b/test/t/test_java.py @@ -0,0 +1,30 @@ +import pytest + + +@pytest.mark.bashcomp( + pre_cmds=("CLASSPATH=$PWD/java/a:$PWD/java/bashcomp.jar",) +) +class TestJava: + @pytest.mark.complete("java -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("java ") + def test_2(self, completion): + assert completion == "b bashcomp.jarred c. toplevel".split() + + @pytest.mark.complete("java -classpath java/bashcomp.jar ") + def test_3(self, completion): + assert completion == "bashcomp.jarred toplevel".split() + + @pytest.mark.complete("java -cp java/bashcomp.jar:java/a/c ") + def test_4(self, completion): + assert completion == "bashcomp.jarred d toplevel".split() + + @pytest.mark.complete("java -cp '' ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete("java -jar java/") + def test_6(self, completion): + assert completion == "a/ bashcomp.jar bashcomp.war".split() diff --git a/test/t/test_javac.py b/test/t/test_javac.py new file mode 100644 index 00000000..197004e7 --- /dev/null +++ b/test/t/test_javac.py @@ -0,0 +1,11 @@ +import pytest + + +class TestJavac: + @pytest.mark.complete("javac ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("javac -cp java/") + def test_2(self, completion): + assert completion == "a/ bashcomp.jar".split() diff --git a/test/t/test_javadoc.py b/test/t/test_javadoc.py new file mode 100644 index 00000000..395d196d --- /dev/null +++ b/test/t/test_javadoc.py @@ -0,0 +1,17 @@ +import pytest + + +class TestJavadoc: + @pytest.mark.complete("javadoc ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("javadoc -linkoffline shared/default/") + def test_2(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete( + "javadoc -nodeprecated -linkoffline foo shared/default/" + ) + def test_3(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] diff --git a/test/t/test_javaws.py b/test/t/test_javaws.py new file mode 100644 index 00000000..9f51c58b --- /dev/null +++ b/test/t/test_javaws.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJavaws: + @pytest.mark.complete("javaws ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_jpegoptim.py b/test/t/test_jpegoptim.py new file mode 100644 index 00000000..01eb739c --- /dev/null +++ b/test/t/test_jpegoptim.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJpegoptim: + @pytest.mark.complete("jpegoptim ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_jps.py b/test/t/test_jps.py new file mode 100644 index 00000000..add9ef97 --- /dev/null +++ b/test/t/test_jps.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJps: + @pytest.mark.complete("jps -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_jq.py b/test/t/test_jq.py new file mode 100644 index 00000000..c858411f --- /dev/null +++ b/test/t/test_jq.py @@ -0,0 +1,31 @@ +import pytest + + +class TestJq: + @pytest.mark.complete("jq ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("jq . ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete( + "jq -", + skipif="! (jq --help 2>&1 || :) | " + "command grep -qF 'options include'", + ) + def test_3(self, completion): + assert completion + + @pytest.mark.complete("jq --arg ") + def test_4(self, completion): + assert not completion + + @pytest.mark.complete("jq --slurpfile ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete("jq --slurpfile foo ") + def test_6(self, completion): + assert completion diff --git a/test/t/test_jshint.py b/test/t/test_jshint.py new file mode 100644 index 00000000..511e7c9d --- /dev/null +++ b/test/t/test_jshint.py @@ -0,0 +1,7 @@ +import pytest + + +class TestJshint: + @pytest.mark.complete("jshint ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_json_xs.py b/test/t/test_json_xs.py new file mode 100644 index 00000000..f6174b10 --- /dev/null +++ b/test/t/test_json_xs.py @@ -0,0 +1,11 @@ +import pytest + + +class TestJsonXs: + @pytest.mark.complete("json_xs ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("json_xs -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_jsonschema.py b/test/t/test_jsonschema.py new file mode 100644 index 00000000..0905fd7f --- /dev/null +++ b/test/t/test_jsonschema.py @@ -0,0 +1,11 @@ +import pytest + + +class TestJsonschema: + @pytest.mark.complete("jsonschema ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("jsonschema -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_k3b.py b/test/t/test_k3b.py new file mode 100644 index 00000000..d9940ba5 --- /dev/null +++ b/test/t/test_k3b.py @@ -0,0 +1,7 @@ +import pytest + + +class TestK3b: + @pytest.mark.complete("k3b ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_kcov.py b/test/t/test_kcov.py new file mode 100644 index 00000000..ce985a78 --- /dev/null +++ b/test/t/test_kcov.py @@ -0,0 +1,16 @@ +import pytest + + +class TestKcov: + @pytest.mark.complete("kcov ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("kcov --exclude-patter") + def test_2(self, completion): + assert completion == "--exclude-pattern=" + assert completion.endswith("=") + + @pytest.mark.complete("kcov -l 42,") + def test_3(self, completion): + assert completion diff --git a/test/t/test_kdvi.py b/test/t/test_kdvi.py new file mode 100644 index 00000000..7fb11cb0 --- /dev/null +++ b/test/t/test_kdvi.py @@ -0,0 +1,10 @@ +import pytest + + +class TestKdvi: + @pytest.mark.complete("kdvi ", cwd="kdvi") + def test_1(self, completion): + assert ( + completion == "foo/ .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz " + ".DVI.gz .dvi.Z .DVI.Z".split() + ) diff --git a/test/t/test_kill.py b/test/t/test_kill.py new file mode 100644 index 00000000..59d5fa2b --- /dev/null +++ b/test/t/test_kill.py @@ -0,0 +1,15 @@ +import pytest + + +class TestKill: + @pytest.mark.complete("kill 1", skipif="! type ps &>/dev/null") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("kill -s ") + def test_2(self, completion): + assert all(x in completion for x in "HUP QUIT".split()) + + @pytest.mark.complete("kill -") + def test_3(self, completion): + assert all("-%s" % x in completion for x in "l s ABRT USR1".split()) diff --git a/test/t/test_killall.py b/test/t/test_killall.py new file mode 100644 index 00000000..725a16e4 --- /dev/null +++ b/test/t/test_killall.py @@ -0,0 +1,13 @@ +import pytest + + +class TestKillall: + + # "p": Assume our process name completion runs ps and at least it is shown + @pytest.mark.complete("killall p") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("killall --signal ") + def test_2(self, completion): + assert all(x in completion for x in "INT KILL TERM".split()) diff --git a/test/t/test_kldload.py b/test/t/test_kldload.py new file mode 100644 index 00000000..2965e446 --- /dev/null +++ b/test/t/test_kldload.py @@ -0,0 +1,7 @@ +import pytest + + +class TestKldload: + @pytest.mark.complete("kldload ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_kldunload.py b/test/t/test_kldunload.py new file mode 100644 index 00000000..a52c99eb --- /dev/null +++ b/test/t/test_kldunload.py @@ -0,0 +1,16 @@ +import subprocess + +import pytest + + +class TestKldunload: + @pytest.mark.complete("kldunload ") + def test_1(self, completion): + try: + subprocess.check_call( + r"kldstat 2>/dev/null | command grep -q '\.ko$'", shell=True + ) + except BaseException: + assert not completion + else: + assert completion diff --git a/test/t/test_koji.py b/test/t/test_koji.py new file mode 100644 index 00000000..68a8477b --- /dev/null +++ b/test/t/test_koji.py @@ -0,0 +1,11 @@ +import pytest + + +class TestKoji: + @pytest.mark.complete("koji ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("koji -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_kpdf.py b/test/t/test_kpdf.py new file mode 100644 index 00000000..ceee34d3 --- /dev/null +++ b/test/t/test_kpdf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestKpdf: + @pytest.mark.complete("kpdf ", cwd="kpdf") + def test_1(self, completion): + assert completion == "foo/ .eps .ps .EPS .PS .pdf .PDF".split() diff --git a/test/t/test_kplayer.py b/test/t/test_kplayer.py new file mode 100644 index 00000000..ef8a08e6 --- /dev/null +++ b/test/t/test_kplayer.py @@ -0,0 +1,7 @@ +import pytest + + +class TestKplayer: + @pytest.mark.complete("kplayer ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ktutil.py b/test/t/test_ktutil.py new file mode 100644 index 00000000..7c90b802 --- /dev/null +++ b/test/t/test_ktutil.py @@ -0,0 +1,11 @@ +import pytest + + +class TestKtutil: + @pytest.mark.complete("ktutil ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ktutil -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_l2ping.py b/test/t/test_l2ping.py new file mode 100644 index 00000000..7979d734 --- /dev/null +++ b/test/t/test_l2ping.py @@ -0,0 +1,7 @@ +import pytest + + +class TestL2ping: + @pytest.mark.complete("l2ping -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_larch.py b/test/t/test_larch.py new file mode 100644 index 00000000..e68183c1 --- /dev/null +++ b/test/t/test_larch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLarch: + @pytest.mark.complete("larch library-") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lastlog.py b/test/t/test_lastlog.py new file mode 100644 index 00000000..043af962 --- /dev/null +++ b/test/t/test_lastlog.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLastlog: + @pytest.mark.complete("lastlog -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ld.py b/test/t/test_ld.py new file mode 100644 index 00000000..a82f091b --- /dev/null +++ b/test/t/test_ld.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLd: + @pytest.mark.complete("ld ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapadd.py b/test/t/test_ldapadd.py new file mode 100644 index 00000000..24aa5e39 --- /dev/null +++ b/test/t/test_ldapadd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapadd: + @pytest.mark.complete("ldapadd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapcompare.py b/test/t/test_ldapcompare.py new file mode 100644 index 00000000..6a3afe9a --- /dev/null +++ b/test/t/test_ldapcompare.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapcompare: + @pytest.mark.complete("ldapcompare -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapdelete.py b/test/t/test_ldapdelete.py new file mode 100644 index 00000000..2065d9bc --- /dev/null +++ b/test/t/test_ldapdelete.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapdelete: + @pytest.mark.complete("ldapdelete -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapmodrdn.py b/test/t/test_ldapmodrdn.py new file mode 100644 index 00000000..da8bdbdc --- /dev/null +++ b/test/t/test_ldapmodrdn.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapmodrdn: + @pytest.mark.complete("ldapmodrdn -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldappasswd.py b/test/t/test_ldappasswd.py new file mode 100644 index 00000000..e559f23b --- /dev/null +++ b/test/t/test_ldappasswd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdappasswd: + @pytest.mark.complete("ldappasswd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapsearch.py b/test/t/test_ldapsearch.py new file mode 100644 index 00000000..43797f41 --- /dev/null +++ b/test/t/test_ldapsearch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapsearch: + @pytest.mark.complete("ldapsearch -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapvi.py b/test/t/test_ldapvi.py new file mode 100644 index 00000000..a81ae180 --- /dev/null +++ b/test/t/test_ldapvi.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapvi: + @pytest.mark.complete("ldapvi -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldapwhoami.py b/test/t/test_ldapwhoami.py new file mode 100644 index 00000000..9dcfb5f8 --- /dev/null +++ b/test/t/test_ldapwhoami.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdapwhoami: + @pytest.mark.complete("ldapwhoami -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ldd.py b/test/t/test_ldd.py new file mode 100644 index 00000000..8c463b60 --- /dev/null +++ b/test/t/test_ldd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLdd: + @pytest.mark.complete("ldd ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_less.py b/test/t/test_less.py new file mode 100644 index 00000000..79cdf183 --- /dev/null +++ b/test/t/test_less.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLess: + @pytest.mark.complete("less --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lftp.py b/test/t/test_lftp.py new file mode 100644 index 00000000..18506f61 --- /dev/null +++ b/test/t/test_lftp.py @@ -0,0 +1,14 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/lftp",)) +class TestLftp: + @pytest.mark.complete("lftp ") + def test_1(self, bash, completion): + hosts = assert_bash_exec( + bash, "compgen -A hostname", want_output=True + ).split() + assert all(x in completion for x in hosts) + assert "lftptest" in completion # defined in lftp/.lftp/bookmarks diff --git a/test/t/test_lftpget.py b/test/t/test_lftpget.py new file mode 100644 index 00000000..c1f453e9 --- /dev/null +++ b/test/t/test_lftpget.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLftpget: + @pytest.mark.complete("lftpget -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lilo.py b/test/t/test_lilo.py new file mode 100644 index 00000000..9783f506 --- /dev/null +++ b/test/t/test_lilo.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLilo: + @pytest.mark.complete("lilo -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_links.py b/test/t/test_links.py new file mode 100644 index 00000000..f21b8728 --- /dev/null +++ b/test/t/test_links.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLinks: + @pytest.mark.complete("links ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("links -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lintian.py b/test/t/test_lintian.py new file mode 100644 index 00000000..c6526426 --- /dev/null +++ b/test/t/test_lintian.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLintian: + @pytest.mark.complete("lintian --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lintian_info.py b/test/t/test_lintian_info.py new file mode 100644 index 00000000..6bcc9e52 --- /dev/null +++ b/test/t/test_lintian_info.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="lintian-info") +class TestLintianInfo: + @pytest.mark.complete("lintian-info ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lintian-info --") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lisp.py b/test/t/test_lisp.py new file mode 100644 index 00000000..84770610 --- /dev/null +++ b/test/t/test_lisp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLisp: + @pytest.mark.complete("lisp ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_list_admins.py b/test/t/test_list_admins.py new file mode 100644 index 00000000..b65387e5 --- /dev/null +++ b/test/t/test_list_admins.py @@ -0,0 +1,7 @@ +import pytest + + +class TestListAdmins: + @pytest.mark.complete("list_admins -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_list_lists.py b/test/t/test_list_lists.py new file mode 100644 index 00000000..966ca251 --- /dev/null +++ b/test/t/test_list_lists.py @@ -0,0 +1,7 @@ +import pytest + + +class TestListLists: + @pytest.mark.complete("list_lists -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_list_members.py b/test/t/test_list_members.py new file mode 100644 index 00000000..96ea2ef3 --- /dev/null +++ b/test/t/test_list_members.py @@ -0,0 +1,7 @@ +import pytest + + +class TestListMembers: + @pytest.mark.complete("list_members -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_list_owners.py b/test/t/test_list_owners.py new file mode 100644 index 00000000..2a6bcab8 --- /dev/null +++ b/test/t/test_list_owners.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestListOwners: + @pytest.mark.complete("list_owners -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ln.py b/test/t/test_ln.py new file mode 100644 index 00000000..de053345 --- /dev/null +++ b/test/t/test_ln.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLn: + @pytest.mark.complete("ln ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_locale_gen.py b/test/t/test_locale_gen.py new file mode 100644 index 00000000..41ac376f --- /dev/null +++ b/test/t/test_locale_gen.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="locale-gen") +class TestLocaleGen: + @pytest.mark.complete("locale-gen ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("locale-gen --") + def test_2(self, completion): + assert completion diff --git a/test/t/test_look.py b/test/t/test_look.py new file mode 100644 index 00000000..fd6800e5 --- /dev/null +++ b/test/t/test_look.py @@ -0,0 +1,16 @@ +import subprocess + +import pytest + + +class TestLook: + @pytest.mark.complete("look foo") + def test_1(self, completion): + try: + subprocess.check_call( + "look foo 2>/dev/null | command grep -q ^foo", shell=True + ) + except BaseException: + assert not completion + else: + assert completion diff --git a/test/t/test_lpq.py b/test/t/test_lpq.py new file mode 100644 index 00000000..0d69270d --- /dev/null +++ b/test/t/test_lpq.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLpq: + @pytest.mark.complete("lpq ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lpr.py b/test/t/test_lpr.py new file mode 100644 index 00000000..30c710bb --- /dev/null +++ b/test/t/test_lpr.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLpr: + @pytest.mark.complete("lpr ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lrzip.py b/test/t/test_lrzip.py new file mode 100644 index 00000000..266d8a30 --- /dev/null +++ b/test/t/test_lrzip.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLrzip: + @pytest.mark.complete("lrzip ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lrzip ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_ls.py b/test/t/test_ls.py new file mode 100644 index 00000000..ed5ad9c4 --- /dev/null +++ b/test/t/test_ls.py @@ -0,0 +1,38 @@ +import pytest + +from conftest import ( + assert_bash_exec, + assert_complete, + find_unique_completion_pair, +) + + +class TestLs: + @pytest.mark.complete("ls --", skipif="! ls --help &>/dev/null") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ls ~") + def test_2(self, completion): + assert completion + + def test_3(self, bash): + """~part should complete to ~full<SPACE> if home dir does not exist.""" + res = ( + assert_bash_exec( + bash, + "for u in $(compgen -u); do " + "eval test -d ~$u || echo $u; unset u; done", + want_output=True, + ) + .strip() + .split() + ) + part_full = find_unique_completion_pair(res) + if not part_full: + pytest.skip("No suitable test user found") + return + part, full = part_full + completion = assert_complete(bash, "ls ~%s" % part) + assert completion == "~%s" % full + assert completion.endswith(" ") diff --git a/test/t/test_lsof.py b/test/t/test_lsof.py new file mode 100644 index 00000000..170d2690 --- /dev/null +++ b/test/t/test_lsof.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLsof: + @pytest.mark.complete("lsof ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lsof -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lspci.py b/test/t/test_lspci.py new file mode 100644 index 00000000..44663426 --- /dev/null +++ b/test/t/test_lspci.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLspci: + @pytest.mark.complete("lspci -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lspci -A ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lsscsi.py b/test/t/test_lsscsi.py new file mode 100644 index 00000000..a297b375 --- /dev/null +++ b/test/t/test_lsscsi.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLsscsi: + @pytest.mark.complete("lsscsi ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("lsscsi -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lsusb.py b/test/t/test_lsusb.py new file mode 100644 index 00000000..9c546d32 --- /dev/null +++ b/test/t/test_lsusb.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLsusb: + @pytest.mark.complete("lsusb -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lua.py b/test/t/test_lua.py new file mode 100644 index 00000000..edcae883 --- /dev/null +++ b/test/t/test_lua.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLua: + @pytest.mark.complete("lua ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_luac.py b/test/t/test_luac.py new file mode 100644 index 00000000..f14d400a --- /dev/null +++ b/test/t/test_luac.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLuac: + @pytest.mark.complete("luac ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_luseradd.py b/test/t/test_luseradd.py new file mode 100644 index 00000000..35c89e54 --- /dev/null +++ b/test/t/test_luseradd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLuseradd: + @pytest.mark.complete("luseradd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_luserdel.py b/test/t/test_luserdel.py new file mode 100644 index 00000000..cdca2a57 --- /dev/null +++ b/test/t/test_luserdel.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLuserdel: + @pytest.mark.complete("luserdel ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lusermod.py b/test/t/test_lusermod.py new file mode 100644 index 00000000..69ef07c2 --- /dev/null +++ b/test/t/test_lusermod.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLusermod: + @pytest.mark.complete("lusermod ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvchange.py b/test/t/test_lvchange.py new file mode 100644 index 00000000..5722a581 --- /dev/null +++ b/test/t/test_lvchange.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvchange: + @pytest.mark.complete( + "lvchange --", skipif="! lvchange --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvcreate.py b/test/t/test_lvcreate.py new file mode 100644 index 00000000..e60432f6 --- /dev/null +++ b/test/t/test_lvcreate.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvcreate: + @pytest.mark.complete( + "lvcreate --", skipif="! lvcreate --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvdisplay.py b/test/t/test_lvdisplay.py new file mode 100644 index 00000000..e9a955ed --- /dev/null +++ b/test/t/test_lvdisplay.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvdisplay: + @pytest.mark.complete( + "lvdisplay --", skipif="! lvdisplay --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvextend.py b/test/t/test_lvextend.py new file mode 100644 index 00000000..68e17848 --- /dev/null +++ b/test/t/test_lvextend.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvextend: + @pytest.mark.complete( + "lvextend --", skipif="! lvextend --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvm.py b/test/t/test_lvm.py new file mode 100644 index 00000000..ea25b977 --- /dev/null +++ b/test/t/test_lvm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLvm: + @pytest.mark.complete("lvm pv") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvmdiskscan.py b/test/t/test_lvmdiskscan.py new file mode 100644 index 00000000..0716d5c4 --- /dev/null +++ b/test/t/test_lvmdiskscan.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvmdiskscan: + @pytest.mark.complete( + "lvmdiskscan --", skipif="! lvmdiskscan --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvreduce.py b/test/t/test_lvreduce.py new file mode 100644 index 00000000..50b038fd --- /dev/null +++ b/test/t/test_lvreduce.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvreduce: + @pytest.mark.complete( + "lvreduce --", skipif="! lvreduce --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvremove.py b/test/t/test_lvremove.py new file mode 100644 index 00000000..53950aec --- /dev/null +++ b/test/t/test_lvremove.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvremove: + @pytest.mark.complete( + "lvremove --", skipif="! lvremove --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvrename.py b/test/t/test_lvrename.py new file mode 100644 index 00000000..c60469f5 --- /dev/null +++ b/test/t/test_lvrename.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvrename: + @pytest.mark.complete( + "lvrename --", skipif="! lvrename --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvresize.py b/test/t/test_lvresize.py new file mode 100644 index 00000000..aecc8bf4 --- /dev/null +++ b/test/t/test_lvresize.py @@ -0,0 +1,9 @@ +import pytest + + +class TestLvresize: + @pytest.mark.complete( + "lvresize --", skipif="! lvresize --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvs.py b/test/t/test_lvs.py new file mode 100644 index 00000000..456368b9 --- /dev/null +++ b/test/t/test_lvs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLvs: + @pytest.mark.complete("lvs --", skipif="! lvs --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lvscan.py b/test/t/test_lvscan.py new file mode 100644 index 00000000..4848fe4c --- /dev/null +++ b/test/t/test_lvscan.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLvscan: + @pytest.mark.complete("lvscan --", skipif="! lvscan --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lz4.py b/test/t/test_lz4.py new file mode 100644 index 00000000..0d873b66 --- /dev/null +++ b/test/t/test_lz4.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLz4: + @pytest.mark.complete("lz4 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lz4 ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_lzip.py b/test/t/test_lzip.py new file mode 100644 index 00000000..6f1dc023 --- /dev/null +++ b/test/t/test_lzip.py @@ -0,0 +1,7 @@ +import pytest + + +class TestLzip: + @pytest.mark.complete("lzip ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_lzma.py b/test/t/test_lzma.py new file mode 100644 index 00000000..f9d89926 --- /dev/null +++ b/test/t/test_lzma.py @@ -0,0 +1,19 @@ +import pytest + + +class TestLzma: + @pytest.mark.complete("lzma ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lzma -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("lzma -d xz/") + def test_3(self, completion): + assert completion == "a/ bashcomp.lzma bashcomp.tlz".split() + + @pytest.mark.complete("lzma ~") + def test_4(self, completion): + assert completion diff --git a/test/t/test_lzop.py b/test/t/test_lzop.py new file mode 100644 index 00000000..bd010fde --- /dev/null +++ b/test/t/test_lzop.py @@ -0,0 +1,11 @@ +import pytest + + +class TestLzop: + @pytest.mark.complete("lzop ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("lzop ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_m4.py b/test/t/test_m4.py new file mode 100644 index 00000000..d80a7538 --- /dev/null +++ b/test/t/test_m4.py @@ -0,0 +1,7 @@ +import pytest + + +class TestM4: + @pytest.mark.complete("m4 --", skipif="! m4 --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_macof.py b/test/t/test_macof.py new file mode 100644 index 00000000..8030c379 --- /dev/null +++ b/test/t/test_macof.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMacof: + @pytest.mark.complete("macof -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mailmanctl.py b/test/t/test_mailmanctl.py new file mode 100644 index 00000000..2baa0500 --- /dev/null +++ b/test/t/test_mailmanctl.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",)) +class TestMailmanctl: + @pytest.mark.complete("mailmanctl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mailsnarf.py b/test/t/test_mailsnarf.py new file mode 100644 index 00000000..4e264a6e --- /dev/null +++ b/test/t/test_mailsnarf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMailsnarf: + @pytest.mark.complete("mailsnarf -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_make.py b/test/t/test_make.py new file mode 100644 index 00000000..9c76f83c --- /dev/null +++ b/test/t/test_make.py @@ -0,0 +1,50 @@ +import os + +import pytest + +from conftest import in_docker + + +class TestMake: + @pytest.mark.complete("make -f Ma", cwd="make") + def test_1(self, completion): + assert completion == "Makefile" + + @pytest.mark.complete("make .", cwd="make") + def test_2(self, bash, completion): + """Hidden targets.""" + assert completion == ".cache/ .test_passes".split() + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) + + @pytest.mark.complete("make .cache/", cwd="make") + def test_3(self, bash, completion): + assert completion == "1 2".split() + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) + + @pytest.mark.complete("make ", cwd="shared/empty_dir") + def test_4(self, completion): + assert not completion + + @pytest.mark.complete("make -j ") + def test_5(self, completion): + assert completion + + @pytest.mark.complete("make ", cwd="make") + def test_6(self, bash, completion): + assert completion == "all clean extra_makefile install sample".split() + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) + + @pytest.mark.xfail( + in_docker() and os.environ.get("DIST") == "centos6", + reason="Fails for some unknown reason on CentOS 6, " + "even though the behavior appears to be correct", + ) + @pytest.mark.complete("make .cache/.", cwd="make") + def test_7(self, bash, completion): + assert completion == ".1 .2".split() + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) + + @pytest.mark.complete("make -C make ") + def test_8(self, bash, completion): + assert completion == "all clean extra_makefile install sample".split() + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) diff --git a/test/t/test_makepkg.py b/test/t/test_makepkg.py new file mode 100644 index 00000000..65f49ea8 --- /dev/null +++ b/test/t/test_makepkg.py @@ -0,0 +1,14 @@ +import pytest + + +@pytest.mark.bashcomp(skipif="! makepkg --help 2>&1 | grep -qiF slackware") +class TestMakepkg: + @pytest.mark.complete("makepkg ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("makepkg --") + def test_2(self, completion): + assert all( + x in completion for x in "--chown --linkadd --prepend".split() + ) diff --git a/test/t/test_man.py b/test/t/test_man.py new file mode 100644 index 00000000..60021d99 --- /dev/null +++ b/test/t/test_man.py @@ -0,0 +1,108 @@ +import os + +import pytest + +from conftest import assert_bash_exec, in_docker + + +@pytest.mark.bashcomp(ignore_env=r"^[+-]MANPATH=") +class TestMan: + + manpath = "$PWD/man" + assumed_present = "man" + + @pytest.fixture + def colonpath(self, request, bash): + try: + assert_bash_exec(bash, "uname -s 2>&1 | grep -qiF cygwin") + except AssertionError: + pass + else: + pytest.skip("Cygwin doesn't like paths with colons") + return + assert_bash_exec(bash, "mkdir -p $TESTDIR/../tmp/man/man3") + assert_bash_exec( + bash, "touch $TESTDIR/../tmp/man/man3/Bash::Completion.3pm.gz" + ) + request.addfinalizer( + lambda: assert_bash_exec(bash, "rm -r $TESTDIR/../tmp/man") + ) + + @pytest.mark.complete( + "man bash-completion-testcas", env=dict(MANPATH=manpath) + ) + def test_1(self, completion): + assert completion == "bash-completion-testcase" + + @pytest.mark.complete("man man1/f", cwd="man", env=dict(MANPATH=manpath)) + def test_2(self, completion): + assert completion == "man1/foo.1" + + @pytest.mark.complete("man man/", cwd="man", env=dict(MANPATH=manpath)) + def test_3(self, completion): + assert completion == "man/quux.8" + + @pytest.mark.xfail( + in_docker() and os.environ.get("DIST") == "centos6", + reason="TODO: Fails in CentOS for some reason, unknown " + "how to trigger same behavior as tests show (is " + "different and correct when tried manually, but here " + "at least in CI completes things it should not with " + "this MANPATH setting)", + ) + @pytest.mark.complete( + "man %s" % assumed_present, + cwd="shared/empty_dir", + env=dict(MANPATH=manpath), + ) + def test_4(self, completion): + """ + Assumed present should not be completed complete when there's no + leading/trailing colon in $MANPATH. + """ + assert not completion + + @pytest.mark.complete( + "man %s" % assumed_present, + cwd="shared/empty_dir", + env=dict(MANPATH="%s:" % manpath), + ) + def test_5(self, completion): + """Trailing colon appends system man path.""" + assert completion + + @pytest.mark.complete( + "man bash-completion-testcas", env=dict(MANPATH="%s:" % manpath) + ) + def test_6(self, completion): + assert completion == "bash-completion-testcase" + + @pytest.mark.complete( + "man %s" % assumed_present, + cwd="shared/empty_dir", + env=dict(MANPATH=":%s" % manpath), + ) + def test_7(self, completion): + """Leading colon prepends system man path.""" + assert completion + + @pytest.mark.complete( + "man bash-completion-testcas", env=dict(MANPATH=":%s" % manpath) + ) + def test_8(self, completion): + assert completion == "bash-completion-testcase" + + @pytest.mark.complete( + "man %s" % assumed_present, + cwd="shared/empty_dir", + pre_cmds=("shopt -s failglob",), + ) + def test_9(self, bash, completion): + assert self.assumed_present in completion + assert_bash_exec(bash, "shopt -u failglob") + + @pytest.mark.complete( + "man Bash::C", env=dict(MANPATH="%s:../tmp/man" % manpath) + ) + def test_10(self, bash, colonpath, completion): + assert completion == "Bash::Completion" diff --git a/test/t/test_mc.py b/test/t/test_mc.py new file mode 100644 index 00000000..9632d6a9 --- /dev/null +++ b/test/t/test_mc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMc: + @pytest.mark.complete("mc -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mcrypt.py b/test/t/test_mcrypt.py new file mode 100644 index 00000000..da80ef5d --- /dev/null +++ b/test/t/test_mcrypt.py @@ -0,0 +1,15 @@ +import pytest + + +class TestMcrypt: + @pytest.mark.complete("mcrypt ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mcrypt -a ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("mcrypt -m ") + def test_3(self, completion): + assert completion diff --git a/test/t/test_md5sum.py b/test/t/test_md5sum.py new file mode 100644 index 00000000..fa364ea1 --- /dev/null +++ b/test/t/test_md5sum.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMd5sum: + @pytest.mark.complete("md5sum ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mdadm.py b/test/t/test_mdadm.py new file mode 100644 index 00000000..143007b3 --- /dev/null +++ b/test/t/test_mdadm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMdadm: + @pytest.mark.complete("mdadm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mdecrypt.py b/test/t/test_mdecrypt.py new file mode 100644 index 00000000..f6f4c8ed --- /dev/null +++ b/test/t/test_mdecrypt.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMdecrypt: + @pytest.mark.complete("mdecrypt ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mdtool.py b/test/t/test_mdtool.py new file mode 100644 index 00000000..356e907d --- /dev/null +++ b/test/t/test_mdtool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMdtool: + @pytest.mark.complete("mdtool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_medusa.py b/test/t/test_medusa.py new file mode 100644 index 00000000..bffa1c46 --- /dev/null +++ b/test/t/test_medusa.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMedusa: + @pytest.mark.complete("medusa -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mencoder.py b/test/t/test_mencoder.py new file mode 100644 index 00000000..ba946c7e --- /dev/null +++ b/test/t/test_mencoder.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/mplayer",)) +class TestMencoder: + @pytest.mark.complete("mencoder ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mencoder -v") + def test_2(self, completion): + assert completion diff --git a/test/t/test_mii_diag.py b/test/t/test_mii_diag.py new file mode 100644 index 00000000..fa527e94 --- /dev/null +++ b/test/t/test_mii_diag.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="mii-diag") +class TestMiiDiag: + @pytest.mark.complete("mii-diag ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mii_tool.py b/test/t/test_mii_tool.py new file mode 100644 index 00000000..32568f82 --- /dev/null +++ b/test/t/test_mii_tool.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="mii-tool") +class TestMiiTool: + @pytest.mark.complete("mii-tool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_minicom.py b/test/t/test_minicom.py new file mode 100644 index 00000000..c004fadd --- /dev/null +++ b/test/t/test_minicom.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMinicom: + @pytest.mark.complete("minicom -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mkdir.py b/test/t/test_mkdir.py new file mode 100644 index 00000000..a5eb1a54 --- /dev/null +++ b/test/t/test_mkdir.py @@ -0,0 +1,18 @@ +import pytest + + +class TestMkdir: + @pytest.mark.complete("mkdir ") + def test_1(self, completion): + assert completion + + @pytest.mark.xfail # TODO: whitespace split issue + @pytest.mark.complete("mkdir ", cwd="shared/default") + def test_2(self, completion): + assert completion == ["bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.xfail # TODO: why path in completion, basename in .output? + @pytest.mark.complete("mkdir shared/default/foo.d/") + def test_3(self, completion): + assert completion.output == "foo" + assert completion == [completion.output] diff --git a/test/t/test_mkfifo.py b/test/t/test_mkfifo.py new file mode 100644 index 00000000..b9e0013c --- /dev/null +++ b/test/t/test_mkfifo.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMkfifo: + @pytest.mark.complete("mkfifo ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mkinitrd.py b/test/t/test_mkinitrd.py new file mode 100644 index 00000000..7305925d --- /dev/null +++ b/test/t/test_mkinitrd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMkinitrd: + @pytest.mark.complete("mkinitrd ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mkisofs.py b/test/t/test_mkisofs.py new file mode 100644 index 00000000..541c6e7e --- /dev/null +++ b/test/t/test_mkisofs.py @@ -0,0 +1,15 @@ +import pytest + + +class TestMkisofs: + @pytest.mark.complete("mkisofs ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mkisofs -uid ") + def test_2(self, completion): + assert not [x for x in completion if not x.isdigit()] + + @pytest.mark.complete("mkisofs -gid ") + def test_3(self, completion): + assert not [x for x in completion if not x.isdigit()] diff --git a/test/t/test_mknod.py b/test/t/test_mknod.py new file mode 100644 index 00000000..46cb2284 --- /dev/null +++ b/test/t/test_mknod.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMknod: + @pytest.mark.complete("mknod ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mktemp.py b/test/t/test_mktemp.py new file mode 100644 index 00000000..9f61be1c --- /dev/null +++ b/test/t/test_mktemp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMktemp: + @pytest.mark.complete("mktemp -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mmsitepass.py b/test/t/test_mmsitepass.py new file mode 100644 index 00000000..4dcd9fb0 --- /dev/null +++ b/test/t/test_mmsitepass.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMmsitepass: + @pytest.mark.complete("mmsitepass -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mock.py b/test/t/test_mock.py new file mode 100644 index 00000000..7dc5de2a --- /dev/null +++ b/test/t/test_mock.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMock: + @pytest.mark.complete("mock ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_modinfo.py b/test/t/test_modinfo.py new file mode 100644 index 00000000..4c96eef0 --- /dev/null +++ b/test/t/test_modinfo.py @@ -0,0 +1,32 @@ +import subprocess + +import pytest + + +class TestModinfo: + @pytest.mark.complete("modinfo -") + def test_1(self, completion): + assert completion + + # "in": intel*, ... + @pytest.mark.complete( + "modinfo in", + skipif="! ls /lib/modules/%s &>/dev/null" + % subprocess.check_output( + "uname -r 2>/dev/null || " "echo non-existent-kernel", shell=True + ) + .decode() + .strip(), + ) + def test_2(self, completion): + assert completion + + # "in": intel*, ... + @pytest.mark.complete("modinfo -k non-existent-kernel in") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete("modinfo /tm") + def test_4(self, completion): + assert completion + assert not completion.endswith(" ") diff --git a/test/t/test_modprobe.py b/test/t/test_modprobe.py new file mode 100644 index 00000000..339240f6 --- /dev/null +++ b/test/t/test_modprobe.py @@ -0,0 +1,36 @@ +import subprocess + +import pytest + + +class TestModprobe: + @pytest.mark.complete("modprobe --al") + def test_1(self, completion): + assert completion == "--all" + + # "in": intel*, ... + @pytest.mark.complete( + "modprobe in", + skipif="! ls /lib/modules/%s &>/dev/null" + % subprocess.check_output( + "uname -r 2>/dev/null || " "echo non-existent-kernel", shell=True + ) + .decode() + .strip(), + ) + def test_2(self, completion): + assert completion + + # "in": intel*, ... + @pytest.mark.complete("modprobe -S non-existent-kernel in") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete("modprobe non-existent-module ") + def test_4(self, completion): + assert not completion + + @pytest.mark.complete("modprobe /tm") + def test_5(self, completion): + assert completion + assert not completion.endswith(" ") diff --git a/test/t/test_module.py b/test/t/test_module.py new file mode 100644 index 00000000..a66dea74 --- /dev/null +++ b/test/t/test_module.py @@ -0,0 +1,7 @@ +import pytest + + +class TestModule: + @pytest.mark.complete("module ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mogrify.py b/test/t/test_mogrify.py new file mode 100644 index 00000000..22d84a89 --- /dev/null +++ b/test/t/test_mogrify.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMogrify: + @pytest.mark.complete("mogrify ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_monodevelop.py b/test/t/test_monodevelop.py new file mode 100644 index 00000000..472b1aba --- /dev/null +++ b/test/t/test_monodevelop.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMonodevelop: + @pytest.mark.complete("monodevelop ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_montage.py b/test/t/test_montage.py new file mode 100644 index 00000000..1237c7df --- /dev/null +++ b/test/t/test_montage.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMontage: + @pytest.mark.complete("montage ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mount.py b/test/t/test_mount.py new file mode 100644 index 00000000..fbd6dcae --- /dev/null +++ b/test/t/test_mount.py @@ -0,0 +1,22 @@ +import pytest + + +class TestMount: + @pytest.mark.complete("mount ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mount -t ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("mount /dev/sda1 def", cwd="shared") + def test_3(self, completion): + assert completion == "default/" + assert not completion.endswith(" ") + + @pytest.mark.complete( + "mount mocksrv:/", env=dict(PATH="$PWD/mount/bin:$PATH") + ) + def test_4(self, completion): + assert completion == "/second/path /test/path /test/path2".split() diff --git a/test/t/test_mplayer.py b/test/t/test_mplayer.py new file mode 100644 index 00000000..88d7b9f1 --- /dev/null +++ b/test/t/test_mplayer.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/mplayer",)) +class TestMplayer: + @pytest.mark.complete("mplayer ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mplayer -h") + def test_2(self, completion): + assert completion diff --git a/test/t/test_mr.py b/test/t/test_mr.py new file mode 100644 index 00000000..ab45350b --- /dev/null +++ b/test/t/test_mr.py @@ -0,0 +1,43 @@ +import pytest + + +class TestMr: + @pytest.mark.complete("mr ") + def test_1(self, completion): + assert completion + + # man -h tests below: Some mr versions require man to be around in order + # to provide useful output. + + @pytest.mark.complete("mr --", skipif="! man -h &>/dev/null") + def test_2(self, completion): + assert completion + + @pytest.mark.complete( + "mr -c shared/default/foo.d/", skipif="! man -h &>/dev/null" + ) + def test_3(self, completion): + assert completion == "shared/default/foo.d/foo" + + @pytest.mark.complete( + "mr bootstrap shared/default/", skipif="! man -h &>/dev/null" + ) + def test_4(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.xfail # "clean" doesn't exist before mr 1.20141023 + @pytest.mark.complete("mr clean -", skipif="! man -h &>/dev/null") + def test_5(self, completion): + assert completion == "-f" + + @pytest.mark.complete("mr commit -", skipif="! man -h &>/dev/null") + def test_6(self, completion): + assert completion == "-m" + + @pytest.mark.complete("mr status ", skipif="! man -h &>/dev/null") + def test_7(self, completion): + assert not completion + + @pytest.mark.complete("mr run ", skipif="! man -h &>/dev/null") + def test_8(self, completion): + assert completion diff --git a/test/t/test_msgsnarf.py b/test/t/test_msgsnarf.py new file mode 100644 index 00000000..5ef0fcb7 --- /dev/null +++ b/test/t/test_msgsnarf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMsgsnarf: + @pytest.mark.complete("msgsnarf -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_msynctool.py b/test/t/test_msynctool.py new file mode 100644 index 00000000..530d751b --- /dev/null +++ b/test/t/test_msynctool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMsynctool: + @pytest.mark.complete("msynctool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mtx.py b/test/t/test_mtx.py new file mode 100644 index 00000000..6b6f59b5 --- /dev/null +++ b/test/t/test_mtx.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMtx: + @pytest.mark.complete("mtx ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_munin_node_configure.py b/test/t/test_munin_node_configure.py new file mode 100644 index 00000000..f3f23e7d --- /dev/null +++ b/test/t/test_munin_node_configure.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="munin-node-configure") +class TestMuninNodeConfigure: + @pytest.mark.complete("munin-node-configure --libdir ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_munin_run.py b/test/t/test_munin_run.py new file mode 100644 index 00000000..1bcb4d85 --- /dev/null +++ b/test/t/test_munin_run.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="munin-run") +class TestMuninRun: + @pytest.mark.complete("munin-run -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_munindoc.py b/test/t/test_munindoc.py new file mode 100644 index 00000000..6b226e43 --- /dev/null +++ b/test/t/test_munindoc.py @@ -0,0 +1,9 @@ +import pytest + + +class TestMunindoc: + + # Assume at least munin* available + @pytest.mark.complete("munindoc m") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mussh.py b/test/t/test_mussh.py new file mode 100644 index 00000000..87dd52a1 --- /dev/null +++ b/test/t/test_mussh.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMussh: + @pytest.mark.complete("mussh -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mutt.py b/test/t/test_mutt.py new file mode 100644 index 00000000..b490c88b --- /dev/null +++ b/test/t/test_mutt.py @@ -0,0 +1,33 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/mutt",)) +class TestMutt: + @pytest.mark.complete("mutt -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mutt -F muttrc -f =", cwd="mutt") + def test_2(self, completion): + assert completion == "bar/ foo/ muttrc".split() + + @pytest.mark.complete("mutt -F muttrc -A ", cwd="mutt") + def test_3(self, completion): + assert completion == "a1 a2".split() + + def test_4(self, bash): + got = ( + assert_bash_exec( + bash, + '_muttconffiles "$HOME/muttrc" "$HOME/muttrc"', + want_output=True, + ) + .strip() + .split() + ) + assert got == [ + "%s/mutt/%s" % (bash.cwd, x) + for x in ("muttrc", "bar/muttrc_b", "foo/muttrc_f") + ] diff --git a/test/t/test_muttng.py b/test/t/test_muttng.py new file mode 100644 index 00000000..3ce19ac9 --- /dev/null +++ b/test/t/test_muttng.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMuttng: + @pytest.mark.complete("muttng -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mv.py b/test/t/test_mv.py new file mode 100644 index 00000000..a9fc969d --- /dev/null +++ b/test/t/test_mv.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMv: + @pytest.mark.complete("mv ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_mypy.py b/test/t/test_mypy.py new file mode 100644 index 00000000..cecea92d --- /dev/null +++ b/test/t/test_mypy.py @@ -0,0 +1,15 @@ +import pytest + + +class TestMypy: + @pytest.mark.complete("mypy ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mypy --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("mypy --non-existent-option=--") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_mysql.py b/test/t/test_mysql.py new file mode 100644 index 00000000..6a44b7e5 --- /dev/null +++ b/test/t/test_mysql.py @@ -0,0 +1,15 @@ +import pytest + + +class TestMysql: + @pytest.mark.complete("mysql --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("mysql --default-character-set=") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("mysql --non-existent-option=--") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_mysqladmin.py b/test/t/test_mysqladmin.py new file mode 100644 index 00000000..74db63b0 --- /dev/null +++ b/test/t/test_mysqladmin.py @@ -0,0 +1,7 @@ +import pytest + + +class TestMysqladmin: + @pytest.mark.complete("mysqladmin -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nc.py b/test/t/test_nc.py new file mode 100644 index 00000000..6a50106e --- /dev/null +++ b/test/t/test_nc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNc: + @pytest.mark.complete("nc -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ncftp.py b/test/t/test_ncftp.py new file mode 100644 index 00000000..470f6a76 --- /dev/null +++ b/test/t/test_ncftp.py @@ -0,0 +1,11 @@ +import pytest + + +class TestNcftp: + @pytest.mark.complete("ncftp ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ncftp -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_nethogs.py b/test/t/test_nethogs.py new file mode 100644 index 00000000..a36c587f --- /dev/null +++ b/test/t/test_nethogs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNethogs: + @pytest.mark.complete("nethogs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_netstat.py b/test/t/test_netstat.py new file mode 100644 index 00000000..6bcbd4d2 --- /dev/null +++ b/test/t/test_netstat.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNetstat: + @pytest.mark.complete("netstat ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_newgrp.py b/test/t/test_newgrp.py new file mode 100644 index 00000000..7d65a167 --- /dev/null +++ b/test/t/test_newgrp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNewgrp: + @pytest.mark.complete("newgrp ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_newlist.py b/test/t/test_newlist.py new file mode 100644 index 00000000..d51dab26 --- /dev/null +++ b/test/t/test_newlist.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNewlist: + @pytest.mark.complete("newlist -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_newusers.py b/test/t/test_newusers.py new file mode 100644 index 00000000..acd93ad2 --- /dev/null +++ b/test/t/test_newusers.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNewusers: + @pytest.mark.complete("newusers ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ngrep.py b/test/t/test_ngrep.py new file mode 100644 index 00000000..0d29abd7 --- /dev/null +++ b/test/t/test_ngrep.py @@ -0,0 +1,11 @@ +import pytest + + +class TestNgrep: + @pytest.mark.complete("ngrep -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ngrep -d ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_nl.py b/test/t/test_nl.py new file mode 100644 index 00000000..c3e35b42 --- /dev/null +++ b/test/t/test_nl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNl: + @pytest.mark.complete("nl ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nm.py b/test/t/test_nm.py new file mode 100644 index 00000000..49ff167e --- /dev/null +++ b/test/t/test_nm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNm: + @pytest.mark.complete("nm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nmap.py b/test/t/test_nmap.py new file mode 100644 index 00000000..a4d8a899 --- /dev/null +++ b/test/t/test_nmap.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNmap: + @pytest.mark.complete("nmap --v") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nmcli.py b/test/t/test_nmcli.py new file mode 100644 index 00000000..f2b79504 --- /dev/null +++ b/test/t/test_nmcli.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNmcli: + @pytest.mark.complete("nmcli ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nproc.py b/test/t/test_nproc.py new file mode 100644 index 00000000..6ab8017c --- /dev/null +++ b/test/t/test_nproc.py @@ -0,0 +1,11 @@ +import pytest + + +class TestNproc: + @pytest.mark.complete("nproc ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("nproc -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_nslookup.py b/test/t/test_nslookup.py new file mode 100644 index 00000000..0286509e --- /dev/null +++ b/test/t/test_nslookup.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNslookup: + @pytest.mark.complete("nslookup -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_nsupdate.py b/test/t/test_nsupdate.py new file mode 100644 index 00000000..5bae9707 --- /dev/null +++ b/test/t/test_nsupdate.py @@ -0,0 +1,11 @@ +import pytest + + +class TestNsupdate: + @pytest.mark.complete("nsupdate ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("nsupdate -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_ntpdate.py b/test/t/test_ntpdate.py new file mode 100644 index 00000000..dc1d5b48 --- /dev/null +++ b/test/t/test_ntpdate.py @@ -0,0 +1,7 @@ +import pytest + + +class TestNtpdate: + @pytest.mark.complete("ntpdate -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_objcopy.py b/test/t/test_objcopy.py new file mode 100644 index 00000000..13a93df5 --- /dev/null +++ b/test/t/test_objcopy.py @@ -0,0 +1,7 @@ +import pytest + + +class TestObjcopy: + @pytest.mark.complete("objcopy ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_objdump.py b/test/t/test_objdump.py new file mode 100644 index 00000000..6b8bc744 --- /dev/null +++ b/test/t/test_objdump.py @@ -0,0 +1,7 @@ +import pytest + + +class TestObjdump: + @pytest.mark.complete("objdump ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_od.py b/test/t/test_od.py new file mode 100644 index 00000000..a1e648a8 --- /dev/null +++ b/test/t/test_od.py @@ -0,0 +1,7 @@ +import pytest + + +class TestOd: + @pytest.mark.complete("od ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_oggdec.py b/test/t/test_oggdec.py new file mode 100644 index 00000000..8cabe5cd --- /dev/null +++ b/test/t/test_oggdec.py @@ -0,0 +1,11 @@ +import pytest + + +class TestOggdec: + @pytest.mark.complete("oggdec ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("oggdec --") + def test_2(self, completion): + assert completion diff --git a/test/t/test_op.py b/test/t/test_op.py new file mode 100644 index 00000000..e09c98c8 --- /dev/null +++ b/test/t/test_op.py @@ -0,0 +1,11 @@ +import pytest + + +class TestOp: + @pytest.mark.complete("op ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("op --") + def test_2(self, completion): + assert completion diff --git a/test/t/test_openssl.py b/test/t/test_openssl.py new file mode 100644 index 00000000..e3af3530 --- /dev/null +++ b/test/t/test_openssl.py @@ -0,0 +1,15 @@ +import pytest + + +class TestOpenssl: + @pytest.mark.complete("openssl ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("openssl pkey -cipher ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("openssl dgst -s") + def test_3(self, completion): + assert completion diff --git a/test/t/test_opera.py b/test/t/test_opera.py new file mode 100644 index 00000000..5ab056f4 --- /dev/null +++ b/test/t/test_opera.py @@ -0,0 +1,7 @@ +import pytest + + +class TestOpera: + @pytest.mark.complete("opera ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_optipng.py b/test/t/test_optipng.py new file mode 100644 index 00000000..393b0645 --- /dev/null +++ b/test/t/test_optipng.py @@ -0,0 +1,7 @@ +import pytest + + +class TestOptipng: + @pytest.mark.complete("optipng ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_p4.py b/test/t/test_p4.py new file mode 100644 index 00000000..876d261e --- /dev/null +++ b/test/t/test_p4.py @@ -0,0 +1,7 @@ +import pytest + + +class TestP4: + @pytest.mark.complete("p4 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pack200.py b/test/t/test_pack200.py new file mode 100644 index 00000000..0960133a --- /dev/null +++ b/test/t/test_pack200.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPack200: + @pytest.mark.complete("pack200 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_passwd.py b/test/t/test_passwd.py new file mode 100644 index 00000000..60441de9 --- /dev/null +++ b/test/t/test_passwd.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPasswd: + @pytest.mark.complete("passwd ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("passwd -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_paste.py b/test/t/test_paste.py new file mode 100644 index 00000000..2d551322 --- /dev/null +++ b/test/t/test_paste.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPaste: + @pytest.mark.complete("paste ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_patch.py b/test/t/test_patch.py new file mode 100644 index 00000000..455ebd9a --- /dev/null +++ b/test/t/test_patch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPatch: + @pytest.mark.complete("patch ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pdftotext.py b/test/t/test_pdftotext.py new file mode 100644 index 00000000..9e332f06 --- /dev/null +++ b/test/t/test_pdftotext.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPdftotext: + @pytest.mark.complete("pdftotext ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_perl.py b/test/t/test_perl.py new file mode 100644 index 00000000..7c0c6094 --- /dev/null +++ b/test/t/test_perl.py @@ -0,0 +1,79 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^\+PERL5LIB=") +class TestPerl: + @pytest.mark.complete("perl ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("perl -e ") + def test_2(self, completion): + assert not completion + + @pytest.mark.complete("perl -V:install") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("perl -V::install") + def test_4(self, completion): + assert completion + + # Assume File::Spec and friends are always installed + + @pytest.mark.complete("perl -MFile") + def test_5(self, completion): + assert completion + + @pytest.mark.complete("perl -MFile::Sp") + def test_6(self, completion): + assert completion + + @pytest.mark.complete("perl -MFile::Spec::Func") + def test_7(self, completion): + assert completion + + @pytest.mark.complete("perl -M-File") + def test_8(self, completion): + assert completion + + @pytest.mark.complete("perl -m-File::") + def test_9(self, completion): + assert completion + + @pytest.mark.complete("perl -") + def test_10(self, completion): + assert completion + + @pytest.mark.complete("perl foo shared/default/f") + def test_11(self, completion): + """Second arg should complete files+dirs.""" + assert completion == "foo foo.d/".split() + + @pytest.mark.complete("perl -Ishared/default/") + def test_12(self, completion): + """-I without space should complete dirs.""" + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("perl -I shared/default/") + def test_13(self, completion): + """-I with space should complete dirs.""" + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("perl -xshared/default/b") + def test_14(self, completion): + """-x without space should complete dirs.""" + assert completion == ["-xshared/default/bar bar.d/"] + + @pytest.mark.complete("perl -x shared/default/b") + def test_15(self, completion): + """-x with space should complete dirs.""" + assert completion == ["shared/default/bar bar.d/"] + + @pytest.mark.complete("perl -d:", env=dict(PERL5LIB="$PWD/perl")) + def test_16(self, completion): + assert "BashCompletion" in completion + + @pytest.mark.complete("perl -dt:", env=dict(PERL5LIB="$PWD/perl")) + def test_17(self, completion): + assert "BashCompletion" in completion diff --git a/test/t/test_perlcritic.py b/test/t/test_perlcritic.py new file mode 100644 index 00000000..cc4ef25f --- /dev/null +++ b/test/t/test_perlcritic.py @@ -0,0 +1,15 @@ +import pytest + + +class TestPerlcritic: + @pytest.mark.complete("perlcritic ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("perlcritic --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("perlcritic --theme ") + def test_3(self, completion): + assert completion diff --git a/test/t/test_perldoc.py b/test/t/test_perldoc.py new file mode 100644 index 00000000..9f772944 --- /dev/null +++ b/test/t/test_perldoc.py @@ -0,0 +1,18 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("export PERL5LIB=$PWD/perldoc",)) +class TestPerldoc: + @pytest.mark.complete("perldoc File::") + def test_1(self, completion): + assert "Path" in completion # Assume File::Path always installed + assert "fixtures/" not in completion # Our fixtures/ dir + assert not [x for x in completion if "File::File::" in x] + + @pytest.mark.complete("perldoc -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("perldoc BashCompletion") + def test_3(self, completion): + assert completion == "BashCompletionDoc BashCompletionModule".split() diff --git a/test/t/test_perltidy.py b/test/t/test_perltidy.py new file mode 100644 index 00000000..3bafd6e4 --- /dev/null +++ b/test/t/test_perltidy.py @@ -0,0 +1,19 @@ +import pytest + + +class TestPerltidy: + @pytest.mark.complete("perltidy ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("perltidy -h") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("perltidy -ole=") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("perltidy -doesntexist=") + def test_4(self, completion): + assert not completion diff --git a/test/t/test_pgrep.py b/test/t/test_pgrep.py new file mode 100644 index 00000000..1155e582 --- /dev/null +++ b/test/t/test_pgrep.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPgrep: + + # "p": Assume that our process name completion runs ps + @pytest.mark.complete("pgrep p") + def test_1(self, completion): + assert completion diff --git a/test/t/test_phing.py b/test/t/test_phing.py new file mode 100644 index 00000000..2e8c1069 --- /dev/null +++ b/test/t/test_phing.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPhing: + @pytest.mark.complete("phing -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("phing -l ") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_pidof.py b/test/t/test_pidof.py new file mode 100644 index 00000000..fb553e55 --- /dev/null +++ b/test/t/test_pidof.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPidof: + + # "p": Assume that our process name completion runs ps + @pytest.mark.complete("pidof p") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pine.py b/test/t/test_pine.py new file mode 100644 index 00000000..2c5549e0 --- /dev/null +++ b/test/t/test_pine.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPine: + @pytest.mark.complete("pine -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pinfo.py b/test/t/test_pinfo.py new file mode 100644 index 00000000..b502273f --- /dev/null +++ b/test/t/test_pinfo.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("INFOPATH+=:$PWD/info:",)) +class TestPinfo: + @pytest.mark.complete("pinfo -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pinfo bash") + def test_2(self, completion): + assert completion diff --git a/test/t/test_ping.py b/test/t/test_ping.py new file mode 100644 index 00000000..e7c77365 --- /dev/null +++ b/test/t/test_ping.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPing: + @pytest.mark.complete("ping ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ping -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pkg_config.py b/test/t/test_pkg_config.py new file mode 100644 index 00000000..a0703e09 --- /dev/null +++ b/test/t/test_pkg_config.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pkg-config") +class TestPkgConfig: + @pytest.mark.complete("pkg-config ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pkg-config -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pkg_deinstall.py b/test/t/test_pkg_deinstall.py new file mode 100644 index 00000000..5ce6d13e --- /dev/null +++ b/test/t/test_pkg_deinstall.py @@ -0,0 +1,15 @@ +import os + +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PKG_DBDIR=$PWD/pkgtools/db",)) +class TestPkgDeinstall: + @pytest.mark.complete("pkg_deinstall ") + def test_1(self, completion): + dirs = sorted( + x + for x in os.listdir("pkgtools/db") + if os.path.isdir("pkgtools/db/%s" % x) + ) + assert completion == dirs diff --git a/test/t/test_pkg_delete.py b/test/t/test_pkg_delete.py new file mode 100644 index 00000000..a4b0d855 --- /dev/null +++ b/test/t/test_pkg_delete.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgDelete: + @pytest.mark.complete("pkg_delete ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkg_get.py b/test/t/test_pkg_get.py new file mode 100644 index 00000000..cb2d2834 --- /dev/null +++ b/test/t/test_pkg_get.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pkg-get") +class TestPkgGet: + @pytest.mark.complete("pkg-get ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkg_info.py b/test/t/test_pkg_info.py new file mode 100644 index 00000000..6011f814 --- /dev/null +++ b/test/t/test_pkg_info.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgInfo: + @pytest.mark.complete("pkg_info ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkgadd.py b/test/t/test_pkgadd.py new file mode 100644 index 00000000..ca6baf27 --- /dev/null +++ b/test/t/test_pkgadd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgadd: + @pytest.mark.complete("pkgadd ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkgrm.py b/test/t/test_pkgrm.py new file mode 100644 index 00000000..9cb73571 --- /dev/null +++ b/test/t/test_pkgrm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgrm: + @pytest.mark.complete("pkgrm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkgtool.py b/test/t/test_pkgtool.py new file mode 100644 index 00000000..7d356377 --- /dev/null +++ b/test/t/test_pkgtool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgtool: + @pytest.mark.complete("pkgtool -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkgutil.py b/test/t/test_pkgutil.py new file mode 100644 index 00000000..96647285 --- /dev/null +++ b/test/t/test_pkgutil.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkgutil: + @pytest.mark.complete("pkgutil ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pkill.py b/test/t/test_pkill.py new file mode 100644 index 00000000..b0af6c3d --- /dev/null +++ b/test/t/test_pkill.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPkill: + @pytest.mark.complete("pkill ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_plague_client.py b/test/t/test_plague_client.py new file mode 100644 index 00000000..39eac93d --- /dev/null +++ b/test/t/test_plague_client.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="plague-client") +class TestPlagueClient: + @pytest.mark.complete("plague-client ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pm_hibernate.py b/test/t/test_pm_hibernate.py new file mode 100644 index 00000000..31b4625e --- /dev/null +++ b/test/t/test_pm_hibernate.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pm-hibernate") +class TestPmHibernate: + @pytest.mark.complete("pm-hibernate -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pm_is_supported.py b/test/t/test_pm_is_supported.py new file mode 100644 index 00000000..47f064a4 --- /dev/null +++ b/test/t/test_pm_is_supported.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pm-is-supported") +class TestPmIsSupported: + @pytest.mark.complete("pm-is-supported -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pm_powersave.py b/test/t/test_pm_powersave.py new file mode 100644 index 00000000..7630a412 --- /dev/null +++ b/test/t/test_pm_powersave.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pm-powersave") +class TestPmPowersave: + @pytest.mark.complete("pm-powersave ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pngfix.py b/test/t/test_pngfix.py new file mode 100644 index 00000000..e27f3293 --- /dev/null +++ b/test/t/test_pngfix.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPngfix: + @pytest.mark.complete("pngfix ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pngfix -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_portinstall.py b/test/t/test_portinstall.py new file mode 100644 index 00000000..62fddbfb --- /dev/null +++ b/test/t/test_portinstall.py @@ -0,0 +1,26 @@ +import pytest + +from conftest import assert_bash_exec + + +class TestPortinstall: + @pytest.fixture(scope="class") + def portsdir(self, request, bash): + assert_bash_exec(bash, "PORTSDIR=$TESTDIR/tmp") + assert_bash_exec( + bash, + "command sed -e s,PORTSDIR,$PORTSDIR,g " + "pkgtools/ports/INDEX.dist >$PORTSDIR/INDEX", + ) + assert_bash_exec(bash, "cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5") + request.addfinalizer( + lambda: assert_bash_exec(bash, "rm $PORTSDIR/INDEX{,-5}") + ) + + @pytest.mark.complete("portinstall ", env=dict(PORTSDIR="$TESTDIR/tmp")) + def test_1(self, completion, portsdir): + assert ( + completion + == "bash-2.05b.007_6 bash-3.1.17 bash-completion-20060301_2 " + "shells/bash shells/bash-completion shells/bash2".split() + ) diff --git a/test/t/test_portsnap.py b/test/t/test_portsnap.py new file mode 100644 index 00000000..4f5878e9 --- /dev/null +++ b/test/t/test_portsnap.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPortsnap: + @pytest.mark.complete("portsnap ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_portupgrade.py b/test/t/test_portupgrade.py new file mode 100644 index 00000000..aaff5c10 --- /dev/null +++ b/test/t/test_portupgrade.py @@ -0,0 +1,9 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PKG_DBDIR=$PWD/dbtools/db",)) +class TestPortupgrade: + @pytest.mark.complete("portupgrade ") + def test_1(self, completion): + assert completion == "a b-c-d".split() + assert completion.endswith(" ") diff --git a/test/t/test_postcat.py b/test/t/test_postcat.py new file mode 100644 index 00000000..653cca25 --- /dev/null +++ b/test/t/test_postcat.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPostcat: + @pytest.mark.complete("postcat ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_postconf.py b/test/t/test_postconf.py new file mode 100644 index 00000000..641b2734 --- /dev/null +++ b/test/t/test_postconf.py @@ -0,0 +1,18 @@ +import pytest + + +class TestPostconf: + @pytest.mark.complete("postconf -") + def test_1(self, completion): + assert len(completion) > 1 + + # Broken configs may abort output of postconf halfway through, so use + # something from early output to not trigger false positives because of + # this. For example, inet_protocols=all but no IPv6 configured: + # postconf: fatal: parameter inet_interfaces: no local interface found + # for ::1 + # ...and output can be cut off somewhere near lmtp_tls_secur*. + # ...or be completely missing, so all we can do is to skip. + @pytest.mark.complete("postconf al", skipif="! postconf &>/dev/null") + def test_2(self, completion): + assert completion diff --git a/test/t/test_postfix.py b/test/t/test_postfix.py new file mode 100644 index 00000000..f7af7b4c --- /dev/null +++ b/test/t/test_postfix.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPostfix: + @pytest.mark.complete("postfix ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_postmap.py b/test/t/test_postmap.py new file mode 100644 index 00000000..f3430fbd --- /dev/null +++ b/test/t/test_postmap.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPostmap: + @pytest.mark.complete("postmap ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_postsuper.py b/test/t/test_postsuper.py new file mode 100644 index 00000000..b74de8ec --- /dev/null +++ b/test/t/test_postsuper.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPostsuper: + @pytest.mark.complete("postsuper ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_povray.py b/test/t/test_povray.py new file mode 100644 index 00000000..99d08ea0 --- /dev/null +++ b/test/t/test_povray.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPovray: + @pytest.mark.complete("povray ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pr.py b/test/t/test_pr.py new file mode 100644 index 00000000..cb023ea0 --- /dev/null +++ b/test/t/test_pr.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPr: + @pytest.mark.complete("pr ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_prelink.py b/test/t/test_prelink.py new file mode 100644 index 00000000..ef8baece --- /dev/null +++ b/test/t/test_prelink.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPrelink: + @pytest.mark.complete("prelink ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("prelink -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_protoc.py b/test/t/test_protoc.py new file mode 100644 index 00000000..65549d35 --- /dev/null +++ b/test/t/test_protoc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestProtoc: + @pytest.mark.complete("protoc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_psql.py b/test/t/test_psql.py new file mode 100644 index 00000000..60ed097c --- /dev/null +++ b/test/t/test_psql.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPsql: + + # --help can fail due to missing package dependencies, e.g. on Ubuntu 14 + @pytest.mark.complete("psql -", skipif="! psql --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ptx.py b/test/t/test_ptx.py new file mode 100644 index 00000000..2eea63bc --- /dev/null +++ b/test/t/test_ptx.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPtx: + @pytest.mark.complete("ptx ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_puppet.py b/test/t/test_puppet.py new file mode 100644 index 00000000..470f33a2 --- /dev/null +++ b/test/t/test_puppet.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPuppet: + @pytest.mark.complete("puppet ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("puppet agent --") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pushd.py b/test/t/test_pushd.py new file mode 100644 index 00000000..290e1d1d --- /dev/null +++ b/test/t/test_pushd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPushd: + @pytest.mark.complete("pushd ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pv.py b/test/t/test_pv.py new file mode 100644 index 00000000..ffca68df --- /dev/null +++ b/test/t/test_pv.py @@ -0,0 +1,15 @@ +import pytest + + +class TestPv: + @pytest.mark.complete("pv ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pv -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("pv --pidfile ") + def test_3(self, completion): + assert completion diff --git a/test/t/test_pvchange.py b/test/t/test_pvchange.py new file mode 100644 index 00000000..78e534ac --- /dev/null +++ b/test/t/test_pvchange.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPvchange: + @pytest.mark.complete( + "pvchange --", skipif="! pvchange --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvcreate.py b/test/t/test_pvcreate.py new file mode 100644 index 00000000..372b9e39 --- /dev/null +++ b/test/t/test_pvcreate.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPvcreate: + @pytest.mark.complete( + "pvcreate --", skipif="! pvcreate --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvdisplay.py b/test/t/test_pvdisplay.py new file mode 100644 index 00000000..e5fa07f6 --- /dev/null +++ b/test/t/test_pvdisplay.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPvdisplay: + @pytest.mark.complete( + "pvdisplay --", skipif="! pvdisplay --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvmove.py b/test/t/test_pvmove.py new file mode 100644 index 00000000..e1b06dd6 --- /dev/null +++ b/test/t/test_pvmove.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPvmove: + @pytest.mark.complete("pvmove --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvremove.py b/test/t/test_pvremove.py new file mode 100644 index 00000000..08bf63b0 --- /dev/null +++ b/test/t/test_pvremove.py @@ -0,0 +1,9 @@ +import pytest + + +class TestPvremove: + @pytest.mark.complete( + "pvremove --", skipif="! pvremove --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvs.py b/test/t/test_pvs.py new file mode 100644 index 00000000..6063888e --- /dev/null +++ b/test/t/test_pvs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPvs: + @pytest.mark.complete("pvs --", skipif="! pvs --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pvscan.py b/test/t/test_pvscan.py new file mode 100644 index 00000000..1ae237fc --- /dev/null +++ b/test/t/test_pvscan.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPvscan: + @pytest.mark.complete("pvscan --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pwck.py b/test/t/test_pwck.py new file mode 100644 index 00000000..143c76f1 --- /dev/null +++ b/test/t/test_pwck.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPwck: + @pytest.mark.complete("pwck ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pwd.py b/test/t/test_pwd.py new file mode 100644 index 00000000..b1ec3378 --- /dev/null +++ b/test/t/test_pwd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPwd: + @pytest.mark.complete("pwd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pwdx.py b/test/t/test_pwdx.py new file mode 100644 index 00000000..411d7a59 --- /dev/null +++ b/test/t/test_pwdx.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPwdx: + @pytest.mark.complete("pwdx ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pwgen.py b/test/t/test_pwgen.py new file mode 100644 index 00000000..54c194cf --- /dev/null +++ b/test/t/test_pwgen.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPwgen: + @pytest.mark.complete("pwgen -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pycodestyle.py b/test/t/test_pycodestyle.py new file mode 100644 index 00000000..03c58eec --- /dev/null +++ b/test/t/test_pycodestyle.py @@ -0,0 +1,15 @@ +import pytest + + +class TestPycodestyle: + @pytest.mark.complete("pycodestyle ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pycodestyle -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("pycodestyle --doesnt-exist=") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_pydoc.py b/test/t/test_pydoc.py new file mode 100644 index 00000000..e6173676 --- /dev/null +++ b/test/t/test_pydoc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPydoc: + @pytest.mark.complete("pydoc r") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pydocstyle.py b/test/t/test_pydocstyle.py new file mode 100644 index 00000000..4deb45fe --- /dev/null +++ b/test/t/test_pydocstyle.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPydocstyle: + @pytest.mark.complete("pydocstyle ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pydocstyle -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pyflakes.py b/test/t/test_pyflakes.py new file mode 100644 index 00000000..ae3853a7 --- /dev/null +++ b/test/t/test_pyflakes.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPyflakes: + @pytest.mark.complete("pyflakes ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_pylint.py b/test/t/test_pylint.py new file mode 100644 index 00000000..e08507aa --- /dev/null +++ b/test/t/test_pylint.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPylint: + @pytest.mark.complete("pylint --v") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pylint --confidence=HIGH,") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pylint_3.py b/test/t/test_pylint_3.py new file mode 100644 index 00000000..305db7d3 --- /dev/null +++ b/test/t/test_pylint_3.py @@ -0,0 +1,12 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="pylint-3") +class TestPylint3: + @pytest.mark.complete("pylint-3 --v") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pylint-3 http.clien") + def test_2(self, completion): + assert completion diff --git a/test/t/test_pytest.py b/test/t/test_pytest.py new file mode 100644 index 00000000..69d01820 --- /dev/null +++ b/test/t/test_pytest.py @@ -0,0 +1,11 @@ +import pytest + + +class TestPytest: + @pytest.mark.complete("pytest ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("pytest -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_python.py b/test/t/test_python.py new file mode 100644 index 00000000..4990f957 --- /dev/null +++ b/test/t/test_python.py @@ -0,0 +1,35 @@ +import pytest + + +class TestPython: + @pytest.mark.complete("python ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("python -") + def test_2(self, completion): + assert len(completion) > 1 + + @pytest.mark.complete("python -c ") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete("python shared/default/") + def test_4(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("python -c foo shared/default/") + def test_5(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.complete("python -c foo -") + def test_6(self, completion): + assert not completion + + @pytest.mark.complete("python -m foo -") + def test_7(self, completion): + assert not completion + + @pytest.mark.complete("python -m sy") + def test_8(self, completion): + assert completion diff --git a/test/t/test_python3.py b/test/t/test_python3.py new file mode 100644 index 00000000..3f2b5f9e --- /dev/null +++ b/test/t/test_python3.py @@ -0,0 +1,35 @@ +import pytest + + +class TestPython3: + @pytest.mark.complete("python3 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("python3 -") + def test_2(self, completion): + assert len(completion) > 1 + + @pytest.mark.complete("python3 -c ") + def test_3(self, completion): + assert not completion + + @pytest.mark.complete("python3 shared/default/") + def test_4(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("python3 -c foo shared/default/") + def test_5(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.complete("python3 -c foo -") + def test_6(self, completion): + assert not completion + + @pytest.mark.complete("python3 -m foo -") + def test_7(self, completion): + assert not completion + + @pytest.mark.complete("python3 -m sy") + def test_8(self, completion): + assert completion diff --git a/test/t/test_pyvenv.py b/test/t/test_pyvenv.py new file mode 100644 index 00000000..5e9152a5 --- /dev/null +++ b/test/t/test_pyvenv.py @@ -0,0 +1,7 @@ +import pytest + + +class TestPyvenv: + @pytest.mark.complete("pyvenv ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_qemu.py b/test/t/test_qemu.py new file mode 100644 index 00000000..3be6f64b --- /dev/null +++ b/test/t/test_qemu.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQemu: + @pytest.mark.complete("qemu ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_qrunner.py b/test/t/test_qrunner.py new file mode 100644 index 00000000..4e4cdd8d --- /dev/null +++ b/test/t/test_qrunner.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQrunner: + @pytest.mark.complete("qrunner -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_querybts.py b/test/t/test_querybts.py new file mode 100644 index 00000000..dd3af4f9 --- /dev/null +++ b/test/t/test_querybts.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQuerybts: + @pytest.mark.complete("querybts --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_quota.py b/test/t/test_quota.py new file mode 100644 index 00000000..75098875 --- /dev/null +++ b/test/t/test_quota.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQuota: + @pytest.mark.complete("quota ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_quotacheck.py b/test/t/test_quotacheck.py new file mode 100644 index 00000000..0311befb --- /dev/null +++ b/test/t/test_quotacheck.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQuotacheck: + @pytest.mark.complete("quotacheck -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_quotaon.py b/test/t/test_quotaon.py new file mode 100644 index 00000000..46bf5546 --- /dev/null +++ b/test/t/test_quotaon.py @@ -0,0 +1,7 @@ +import pytest + + +class TestQuotaon: + @pytest.mark.complete("quotaon -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_radvdump.py b/test/t/test_radvdump.py new file mode 100644 index 00000000..e3d9242d --- /dev/null +++ b/test/t/test_radvdump.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRadvdump: + @pytest.mark.complete("radvdump ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rcs.py b/test/t/test_rcs.py new file mode 100644 index 00000000..985bb44f --- /dev/null +++ b/test/t/test_rcs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRcs: + @pytest.mark.complete("rcs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rcsdiff.py b/test/t/test_rcsdiff.py new file mode 100644 index 00000000..d54934c7 --- /dev/null +++ b/test/t/test_rcsdiff.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRcsdiff: + @pytest.mark.complete("rcsdiff ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rdesktop.py b/test/t/test_rdesktop.py new file mode 100644 index 00000000..b82b471e --- /dev/null +++ b/test/t/test_rdesktop.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRdesktop: + @pytest.mark.complete("rdesktop -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rdict.py b/test/t/test_rdict.py new file mode 100644 index 00000000..86d7c087 --- /dev/null +++ b/test/t/test_rdict.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRdict: + @pytest.mark.complete("rdict --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_readelf.py b/test/t/test_readelf.py new file mode 100644 index 00000000..5c5dff37 --- /dev/null +++ b/test/t/test_readelf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestReadelf: + @pytest.mark.complete("readelf --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_readonly.py b/test/t/test_readonly.py new file mode 100644 index 00000000..0ac310c2 --- /dev/null +++ b/test/t/test_readonly.py @@ -0,0 +1,7 @@ +import pytest + + +class TestReadonly: + @pytest.mark.complete("readonly BASH_ARG") + def test_1(self, completion): + assert completion diff --git a/test/t/test_remove_members.py b/test/t/test_remove_members.py new file mode 100644 index 00000000..a3b0afd6 --- /dev/null +++ b/test/t/test_remove_members.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRemoveMembers: + @pytest.mark.complete("remove_members --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_removepkg.py b/test/t/test_removepkg.py new file mode 100644 index 00000000..9fd7a9d8 --- /dev/null +++ b/test/t/test_removepkg.py @@ -0,0 +1,15 @@ +import os + +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^\+ROOT=") +class TestRemovepkg: + @pytest.mark.complete("removepkg -") + def test_1(self, completion): + assert completion == "-copy -keep -preserve -warn".split() + + @pytest.mark.complete("removepkg ", env=dict(ROOT="./slackware")) + def test_2(self, completion): + files = sorted(x for x in os.listdir("slackware/var/log/packages")) + assert completion == files diff --git a/test/t/test_renice.py b/test/t/test_renice.py new file mode 100644 index 00000000..20d59a33 --- /dev/null +++ b/test/t/test_renice.py @@ -0,0 +1,11 @@ +import pytest + + +class TestRenice: + @pytest.mark.complete("renice 1") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("renice -g ") + def test_2(self, completion): + assert completion diff --git a/test/t/test_repomanage.py b/test/t/test_repomanage.py new file mode 100644 index 00000000..6def4a8c --- /dev/null +++ b/test/t/test_repomanage.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRepomanage: + @pytest.mark.complete("repomanage ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_reportbug.py b/test/t/test_reportbug.py new file mode 100644 index 00000000..612a96b8 --- /dev/null +++ b/test/t/test_reportbug.py @@ -0,0 +1,7 @@ +import pytest + + +class TestReportbug: + @pytest.mark.complete("reportbug --m") + def test_1(self, completion): + assert completion diff --git a/test/t/test_reptyr.py b/test/t/test_reptyr.py new file mode 100644 index 00000000..62a9b1c5 --- /dev/null +++ b/test/t/test_reptyr.py @@ -0,0 +1,11 @@ +import pytest + + +class TestReptyr: + @pytest.mark.complete("reptyr ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("reptyr -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_resolvconf.py b/test/t/test_resolvconf.py new file mode 100644 index 00000000..fdcf584f --- /dev/null +++ b/test/t/test_resolvconf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestResolvconf: + @pytest.mark.complete("resolvconf -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rfcomm.py b/test/t/test_rfcomm.py new file mode 100644 index 00000000..c30d23b1 --- /dev/null +++ b/test/t/test_rfcomm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRfcomm: + @pytest.mark.complete("rfcomm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rfkill.py b/test/t/test_rfkill.py new file mode 100644 index 00000000..f8248ff9 --- /dev/null +++ b/test/t/test_rfkill.py @@ -0,0 +1,11 @@ +import pytest + + +class TestRfkill: + @pytest.mark.complete("rfkill ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("rfkill -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_ri.py b/test/t/test_ri.py new file mode 100644 index 00000000..e54f18bb --- /dev/null +++ b/test/t/test_ri.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("export RI='-d ri'",)) +class TestRi: + @pytest.mark.complete("ri -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ri --dump=ri/") + def test_2(self, completion): + assert completion == "BashCompletion/ cache.ri".split() + + @pytest.mark.complete("ri BashCompletio") + def test_3(self, completion): + assert completion == "BashCompletion" diff --git a/test/t/test_rlog.py b/test/t/test_rlog.py new file mode 100644 index 00000000..87a4da10 --- /dev/null +++ b/test/t/test_rlog.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRlog: + @pytest.mark.complete("rlog ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rm.py b/test/t/test_rm.py new file mode 100644 index 00000000..622ef13c --- /dev/null +++ b/test/t/test_rm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRm: + @pytest.mark.complete("rm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rmdir.py b/test/t/test_rmdir.py new file mode 100644 index 00000000..d416819a --- /dev/null +++ b/test/t/test_rmdir.py @@ -0,0 +1,12 @@ +import pytest + + +class TestRmdir: + @pytest.mark.complete("rmdir ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("/bin/rmdir shared/default/") + def test_2(self, completion): + """Should complete dirs only, also when invoked using full path.""" + assert completion == ["bar bar.d/", "foo.d/"] diff --git a/test/t/test_rmlist.py b/test/t/test_rmlist.py new file mode 100644 index 00000000..3a6c6ece --- /dev/null +++ b/test/t/test_rmlist.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRmlist: + @pytest.mark.complete("rmlist -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rmmod.py b/test/t/test_rmmod.py new file mode 100644 index 00000000..dfeb0090 --- /dev/null +++ b/test/t/test_rmmod.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRmmod: + @pytest.mark.complete("rmmod -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_route.py b/test/t/test_route.py new file mode 100644 index 00000000..741ef585 --- /dev/null +++ b/test/t/test_route.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRoute: + @pytest.mark.complete("route ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rpcdebug.py b/test/t/test_rpcdebug.py new file mode 100644 index 00000000..e92bdee1 --- /dev/null +++ b/test/t/test_rpcdebug.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRpcdebug: + @pytest.mark.complete("rpcdebug -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rpm.py b/test/t/test_rpm.py new file mode 100644 index 00000000..939090dd --- /dev/null +++ b/test/t/test_rpm.py @@ -0,0 +1,11 @@ +import pytest + + +class TestRpm: + @pytest.mark.complete("rpm ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("rpm -q ", skipif='test -z "$(rpm -qa 2>/dev/null)"') + def test_2(self, completion): + assert completion diff --git a/test/t/test_rpm2tgz.py b/test/t/test_rpm2tgz.py new file mode 100644 index 00000000..366faedc --- /dev/null +++ b/test/t/test_rpm2tgz.py @@ -0,0 +1,26 @@ +import os + +import pytest + + +class TestRpm2tgz: + @pytest.mark.complete("rpm2tgz -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("rpm2tgz ", cwd="slackware/home") + def test_2(self, completion): + expected = sorted( + [ + "%s/" + for x in os.listdir("slackware/home") + if os.path.isdir("shared/bin/%s" % x) + ] + + [ + x + for x in os.listdir("slackware/home") + if os.path.isfile("slackware/home/%s" % x) + and x.endswith(".rpm") + ] + ) + assert completion == expected diff --git a/test/t/test_rpmbuild.py b/test/t/test_rpmbuild.py new file mode 100644 index 00000000..13f164ba --- /dev/null +++ b/test/t/test_rpmbuild.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRpmbuild: + @pytest.mark.complete("rpmbuild -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rrdtool.py b/test/t/test_rrdtool.py new file mode 100644 index 00000000..9da83100 --- /dev/null +++ b/test/t/test_rrdtool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRrdtool: + @pytest.mark.complete("rrdtool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_rsync.py b/test/t/test_rsync.py new file mode 100644 index 00000000..d54ce6fc --- /dev/null +++ b/test/t/test_rsync.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^[+-]_scp_path_esc=") +class TestRsync: + @pytest.mark.complete("rsync ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("rsync --rsh ") + def test_2(self, completion): + assert completion == "rsh ssh".split() + + @pytest.mark.complete("rsync --rsh=") + def test_3(self, completion): + assert completion == "rsh ssh".split() diff --git a/test/t/test_rtcwake.py b/test/t/test_rtcwake.py new file mode 100644 index 00000000..e9c12d07 --- /dev/null +++ b/test/t/test_rtcwake.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRtcwake: + @pytest.mark.complete("rtcwake ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_runuser.py b/test/t/test_runuser.py new file mode 100644 index 00000000..01a6d884 --- /dev/null +++ b/test/t/test_runuser.py @@ -0,0 +1,7 @@ +import pytest + + +class TestRunuser: + @pytest.mark.complete("runuser ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sbcl.py b/test/t/test_sbcl.py new file mode 100644 index 00000000..cce4cba3 --- /dev/null +++ b/test/t/test_sbcl.py @@ -0,0 +1,8 @@ +import pytest + + +class TestSbcl: + @pytest.mark.xfail # TODO: whitespace split issue + @pytest.mark.complete("sbcl shared/default/") + def test_1(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo foo.d/"] diff --git a/test/t/test_sbcl_mt.py b/test/t/test_sbcl_mt.py new file mode 100644 index 00000000..860acc2f --- /dev/null +++ b/test/t/test_sbcl_mt.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="sbcl-mt") +class TestSbclMt: + @pytest.mark.complete("sbcl-mt shared/default/") + def test_1(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo foo.d/"] diff --git a/test/t/test_sbopkg.py b/test/t/test_sbopkg.py new file mode 100644 index 00000000..cb1f7360 --- /dev/null +++ b/test/t/test_sbopkg.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSbopkg: + @pytest.mark.complete("sbopkg -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_screen.py b/test/t/test_screen.py new file mode 100644 index 00000000..c05e0ce0 --- /dev/null +++ b/test/t/test_screen.py @@ -0,0 +1,24 @@ +import pytest + + +class TestScreen: + @pytest.mark.complete("screen -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("screen -c shared/default/") + def test_2(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] + + @pytest.mark.complete("screen cat ") + def test_3(self, completion): + assert completion + + # Assume at least vt100 and friends are there + @pytest.mark.complete("screen -T vt") + def test_4(self, completion): + assert completion + + @pytest.mark.complete("screen -T foo cat") + def test_5(self, completion): + assert completion diff --git a/test/t/test_scrub.py b/test/t/test_scrub.py new file mode 100644 index 00000000..0a521faf --- /dev/null +++ b/test/t/test_scrub.py @@ -0,0 +1,19 @@ +import pytest + + +class TestScrub: + @pytest.mark.complete("scrub ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("scrub -") + def test_2(self, completion): + assert completion + + # Not all scrub versions list available patterns in --help output + @pytest.mark.complete( + "scrub -p ", + skipif="! (scrub --help 2>&1 || :) | " "command grep -q ^Available", + ) + def test_3(self, completion): + assert completion diff --git a/test/t/test_sdptool.py b/test/t/test_sdptool.py new file mode 100644 index 00000000..095d90e6 --- /dev/null +++ b/test/t/test_sdptool.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSdptool: + @pytest.mark.complete("sdptool ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sed.py b/test/t/test_sed.py new file mode 100644 index 00000000..3fc0559f --- /dev/null +++ b/test/t/test_sed.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSed: + @pytest.mark.complete("sed --", skipif="! sed --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_seq.py b/test/t/test_seq.py new file mode 100644 index 00000000..96580450 --- /dev/null +++ b/test/t/test_seq.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSeq: + @pytest.mark.complete("seq --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_service.py b/test/t/test_service.py new file mode 100644 index 00000000..7ce43125 --- /dev/null +++ b/test/t/test_service.py @@ -0,0 +1,7 @@ +import pytest + + +class TestService: + @pytest.mark.complete("service ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_set.py b/test/t/test_set.py new file mode 100644 index 00000000..08c1671e --- /dev/null +++ b/test/t/test_set.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSet: + @pytest.mark.complete("set no") + def test_1(self, completion): + assert completion diff --git a/test/t/test_setquota.py b/test/t/test_setquota.py new file mode 100644 index 00000000..a2822bca --- /dev/null +++ b/test/t/test_setquota.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSetquota: + @pytest.mark.complete("setquota ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sftp.py b/test/t/test_sftp.py new file mode 100644 index 00000000..e76a6f59 --- /dev/null +++ b/test/t/test_sftp.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSftp: + @pytest.mark.complete("sftp -Fsp", cwd="sftp") + def test_1(self, completion): + assert completion == "-Fspaced conf" diff --git a/test/t/test_sh.py b/test/t/test_sh.py new file mode 100644 index 00000000..f49a1685 --- /dev/null +++ b/test/t/test_sh.py @@ -0,0 +1,19 @@ +import pytest + + +class TestSh: + @pytest.mark.complete("sh -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("sh +") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("sh -o ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("sh -c ") + def test_4(self, completion): + assert not completion diff --git a/test/t/test_sha1sum.py b/test/t/test_sha1sum.py new file mode 100644 index 00000000..efe8dfec --- /dev/null +++ b/test/t/test_sha1sum.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSha1sum: + @pytest.mark.complete("sha1sum --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_shar.py b/test/t/test_shar.py new file mode 100644 index 00000000..f73c4b87 --- /dev/null +++ b/test/t/test_shar.py @@ -0,0 +1,7 @@ +import pytest + + +class TestShar: + @pytest.mark.complete("shar --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_shellcheck.py b/test/t/test_shellcheck.py new file mode 100644 index 00000000..54bc4636 --- /dev/null +++ b/test/t/test_shellcheck.py @@ -0,0 +1,19 @@ +import pytest + + +class TestShellcheck: + @pytest.mark.complete("shellcheck ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("shellcheck -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("shellcheck --format=") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("shellcheck -s ") + def test_4(self, completion): + assert "bash" in completion diff --git a/test/t/test_sitecopy.py b/test/t/test_sitecopy.py new file mode 100644 index 00000000..de66a5dc --- /dev/null +++ b/test/t/test_sitecopy.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSitecopy: + @pytest.mark.complete("sitecopy --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_slackpkg.py b/test/t/test_slackpkg.py new file mode 100644 index 00000000..3997bb02 --- /dev/null +++ b/test/t/test_slackpkg.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSlackpkg: + @pytest.mark.complete("slackpkg -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_slapt_get.py b/test/t/test_slapt_get.py new file mode 100644 index 00000000..1254d5b4 --- /dev/null +++ b/test/t/test_slapt_get.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="slapt-get") +class TestSlaptGet: + @pytest.mark.complete("slapt-get -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("slapt-get --up") + def test_2(self, completion): + assert completion == "--update --upgrade".split() + + @pytest.mark.complete("slapt-get -c non-existent-file --install ") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_slapt_src.py b/test/t/test_slapt_src.py new file mode 100644 index 00000000..df5f4da0 --- /dev/null +++ b/test/t/test_slapt_src.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="slapt-src") +class TestSlaptSrc: + @pytest.mark.complete("slapt-src -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("slapt-src --bu") + def test_2(self, completion): + assert completion == "--build" + + @pytest.mark.complete("slapt-src --ins") + def test_3(self, completion): + assert completion == "--install" diff --git a/test/t/test_smartctl.py b/test/t/test_smartctl.py new file mode 100644 index 00000000..ac6dc68d --- /dev/null +++ b/test/t/test_smartctl.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmartctl: + @pytest.mark.complete("smartctl --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbcacls.py b/test/t/test_smbcacls.py new file mode 100644 index 00000000..1ff16e2b --- /dev/null +++ b/test/t/test_smbcacls.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbcacls: + @pytest.mark.complete("smbcacls -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbclient.py b/test/t/test_smbclient.py new file mode 100644 index 00000000..ed2da4b0 --- /dev/null +++ b/test/t/test_smbclient.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbclient: + @pytest.mark.complete("smbclient -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbcquotas.py b/test/t/test_smbcquotas.py new file mode 100644 index 00000000..b7e01d29 --- /dev/null +++ b/test/t/test_smbcquotas.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbcquotas: + @pytest.mark.complete("smbcquotas -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbget.py b/test/t/test_smbget.py new file mode 100644 index 00000000..a360bd3c --- /dev/null +++ b/test/t/test_smbget.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbget: + @pytest.mark.complete("smbget -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbpasswd.py b/test/t/test_smbpasswd.py new file mode 100644 index 00000000..4d0e76ba --- /dev/null +++ b/test/t/test_smbpasswd.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbpasswd: + @pytest.mark.complete("smbpasswd -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbtar.py b/test/t/test_smbtar.py new file mode 100644 index 00000000..44b424bc --- /dev/null +++ b/test/t/test_smbtar.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbtar: + @pytest.mark.complete("smbtar -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_smbtree.py b/test/t/test_smbtree.py new file mode 100644 index 00000000..0eba4b54 --- /dev/null +++ b/test/t/test_smbtree.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSmbtree: + @pytest.mark.complete("smbtree -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_snownews.py b/test/t/test_snownews.py new file mode 100644 index 00000000..24ed2dfe --- /dev/null +++ b/test/t/test_snownews.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSnownews: + @pytest.mark.complete("snownews --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sort.py b/test/t/test_sort.py new file mode 100644 index 00000000..7dbb5b9d --- /dev/null +++ b/test/t/test_sort.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSort: + @pytest.mark.complete("sort --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_split.py b/test/t/test_split.py new file mode 100644 index 00000000..79013663 --- /dev/null +++ b/test/t/test_split.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSplit: + @pytest.mark.complete("split --", skipif="! split --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_spovray.py b/test/t/test_spovray.py new file mode 100644 index 00000000..9033f835 --- /dev/null +++ b/test/t/test_spovray.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSpovray: + @pytest.mark.complete("spovray ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sqlite3.py b/test/t/test_sqlite3.py new file mode 100644 index 00000000..466281a9 --- /dev/null +++ b/test/t/test_sqlite3.py @@ -0,0 +1,15 @@ +import pytest + + +class TestSqlite3: + @pytest.mark.complete("sqlite3 ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("sqlite3 -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("sqlite3 -scratch foo ") + def test_3(self, completion): + assert not completion diff --git a/test/t/test_ss.py b/test/t/test_ss.py new file mode 100644 index 00000000..3e515dde --- /dev/null +++ b/test/t/test_ss.py @@ -0,0 +1,15 @@ +import pytest + + +class TestSs: + @pytest.mark.complete("ss -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ss -A ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("ss -A foo,") + def test_3(self, completion): + assert completion diff --git a/test/t/test_ssh.py b/test/t/test_ssh.py new file mode 100644 index 00000000..97a4a733 --- /dev/null +++ b/test/t/test_ssh.py @@ -0,0 +1,30 @@ +import pytest + + +class TestSsh: + @pytest.mark.complete("ssh -Fsp", cwd="ssh") + def test_1(self, completion): + assert completion == "-Fspaced conf" + + @pytest.mark.complete("ssh -F config ls", cwd="ssh") + def test_2(self, completion): + """Should complete both commands and hostname.""" + assert all(x in completion for x in "ls ls_known_host".split()) + + @pytest.mark.complete("ssh bash", cwd="ssh") + def test_3(self, completion): + """ + First arg should not complete with commands. + + Assumes there's no "bash" known host. + """ + assert "bash" not in completion + + @pytest.mark.complete("ssh -vo AddressFamily=") + def test_4(self, completion): + assert completion + + @pytest.mark.xfail # TODO our test facilities don't support case change? + @pytest.mark.complete("ssh -vo userknownhostsf") + def test_5(self, completion): + assert "UserKnownHostsFile=" in completion diff --git a/test/t/test_ssh_add.py b/test/t/test_ssh_add.py new file mode 100644 index 00000000..33e679c7 --- /dev/null +++ b/test/t/test_ssh_add.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="ssh-add") +class TestSshAdd: + @pytest.mark.complete("ssh-add ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ssh_copy_id.py b/test/t/test_ssh_copy_id.py new file mode 100644 index 00000000..cb607715 --- /dev/null +++ b/test/t/test_ssh_copy_id.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp( + cmd="ssh-copy-id", + pre_cmds=( + # 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. + "HOME=$PWD/ssh-copy-id", + ), + ignore_env=r"^[+-]_scp_path_esc=", +) +class TestSshCopyId: + @pytest.mark.complete("ssh-copy-id -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ssh_keygen.py b/test/t/test_ssh_keygen.py new file mode 100644 index 00000000..628672d4 --- /dev/null +++ b/test/t/test_ssh_keygen.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="ssh-keygen") +class TestSshKeygen: + @pytest.mark.complete("ssh-keygen -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sshfs.py b/test/t/test_sshfs.py new file mode 100644 index 00000000..44daed3e --- /dev/null +++ b/test/t/test_sshfs.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^[+-]_scp_path_esc=") +class TestSshfs: + @pytest.mark.complete("sshfs ./") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sshmitm.py b/test/t/test_sshmitm.py new file mode 100644 index 00000000..9964c5b5 --- /dev/null +++ b/test/t/test_sshmitm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSshmitm: + @pytest.mark.complete("sshmitm -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sshow.py b/test/t/test_sshow.py new file mode 100644 index 00000000..b6811e0c --- /dev/null +++ b/test/t/test_sshow.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSshow: + @pytest.mark.complete("sshow -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_strace.py b/test/t/test_strace.py new file mode 100644 index 00000000..b9dbfaca --- /dev/null +++ b/test/t/test_strace.py @@ -0,0 +1,7 @@ +import pytest + + +class TestStrace: + @pytest.mark.complete("strace -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_stream.py b/test/t/test_stream.py new file mode 100644 index 00000000..a46e9015 --- /dev/null +++ b/test/t/test_stream.py @@ -0,0 +1,7 @@ +import pytest + + +class TestStream: + @pytest.mark.complete("stream ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_strings.py b/test/t/test_strings.py new file mode 100644 index 00000000..3922ecef --- /dev/null +++ b/test/t/test_strings.py @@ -0,0 +1,7 @@ +import pytest + + +class TestStrings: + @pytest.mark.complete("strings ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_strip.py b/test/t/test_strip.py new file mode 100644 index 00000000..c756fe03 --- /dev/null +++ b/test/t/test_strip.py @@ -0,0 +1,7 @@ +import pytest + + +class TestStrip: + @pytest.mark.complete("strip --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_su.py b/test/t/test_su.py new file mode 100644 index 00000000..e6c5ef4b --- /dev/null +++ b/test/t/test_su.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSu: + @pytest.mark.complete("su ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sudo.py b/test/t/test_sudo.py new file mode 100644 index 00000000..761c5604 --- /dev/null +++ b/test/t/test_sudo.py @@ -0,0 +1,83 @@ +import pytest + +from conftest import assert_complete + + +class TestSudo: + @pytest.mark.complete("sudo -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("sudo cd fo", cwd="shared/default") + def test_2(self, completion): + assert completion == "foo.d/" + assert not completion.endswith(" ") + + @pytest.mark.complete("sudo sh share") + def test_3(self, completion): + assert completion == "shared/" + assert not completion.endswith(" ") + + @pytest.mark.complete("sudo mount /dev/sda1 def", cwd="shared") + def test_4(self, completion): + assert completion == "default/" + assert not completion.endswith(" ") + + @pytest.mark.complete("sudo -e -u root bar foo", cwd="shared/default") + def test_5(self, completion): + assert completion == ["foo", "foo.d/"] + + def test_6(self, bash, part_full_user): + part, full = part_full_user + completion = assert_complete(bash, "sudo chown %s" % part) + assert completion == full + assert completion.endswith(" ") + + def test_7(self, bash, part_full_user, part_full_group): + _, user = part_full_user + partgroup, fullgroup = part_full_group + completion = assert_complete( + bash, "sudo chown %s:%s" % (user, partgroup) + ) + assert completion == "%s:%s" % (user, fullgroup) + assert completion.endswith(" ") + + def test_8(self, bash, part_full_group): + part, full = part_full_group + completion = assert_complete(bash, "sudo chown dot.user:%s" % part) + assert completion == "dot.user:%s" % full + assert completion.endswith(" ") + + @pytest.mark.xfail # TODO check escaping, whitespace + def test_9(self, bash, part_full_group): + """Test preserving special chars in $prefix$partgroup<TAB>.""" + part, full = part_full_group + for prefix in ( + r"funky\ user:", + "funky.user:", + r"funky\.user:", + r"fu\ nky.user:", + r"f\ o\ o\.\bar:", + r"foo\_b\ a\.r\ :", + ): + completion = assert_complete( + bash, "sudo chown %s%s" % (prefix, part) + ) + assert completion == "%s%s" % (prefix, full) + assert completion.endswith(" ") + + def test_10(self, bash, part_full_user, part_full_group): + """Test giving up on degenerate cases instead of spewing junk.""" + _, user = part_full_user + partgroup, _ = part_full_group + for x in range(2, 5): + completion = assert_complete( + bash, "sudo chown %s%s:%s" % (user, x * "\\", partgroup) + ) + assert not completion + + def test_11(self, bash, part_full_group): + """Test graceful fail on colon in user/group name.""" + part, _ = part_full_group + completion = assert_complete(bash, "sudo chown foo:bar:%s" % part) + assert not completion diff --git a/test/t/test_svcadm.py b/test/t/test_svcadm.py new file mode 100644 index 00000000..76d86a47 --- /dev/null +++ b/test/t/test_svcadm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSvcadm: + @pytest.mark.complete("svcadm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_svk.py b/test/t/test_svk.py new file mode 100644 index 00000000..8014bb01 --- /dev/null +++ b/test/t/test_svk.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSvk: + @pytest.mark.complete("svk ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_svn.py b/test/t/test_svn.py new file mode 100644 index 00000000..d8bbee7b --- /dev/null +++ b/test/t/test_svn.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSvn: + @pytest.mark.complete("svn ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_svnadmin.py b/test/t/test_svnadmin.py new file mode 100644 index 00000000..2dc7c6c7 --- /dev/null +++ b/test/t/test_svnadmin.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSvnadmin: + @pytest.mark.complete("svnadmin ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_svnlook.py b/test/t/test_svnlook.py new file mode 100644 index 00000000..26761b08 --- /dev/null +++ b/test/t/test_svnlook.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSvnlook: + @pytest.mark.complete("svnlook ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sync_members.py b/test/t/test_sync_members.py new file mode 100644 index 00000000..f0d2dcf0 --- /dev/null +++ b/test/t/test_sync_members.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSyncMembers: + @pytest.mark.complete("sync_members --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_synclient.py b/test/t/test_synclient.py new file mode 100644 index 00000000..23138294 --- /dev/null +++ b/test/t/test_synclient.py @@ -0,0 +1,14 @@ +import pytest + + +class TestSynclient: + + # synclient -l may error out with e.g. + # "Couldn't find synaptics properties. No synaptics driver loaded?" + @pytest.mark.complete("synclient ", skipif="! synclient -l &>/dev/null") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("synclient -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_sysbench.py b/test/t/test_sysbench.py new file mode 100644 index 00000000..afe21eca --- /dev/null +++ b/test/t/test_sysbench.py @@ -0,0 +1,7 @@ +import pytest + + +class TestSysbench: + @pytest.mark.complete("sysbench ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_sysctl.py b/test/t/test_sysctl.py new file mode 100644 index 00000000..773b5910 --- /dev/null +++ b/test/t/test_sysctl.py @@ -0,0 +1,14 @@ +import pytest + + +class TestSysctl: + @pytest.mark.complete("sysctl -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete( + "sysctl kern", + skipif="! sysctl -N -a 2>/dev/null | " "command grep -q ^kern", + ) + def test_2(self, completion): + assert completion diff --git a/test/t/test_tac.py b/test/t/test_tac.py new file mode 100644 index 00000000..f612cc90 --- /dev/null +++ b/test/t/test_tac.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTac: + @pytest.mark.complete("tac --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tail.py b/test/t/test_tail.py new file mode 100644 index 00000000..1b818f7d --- /dev/null +++ b/test/t/test_tail.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTail: + @pytest.mark.complete("tail --", skipif="! tail --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tar.py b/test/t/test_tar.py new file mode 100644 index 00000000..309bcc76 --- /dev/null +++ b/test/t/test_tar.py @@ -0,0 +1,126 @@ +import re + +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(ignore_env=r"^-declare -f _tar$") +class TestTar: + @pytest.fixture(scope="class") + def gnu_tar(self, bash): + got = assert_bash_exec(bash, "tar --version || :", want_output=True) + if not re.search(r"\bGNU ", got): + pytest.skip("Not GNU tar") + + @pytest.mark.complete("tar ") + def test_1(self, completion): + assert completion + + # Test "f" when mode is not as first option + @pytest.mark.complete("tar zfc ", cwd="tar") + def test_2(self, completion): + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar cf ", cwd="tar") + def test_3(self, completion): + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar tf archive.tar.xz dir/file", cwd="tar") + def test_4(self, completion): + assert completion == "dir/fileA dir/fileB dir/fileC".split() + + @pytest.mark.complete("tar cTfvv NOT_EXISTS DONT_CREATE.tar ", cwd="tar") + def test_5(self, completion): + assert completion == "archive.tar.xz dir/ dir2/ escape.tar".split() + + @pytest.mark.complete("tar xvf ", cwd="tar") + def test_6(self, completion): + assert completion == "archive.tar.xz dir/ dir2/ escape.tar".split() + + @pytest.mark.complete("tar -c") + def test_7(self, completion, gnu_tar): + """Test short options.""" + assert completion + + @pytest.mark.complete("tar -zcf ", cwd="tar") + def test_8(self, completion, gnu_tar): + """Test mode not as first option.""" + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar -cf ", cwd="tar") + def test_9(self, completion, gnu_tar): + """Test that we don't suggest rewriting existing archive.""" + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar -c --file ", cwd="tar") + def test_10(self, completion, gnu_tar): + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar -cvv --file ", cwd="tar") + def test_11(self, completion, gnu_tar): + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete("tar -tf archive.tar.xz dir/file", cwd="tar") + def test_12(self, completion, gnu_tar): + """Test archive listing.""" + assert completion == "dir/fileA dir/fileB dir/fileC".split() + + @pytest.mark.complete("tar -t --file archive.tar.xz dir/file", cwd="tar") + def test_13(self, completion, gnu_tar): + """Test archive listing with --file.""" + assert completion == "dir/fileA dir/fileB dir/fileC".split() + + @pytest.mark.complete("tar --block") + def test_14(self, completion, gnu_tar): + assert completion == "--block-number --blocking-factor=".split() + + @pytest.mark.complete("tar --add-fil") + def test_15(self, completion, gnu_tar): + assert completion == "--add-file=" + assert not completion.endswith(" ") + + @pytest.mark.complete("tar -cf /dev/null --posi") + def test_16(self, completion, gnu_tar): + assert completion == "--posix" + assert completion.endswith(" ") + + @pytest.mark.complete("tar --owner=") + def test_17(self, bash, completion, gnu_tar): + users = sorted( + assert_bash_exec(bash, "compgen -A user", want_output=True).split() + ) + assert completion == users + + @pytest.mark.complete("tar --group=") + def test_18(self, bash, completion, gnu_tar): + groups = sorted( + assert_bash_exec( + bash, "compgen -A group", want_output=True + ).split() + ) + assert completion == groups + + # Use -b for this as -b is still not handled by tar's completion + @pytest.mark.complete("tar -cvvfb ") + def test_19(self, bash, completion, gnu_tar): + """Test short option -XXXb <TAB> (arg required).""" + assert not completion + + # Use bsdtar here as it completes to only 'zc zt zx' + # -- 'tar' can be GNU tar and have more options + @pytest.mark.complete("bsdtar z") + def test_20(self, bash, completion): + assert completion == "zc zt zx".split() + + @pytest.mark.complete("bsdtar cbfvv NON_EXISTENT ", cwd="tar") + def test_21(self, bash, completion): + """Test _second_ option in "old" argument.""" + assert completion == "dir/ dir2/".split() + + @pytest.mark.complete(r"tar tf escape.tar a/b\'", cwd="tar") + def test_22(self, bash, completion): + """Test listing escaped chars in old option.""" + assert completion == "a/b'c/" + + # TODO: "tar tf escape.tar a/b" diff --git a/test/t/test_tcpdump.py b/test/t/test_tcpdump.py new file mode 100644 index 00000000..ec26187f --- /dev/null +++ b/test/t/test_tcpdump.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTcpdump: + @pytest.mark.complete("tcpdump -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tcpkill.py b/test/t/test_tcpkill.py new file mode 100644 index 00000000..4581a346 --- /dev/null +++ b/test/t/test_tcpkill.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTcpkill: + @pytest.mark.complete("tcpkill -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tcpnice.py b/test/t/test_tcpnice.py new file mode 100644 index 00000000..c7d208d1 --- /dev/null +++ b/test/t/test_tcpnice.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTcpnice: + @pytest.mark.complete("tcpnice -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tee.py b/test/t/test_tee.py new file mode 100644 index 00000000..b0914624 --- /dev/null +++ b/test/t/test_tee.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTee: + @pytest.mark.complete("tee ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_texindex.py b/test/t/test_texindex.py new file mode 100644 index 00000000..4a2387ff --- /dev/null +++ b/test/t/test_texindex.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTexindex: + @pytest.mark.complete("texindex --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tightvncviewer.py b/test/t/test_tightvncviewer.py new file mode 100644 index 00000000..04ebece5 --- /dev/null +++ b/test/t/test_tightvncviewer.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTightvncviewer: + @pytest.mark.complete("tightvncviewer ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_time.py b/test/t/test_time.py new file mode 100644 index 00000000..231f14eb --- /dev/null +++ b/test/t/test_time.py @@ -0,0 +1,23 @@ +import os + +import pytest + + +class TestTime: + @pytest.mark.complete("time set") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("time -p find -typ") + def test_2(self, completion): + assert completion # find's options + + @pytest.mark.complete("time shared/bin/") + def test_3(self, completion): + execs = sorted( + x + for x in os.listdir("shared/bin") + if os.path.isfile("shared/bin/%s" % x) + and os.access("shared/bin/%s" % x, os.X_OK) + ) + assert completion == execs diff --git a/test/t/test_timeout.py b/test/t/test_timeout.py new file mode 100644 index 00000000..6b5ac5f0 --- /dev/null +++ b/test/t/test_timeout.py @@ -0,0 +1,11 @@ +import pytest + + +class TestTimeout: + @pytest.mark.complete("timeout ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("timeout -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_tipc.py b/test/t/test_tipc.py new file mode 100644 index 00000000..17b2bfda --- /dev/null +++ b/test/t/test_tipc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTipc: + @pytest.mark.complete("tipc ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_touch.py b/test/t/test_touch.py new file mode 100644 index 00000000..cc398d81 --- /dev/null +++ b/test/t/test_touch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTouch: + @pytest.mark.complete("touch --", skipif="! touch --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tox.py b/test/t/test_tox.py new file mode 100644 index 00000000..b6149362 --- /dev/null +++ b/test/t/test_tox.py @@ -0,0 +1,15 @@ +import pytest + + +class TestTox: + @pytest.mark.complete("tox -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("tox -e ") + def test_2(self, completion): + assert completion == "ALL" + + @pytest.mark.complete("tox -e foo,") + def test_3(self, completion): + assert completion == "foo,ALL" diff --git a/test/t/test_tr.py b/test/t/test_tr.py new file mode 100644 index 00000000..84597012 --- /dev/null +++ b/test/t/test_tr.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTr: + @pytest.mark.complete("tr --", skipif="! tr --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_tracepath.py b/test/t/test_tracepath.py new file mode 100644 index 00000000..a6ef7a41 --- /dev/null +++ b/test/t/test_tracepath.py @@ -0,0 +1,11 @@ +import pytest + + +class TestTracepath: + @pytest.mark.complete("tracepath ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("tracepath -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_tshark.py b/test/t/test_tshark.py new file mode 100644 index 00000000..6505e6a8 --- /dev/null +++ b/test/t/test_tshark.py @@ -0,0 +1,31 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^\+_tshark_pr(ef|otocol)s=") +class TestTshark: + @pytest.mark.complete("tshark -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("tshark -G ") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("tshark -O foo,htt") + def test_3(self, completion): + # When there's only one completion, it's be the one with "foo," prefix; + # when multiple (e.g. http and http2), it's the completion alone. + assert completion == "foo,http" or "http" in completion + + @pytest.mark.complete("tshark -o tcp") + def test_4(self, completion): + assert "tcp.desegment_tcp_streams:" in completion + + @pytest.mark.complete("tshark -otcp") + def test_5(self, completion): + assert "-otcp.desegment_tcp_streams:" in completion + + @pytest.mark.complete("tshark -O http") + def test_6(self, completion): + """Test there are no URLs in completions.""" + assert not any("://" in x for x in completion) diff --git a/test/t/test_tune2fs.py b/test/t/test_tune2fs.py new file mode 100644 index 00000000..c8f4e873 --- /dev/null +++ b/test/t/test_tune2fs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestTune2fs: + @pytest.mark.complete("tune2fs ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_udevadm.py b/test/t/test_udevadm.py new file mode 100644 index 00000000..d5dcddbb --- /dev/null +++ b/test/t/test_udevadm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUdevadm: + @pytest.mark.complete("udevadm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ulimit.py b/test/t/test_ulimit.py new file mode 100644 index 00000000..24785beb --- /dev/null +++ b/test/t/test_ulimit.py @@ -0,0 +1,35 @@ +import pytest + + +class TestUlimit: + @pytest.mark.complete("ulimit ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("ulimit -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("ulimit -S -") + def test_3(self, completion): + """Test modes are completed after -S (-S not treated as mode).""" + assert completion + + @pytest.mark.complete("ulimit -u -") + def test_4(self, completion): + """Test modes are NOT completed if one is specified.""" + assert not completion + + @pytest.mark.complete("ulimit -c ") + def test_5(self, completion): + assert completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("ulimit -a ") + def test_6(self, completion): + assert completion == sorted("-S -H".split()) + + @pytest.mark.complete("ulimit -a -H -") + def test_7(self, completion): + """Test modes are NOT completed with -a given somewhere.""" + assert not completion diff --git a/test/t/test_umount.py b/test/t/test_umount.py new file mode 100644 index 00000000..dd4ae0b5 --- /dev/null +++ b/test/t/test_umount.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUmount: + @pytest.mark.complete("umount ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unace.py b/test/t/test_unace.py new file mode 100644 index 00000000..e4d5acb7 --- /dev/null +++ b/test/t/test_unace.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnace: + @pytest.mark.complete("unace -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_uname.py b/test/t/test_uname.py new file mode 100644 index 00000000..743f317c --- /dev/null +++ b/test/t/test_uname.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUname: + @pytest.mark.complete("uname --", skipif="! uname --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unexpand.py b/test/t/test_unexpand.py new file mode 100644 index 00000000..6b77b3bb --- /dev/null +++ b/test/t/test_unexpand.py @@ -0,0 +1,9 @@ +import pytest + + +class TestUnexpand: + @pytest.mark.complete( + "unexpand --", skipif="! unexpand --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_uniq.py b/test/t/test_uniq.py new file mode 100644 index 00000000..8647c615 --- /dev/null +++ b/test/t/test_uniq.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUniq: + @pytest.mark.complete("uniq --", skipif="! uniq --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_units.py b/test/t/test_units.py new file mode 100644 index 00000000..aa1f89c8 --- /dev/null +++ b/test/t/test_units.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnits: + @pytest.mark.complete("units --", skipif="! units --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unpack200.py b/test/t/test_unpack200.py new file mode 100644 index 00000000..16c04025 --- /dev/null +++ b/test/t/test_unpack200.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnpack200: + @pytest.mark.complete("unpack200 ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unrar.py b/test/t/test_unrar.py new file mode 100644 index 00000000..45e336ef --- /dev/null +++ b/test/t/test_unrar.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnrar: + @pytest.mark.complete("unrar -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unset.py b/test/t/test_unset.py new file mode 100644 index 00000000..9f3eaded --- /dev/null +++ b/test/t/test_unset.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnset: + @pytest.mark.complete("unset BASH_ARG") + def test_1(self, completion): + assert completion diff --git a/test/t/test_unshunt.py b/test/t/test_unshunt.py new file mode 100644 index 00000000..966312ed --- /dev/null +++ b/test/t/test_unshunt.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUnshunt: + @pytest.mark.complete("unshunt --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_update_alternatives.py b/test/t/test_update_alternatives.py new file mode 100644 index 00000000..1209bebf --- /dev/null +++ b/test/t/test_update_alternatives.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="update-alternatives") +class TestUpdateAlternatives: + @pytest.mark.complete("update-alternatives --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_update_rc_d.py b/test/t/test_update_rc_d.py new file mode 100644 index 00000000..6f574168 --- /dev/null +++ b/test/t/test_update_rc_d.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="update-rc.d") +class TestUpdateRcD: + @pytest.mark.complete("update-rc.d -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_upgradepkg.py b/test/t/test_upgradepkg.py new file mode 100644 index 00000000..ada84f1c --- /dev/null +++ b/test/t/test_upgradepkg.py @@ -0,0 +1,34 @@ +import fnmatch +import os + +import pytest + + +class TestUpgradepkg: + @pytest.mark.complete("upgradepkg -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("upgradepkg --") + def test_2(self, completion): + assert ( + completion == "--dry-run --install-new --reinstall " + "--verbose".split() + ) + + @pytest.mark.complete("upgradepkg ", cwd="slackware/home") + def test_4(self, completion): + expected = sorted( + [ + "%s/" % x + for x in os.listdir("slackware/home") + if os.path.isdir("./%s" % x) + ] + + [ + x + for x in os.listdir("slackware/home") + if os.path.isfile("./%s" % x) + and fnmatch.fnmatch(x, "*.t[bglx]z") + ] + ) + assert completion == expected diff --git a/test/t/test_urlsnarf.py b/test/t/test_urlsnarf.py new file mode 100644 index 00000000..a9482113 --- /dev/null +++ b/test/t/test_urlsnarf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUrlsnarf: + @pytest.mark.complete("urlsnarf -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_uscan.py b/test/t/test_uscan.py new file mode 100644 index 00000000..5f4c684a --- /dev/null +++ b/test/t/test_uscan.py @@ -0,0 +1,7 @@ +import pytest + + +class TestUscan: + @pytest.mark.complete("uscan -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_useradd.py b/test/t/test_useradd.py new file mode 100644 index 00000000..557d4a91 --- /dev/null +++ b/test/t/test_useradd.py @@ -0,0 +1,11 @@ +import pytest + + +class TestUseradd: + @pytest.mark.complete("useradd ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("useradd -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_userdel.py b/test/t/test_userdel.py new file mode 100644 index 00000000..74003eb1 --- /dev/null +++ b/test/t/test_userdel.py @@ -0,0 +1,11 @@ +import pytest + + +class TestUserdel: + @pytest.mark.complete("userdel -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("userdel root") + def test_2(self, completion): + assert "root" in completion diff --git a/test/t/test_usermod.py b/test/t/test_usermod.py new file mode 100644 index 00000000..1eb169c7 --- /dev/null +++ b/test/t/test_usermod.py @@ -0,0 +1,11 @@ +import pytest + + +class TestUsermod: + @pytest.mark.complete("usermod ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("usermod -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_valgrind.py b/test/t/test_valgrind.py new file mode 100644 index 00000000..2b03d6f9 --- /dev/null +++ b/test/t/test_valgrind.py @@ -0,0 +1,40 @@ +import os + +import pytest + + +class TestValgrind: + + # b: Assume we have at least bash that starts with b in PATH + @pytest.mark.complete("valgrind b") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("valgrind -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("valgrind --tool=memche") + def test_3(self, completion): + assert "--tool=memcheck" in completion + + @pytest.mark.complete("valgrind --tool=helgrind --history-l") + def test_4(self, completion): + assert "--history-level=" in completion + assert not completion.endswith(" ") + + @pytest.mark.complete(r"valgrind --log-file=v\ 0.log ./bin/", cwd="shared") + def test_5(self, completion): + expected = sorted( + [ + "%s/" + for x in os.listdir("shared/bin") + if os.path.isdir("shared/bin/%s" % x) + ] + + [ + x + for x in os.listdir("shared/bin") + if os.path.isfile("shared/bin/%s" % x) + ] + ) + assert completion == expected diff --git a/test/t/test_vdir.py b/test/t/test_vdir.py new file mode 100644 index 00000000..2f6a744e --- /dev/null +++ b/test/t/test_vdir.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVdir: + @pytest.mark.complete("vdir ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgcfgbackup.py b/test/t/test_vgcfgbackup.py new file mode 100644 index 00000000..20ef09cc --- /dev/null +++ b/test/t/test_vgcfgbackup.py @@ -0,0 +1,9 @@ +import pytest + + +class TestVgcfgbackup: + @pytest.mark.complete( + "vgcfgbackup -", skipif="! vgcfgbackup --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgcfgrestore.py b/test/t/test_vgcfgrestore.py new file mode 100644 index 00000000..26096555 --- /dev/null +++ b/test/t/test_vgcfgrestore.py @@ -0,0 +1,9 @@ +import pytest + + +class TestVgcfgrestore: + @pytest.mark.complete( + "vgcfgrestore -", skipif="! vgcfgrestore --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgchange.py b/test/t/test_vgchange.py new file mode 100644 index 00000000..0e268bad --- /dev/null +++ b/test/t/test_vgchange.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgchange: + @pytest.mark.complete("vgchange -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgck.py b/test/t/test_vgck.py new file mode 100644 index 00000000..347f8f9b --- /dev/null +++ b/test/t/test_vgck.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgck: + @pytest.mark.complete("vgck -", skipif="! vgck --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgconvert.py b/test/t/test_vgconvert.py new file mode 100644 index 00000000..9810bc2f --- /dev/null +++ b/test/t/test_vgconvert.py @@ -0,0 +1,9 @@ +import pytest + + +class TestVgconvert: + @pytest.mark.complete( + "vgconvert -", skipif="! vgconvert --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgcreate.py b/test/t/test_vgcreate.py new file mode 100644 index 00000000..07518e58 --- /dev/null +++ b/test/t/test_vgcreate.py @@ -0,0 +1,11 @@ +import pytest + + +class TestVgcreate: + @pytest.mark.complete("vgcreate -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("vgcreate __does_not_exist__") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_vgdisplay.py b/test/t/test_vgdisplay.py new file mode 100644 index 00000000..a6919a6c --- /dev/null +++ b/test/t/test_vgdisplay.py @@ -0,0 +1,9 @@ +import pytest + + +class TestVgdisplay: + @pytest.mark.complete( + "vgdisplay -", skipif="! vgdisplay --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgexport.py b/test/t/test_vgexport.py new file mode 100644 index 00000000..ce9a93bf --- /dev/null +++ b/test/t/test_vgexport.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgexport: + @pytest.mark.complete("vgexport -", skipif="! vgexport --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgextend.py b/test/t/test_vgextend.py new file mode 100644 index 00000000..3d3347f1 --- /dev/null +++ b/test/t/test_vgextend.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgextend: + @pytest.mark.complete("vgextend -", skipif="! vgextend --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgimport.py b/test/t/test_vgimport.py new file mode 100644 index 00000000..1a3efab0 --- /dev/null +++ b/test/t/test_vgimport.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgimport: + @pytest.mark.complete("vgimport -", skipif="! vgimport --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgmerge.py b/test/t/test_vgmerge.py new file mode 100644 index 00000000..971eb69a --- /dev/null +++ b/test/t/test_vgmerge.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgmerge: + @pytest.mark.complete("vgmerge -", skipif="! vgmerge --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgmknodes.py b/test/t/test_vgmknodes.py new file mode 100644 index 00000000..3209de9f --- /dev/null +++ b/test/t/test_vgmknodes.py @@ -0,0 +1,9 @@ +import pytest + + +class TestVgmknodes: + @pytest.mark.complete( + "vgmknodes -", skipif="! vgmknodes --help &>/dev/null" + ) + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgreduce.py b/test/t/test_vgreduce.py new file mode 100644 index 00000000..97641b42 --- /dev/null +++ b/test/t/test_vgreduce.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgreduce: + @pytest.mark.complete("vgreduce -", skipif="! vgreduce --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgremove.py b/test/t/test_vgremove.py new file mode 100644 index 00000000..9c47752c --- /dev/null +++ b/test/t/test_vgremove.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgremove: + @pytest.mark.complete("vgremove -", skipif="! vgremove --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgrename.py b/test/t/test_vgrename.py new file mode 100644 index 00000000..ea5bc050 --- /dev/null +++ b/test/t/test_vgrename.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgrename: + @pytest.mark.complete("vgrename -", skipif="! vgrename --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgs.py b/test/t/test_vgs.py new file mode 100644 index 00000000..d492fe8d --- /dev/null +++ b/test/t/test_vgs.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgs: + @pytest.mark.complete("vgs -", skipif="! vgs --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgscan.py b/test/t/test_vgscan.py new file mode 100644 index 00000000..061ff4e2 --- /dev/null +++ b/test/t/test_vgscan.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgscan: + @pytest.mark.complete("vgscan -", skipif="! vgscan --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vgsplit.py b/test/t/test_vgsplit.py new file mode 100644 index 00000000..7b5a6869 --- /dev/null +++ b/test/t/test_vgsplit.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVgsplit: + @pytest.mark.complete("vgsplit -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vi.py b/test/t/test_vi.py new file mode 100644 index 00000000..4f7f4c2b --- /dev/null +++ b/test/t/test_vi.py @@ -0,0 +1,11 @@ +import pytest + + +class TestVi: + @pytest.mark.complete("vi ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("vi shared/ld.so.conf.d/") + def test_2(self, completion): + assert completion == "foo.txt libfoo.conf".split() diff --git a/test/t/test_vipw.py b/test/t/test_vipw.py new file mode 100644 index 00000000..160cb11b --- /dev/null +++ b/test/t/test_vipw.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVipw: + @pytest.mark.complete("vipw -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vmstat.py b/test/t/test_vmstat.py new file mode 100644 index 00000000..47b55f6f --- /dev/null +++ b/test/t/test_vmstat.py @@ -0,0 +1,7 @@ +import pytest + + +class TestVmstat: + @pytest.mark.complete("vmstat -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vncviewer.py b/test/t/test_vncviewer.py new file mode 100644 index 00000000..9e2f1486 --- /dev/null +++ b/test/t/test_vncviewer.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(ignore_env=r"^-declare -f _vncviewer_bootstrap$") +class TestVncviewer: + @pytest.mark.complete("vncviewer ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_vpnc.py b/test/t/test_vpnc.py new file mode 100644 index 00000000..29a120a4 --- /dev/null +++ b/test/t/test_vpnc.py @@ -0,0 +1,13 @@ +import pytest + + +@pytest.mark.bashcomp( + # On CentOS and Fedora, there's something fishy with consolehelper and + # /usr/bin/vpnc going on at least when invoked as root; try to invoke the + # one in /usr/sbin instead. + pre_cmds=("PATH=/usr/sbin:$PATH",) +) +class TestVpnc: + @pytest.mark.complete("vpnc -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_watch.py b/test/t/test_watch.py new file mode 100644 index 00000000..8387ae0a --- /dev/null +++ b/test/t/test_watch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWatch: + @pytest.mark.complete("watch -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wc.py b/test/t/test_wc.py new file mode 100644 index 00000000..eb7b5a85 --- /dev/null +++ b/test/t/test_wc.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWc: + @pytest.mark.complete("wc --", skipif="! wc --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_webmitm.py b/test/t/test_webmitm.py new file mode 100644 index 00000000..e9f85940 --- /dev/null +++ b/test/t/test_webmitm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWebmitm: + @pytest.mark.complete("webmitm -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wget.py b/test/t/test_wget.py new file mode 100644 index 00000000..f8af4fb3 --- /dev/null +++ b/test/t/test_wget.py @@ -0,0 +1,11 @@ +import pytest + + +class TestWget: + @pytest.mark.complete("wget ") + def test_1(self, completion): + assert not completion + + @pytest.mark.complete("wget --h") + def test_2(self, completion): + assert completion diff --git a/test/t/test_who.py b/test/t/test_who.py new file mode 100644 index 00000000..d1f29ea7 --- /dev/null +++ b/test/t/test_who.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWho: + @pytest.mark.complete("who --", skipif="! who --help &>/dev/null") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wine.py b/test/t/test_wine.py new file mode 100644 index 00000000..d0e5698b --- /dev/null +++ b/test/t/test_wine.py @@ -0,0 +1,11 @@ +import pytest + + +class TestWine: + @pytest.mark.complete("wine ", cwd="shared/default") + def test_1(self, completion): + assert completion == ["bar bar.d/", "foo.d/"] + + @pytest.mark.complete("wine notepad ", cwd="shared/default") + def test_2(self, completion): + assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"] diff --git a/test/t/test_withlist.py b/test/t/test_withlist.py new file mode 100644 index 00000000..752c3943 --- /dev/null +++ b/test/t/test_withlist.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWithlist: + @pytest.mark.complete("withlist --") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wodim.py b/test/t/test_wodim.py new file mode 100644 index 00000000..4b785b6d --- /dev/null +++ b/test/t/test_wodim.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWodim: + @pytest.mark.complete("wodim ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wol.py b/test/t/test_wol.py new file mode 100644 index 00000000..8a6bea21 --- /dev/null +++ b/test/t/test_wol.py @@ -0,0 +1,15 @@ +import pytest + + +@pytest.mark.bashcomp(pre_cmds=("PATH=$PWD/shared/bin:$PATH",)) +class TestWol: + @pytest.mark.complete("wol ") + def test_1(self, completion): + assert ( + completion == "00:00:00:00:00:00 11:11:11:11:11:11 " + "22:22:22:22:22:22 33:33:33:33:33:33".split() + ) + + @pytest.mark.complete("wol 00:") + def test_2(self, completion): + assert completion == "00:00:00:00:00:00" diff --git a/test/t/test_write.py b/test/t/test_write.py new file mode 100644 index 00000000..8f0886e4 --- /dev/null +++ b/test/t/test_write.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWrite: + @pytest.mark.complete("write root") + def test_1(self, completion): + assert "root" in completion diff --git a/test/t/test_wsimport.py b/test/t/test_wsimport.py new file mode 100644 index 00000000..b75bf0f7 --- /dev/null +++ b/test/t/test_wsimport.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWsimport: + @pytest.mark.complete("wsimport ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wtf.py b/test/t/test_wtf.py new file mode 100644 index 00000000..6b2c9745 --- /dev/null +++ b/test/t/test_wtf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWtf: + @pytest.mark.complete("wtf A") + def test_1(self, completion): + assert completion diff --git a/test/t/test_wvdial.py b/test/t/test_wvdial.py new file mode 100644 index 00000000..19043f61 --- /dev/null +++ b/test/t/test_wvdial.py @@ -0,0 +1,7 @@ +import pytest + + +class TestWvdial: + @pytest.mark.complete("wvdial -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_xdg_mime.py b/test/t/test_xdg_mime.py new file mode 100644 index 00000000..432be067 --- /dev/null +++ b/test/t/test_xdg_mime.py @@ -0,0 +1,28 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="xdg-mime") +class TestXdgMime: + @pytest.mark.complete("xdg-mime ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xdg-mime -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("xdg-mime query ") + def test_3(self, completion): + assert completion + + @pytest.mark.complete("xdg-mime query filetype ") + def test_4(self, completion): + assert completion + + @pytest.mark.complete("xdg-mime default foo.desktop ") + def test_5(self, completion): + assert completion + + @pytest.mark.complete("xdg-mime install --mode ") + def test_6(self, completion): + assert completion diff --git a/test/t/test_xdg_settings.py b/test/t/test_xdg_settings.py new file mode 100644 index 00000000..a50df579 --- /dev/null +++ b/test/t/test_xdg_settings.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="xdg-settings") +class TestXdgSettings: + @pytest.mark.complete("xdg-settings ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xdg-settings --") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("xdg-settings get ") + def test_3(self, completion): + assert completion diff --git a/test/t/test_xfreerdp.py b/test/t/test_xfreerdp.py new file mode 100644 index 00000000..fdad1926 --- /dev/null +++ b/test/t/test_xfreerdp.py @@ -0,0 +1,46 @@ +import pytest + +from conftest import assert_bash_exec + + +class TestXfreerdp: + def _help(self, bash): + return assert_bash_exec(bash, "xfreerdp --help || :", want_output=True) + + @pytest.fixture(scope="class") + def slash_syntax(self, bash): + if "/help" not in self._help(bash): + pytest.skip("Not slash syntax") + + @pytest.fixture(scope="class") + def dash_syntax(self, bash): + if "/help" in self._help(bash): + pytest.skip("Not dash syntax") + + @pytest.mark.complete("xfreerdp /") + def test_1(self, bash, completion, slash_syntax): + assert completion + + @pytest.mark.complete("xfreerdp -") + def test_2(self, completion): + assert completion + + @pytest.mark.complete("xfreerdp +") + def test_3(self, bash, completion, slash_syntax): + assert completion + + @pytest.mark.complete("xfreerdp /kbd:") + def test_4(self, bash, completion, slash_syntax): + assert completion + + @pytest.mark.complete("xfreerdp /help ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete("xfreerdp -k ") + def test_6(self, bash, completion, dash_syntax): + assert completion + + @pytest.mark.complete("xfreerdp --help ") + def test_7(self, completion): + assert not completion diff --git a/test/t/test_xgamma.py b/test/t/test_xgamma.py new file mode 100644 index 00000000..56c9440d --- /dev/null +++ b/test/t/test_xgamma.py @@ -0,0 +1,12 @@ +import pytest + + +class TestXgamma: + @pytest.mark.complete("xgamma -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xgamma -gam") + def test_2(self, completion): + assert completion == "-gamma" + assert completion.endswith(" ") diff --git a/test/t/test_xm.py b/test/t/test_xm.py new file mode 100644 index 00000000..42c4c53d --- /dev/null +++ b/test/t/test_xm.py @@ -0,0 +1,7 @@ +import pytest + + +class TestXm: + @pytest.mark.complete("xm ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_xmllint.py b/test/t/test_xmllint.py new file mode 100644 index 00000000..0c0ebbcd --- /dev/null +++ b/test/t/test_xmllint.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXmllint: + @pytest.mark.complete("xmllint ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xmllint -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_xmlwf.py b/test/t/test_xmlwf.py new file mode 100644 index 00000000..8751f865 --- /dev/null +++ b/test/t/test_xmlwf.py @@ -0,0 +1,7 @@ +import pytest + + +class TestXmlwf: + @pytest.mark.complete("xmlwf ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_xmms.py b/test/t/test_xmms.py new file mode 100644 index 00000000..1c96e2b5 --- /dev/null +++ b/test/t/test_xmms.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXmms: + @pytest.mark.complete("xmms --") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xmms --non-existent-option=--") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_xmodmap.py b/test/t/test_xmodmap.py new file mode 100644 index 00000000..d6d0ceae --- /dev/null +++ b/test/t/test_xmodmap.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXmodmap: + @pytest.mark.complete("xmodmap ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xmodmap -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_xpovray.py b/test/t/test_xpovray.py new file mode 100644 index 00000000..4f603a7c --- /dev/null +++ b/test/t/test_xpovray.py @@ -0,0 +1,7 @@ +import pytest + + +class TestXpovray: + @pytest.mark.complete("xpovray ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_xrandr.py b/test/t/test_xrandr.py new file mode 100644 index 00000000..e4e0d6b7 --- /dev/null +++ b/test/t/test_xrandr.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXrandr: + @pytest.mark.complete("xrandr ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xrandr --mode ") + def test_2(self, completion): + assert not completion diff --git a/test/t/test_xrdb.py b/test/t/test_xrdb.py new file mode 100644 index 00000000..8f675e68 --- /dev/null +++ b/test/t/test_xrdb.py @@ -0,0 +1,7 @@ +import pytest + + +class TestXrdb: + @pytest.mark.complete("xrdb ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_xsltproc.py b/test/t/test_xsltproc.py new file mode 100644 index 00000000..26898777 --- /dev/null +++ b/test/t/test_xsltproc.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXsltproc: + @pytest.mark.complete("xsltproc ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xsltproc -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_xvnc4viewer.py b/test/t/test_xvnc4viewer.py new file mode 100644 index 00000000..72fe3f98 --- /dev/null +++ b/test/t/test_xvnc4viewer.py @@ -0,0 +1,15 @@ +import pytest + + +class TestXvnc4viewer: + @pytest.mark.complete("xvnc4viewer -") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xvnc4viewer -PreferredEncoding ") + def test_2(self, completion): + assert completion == "hextile raw zrle".split() + + @pytest.mark.complete("xvnc4viewer --preferredencoding ") + def test_3(self, completion): + assert completion == "hextile raw zrle".split() diff --git a/test/t/test_xxd.py b/test/t/test_xxd.py new file mode 100644 index 00000000..bd461eb7 --- /dev/null +++ b/test/t/test_xxd.py @@ -0,0 +1,11 @@ +import pytest + + +class TestXxd: + @pytest.mark.complete("xxd ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xxd -") + def test_2(self, completion): + assert completion diff --git a/test/t/test_xz.py b/test/t/test_xz.py new file mode 100644 index 00000000..6b92f480 --- /dev/null +++ b/test/t/test_xz.py @@ -0,0 +1,22 @@ +import pytest + + +class TestXz: + @pytest.mark.complete("xz ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("xz -d xz/") + def test_2(self, completion): + assert ( + completion == "a/ bashcomp.lzma bashcomp.tar.xz " + "bashcomp.tlz bashcomp.xz".split() + ) + + @pytest.mark.complete("xz xz/") + def test_3(self, completion): + assert completion == "a/ bashcomp.tar".split() + + @pytest.mark.complete("xz ~") + def test_4(self, completion): + assert completion diff --git a/test/t/test_xzdec.py b/test/t/test_xzdec.py new file mode 100644 index 00000000..e57c1b65 --- /dev/null +++ b/test/t/test_xzdec.py @@ -0,0 +1,7 @@ +import pytest + + +class TestXzdec: + @pytest.mark.complete("xzdec ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ypcat.py b/test/t/test_ypcat.py new file mode 100644 index 00000000..f743c5ad --- /dev/null +++ b/test/t/test_ypcat.py @@ -0,0 +1,7 @@ +import pytest + + +class TestYpcat: + @pytest.mark.complete("ypcat ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_ypmatch.py b/test/t/test_ypmatch.py new file mode 100644 index 00000000..db56320a --- /dev/null +++ b/test/t/test_ypmatch.py @@ -0,0 +1,7 @@ +import pytest + + +class TestYpmatch: + @pytest.mark.complete("ypmatch foo ") + def test_1(self, completion): + assert completion diff --git a/test/t/test_yum.py b/test/t/test_yum.py new file mode 100644 index 00000000..5d4a052b --- /dev/null +++ b/test/t/test_yum.py @@ -0,0 +1,7 @@ +import pytest + + +class TestYum: + @pytest.mark.complete("yum -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_yum_arch.py b/test/t/test_yum_arch.py new file mode 100644 index 00000000..9bbc38ff --- /dev/null +++ b/test/t/test_yum_arch.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.bashcomp(cmd="yum-arch") +class TestYumArch: + @pytest.mark.complete("yum-arch -") + def test_1(self, completion): + assert completion diff --git a/test/t/test_zopfli.py b/test/t/test_zopfli.py new file mode 100644 index 00000000..127eda28 --- /dev/null +++ b/test/t/test_zopfli.py @@ -0,0 +1,11 @@ +import pytest + + +class TestZopfli: + @pytest.mark.complete("zopfli ") + def test_1(self, completion): + assert completion + + @pytest.mark.complete("zopfli ~") + def test_2(self, completion): + assert completion diff --git a/test/t/test_zopflipng.py b/test/t/test_zopflipng.py new file mode 100644 index 00000000..a01e7bd7 --- /dev/null +++ b/test/t/test_zopflipng.py @@ -0,0 +1,7 @@ +import pytest + + +class TestZopflipng: + @pytest.mark.complete("zopflipng ") + def test_1(self, completion): + assert completion diff --git a/test/t/unit/Makefile.am b/test/t/unit/Makefile.am new file mode 100644 index 00000000..a0ab7502 --- /dev/null +++ b/test/t/unit/Makefile.am @@ -0,0 +1,19 @@ +EXTRA_DIST = \ + test_unit_count_args.py \ + test_unit_expand.py \ + test_unit_expand_tilde_by_ref.py \ + test_unit_filedir.py \ + test_unit_find_unique_completion_pair.py \ + test_unit_get_comp_words_by_ref.py \ + test_unit_get_cword.py \ + test_unit_init_completion.py \ + test_unit_ip_addresses.py \ + test_unit_longopt.py \ + test_unit_parse_help.py \ + test_unit_parse_usage.py \ + test_unit_tilde.py + +all: + +clean-local: + $(RM) -R __pycache__ diff --git a/test/t/unit/test_unit_count_args.py b/test/t/unit/test_unit_count_args.py new file mode 100644 index 00000000..c0afe736 --- /dev/null +++ b/test/t/unit/test_unit_count_args.py @@ -0,0 +1,66 @@ +import pytest + +from conftest import assert_bash_exec, TestUnitBase + + +@pytest.mark.bashcomp( + cmd=None, ignore_env=r"^[+-](args|COMP_(WORDS|CWORD|LINE|POINT))=" +) +class TestUnitCountArgs(TestUnitBase): + def _test(self, *args, **kwargs): + return self._test_unit("_count_args %s; echo $args", *args, **kwargs) + + def test_1(self, bash): + assert_bash_exec(bash, "_count_args >/dev/null") + + def test_2(self, bash): + """a b| should set args to 1""" + output = self._test(bash, "(a b)", 1, "a b", 3) + assert output == "1" + + def test_3(self, bash): + """a b|c should set args to 1""" + output = self._test(bash, "(a bc)", 1, "a bc", 3) + assert output == "1" + + def test_4(self, bash): + """a b c| should set args to 2""" + output = self._test(bash, "(a b c)", 2, "a b c", 4) + assert output == "2" + + def test_5(self, bash): + """a b| c should set args to 1""" + output = self._test(bash, "(a b c)", 1, "a b c", 3) + assert output == "1" + + def test_6(self, bash): + """a b -c| d should set args to 2""" + output = self._test(bash, "(a b -c d)", 2, "a b -c d", 6) + assert output == "2" + + def test_7(self, bash): + """a b -c d e| with -c arg excluded should set args to 2""" + output = self._test( + bash, "(a b -c d e)", 4, "a b -c d e", 10, arg='"" "@(-c|--foo)"' + ) + assert output == "2" + + def test_8(self, bash): + """a -b -c d e| with -c arg excluded + and -b included should set args to 1""" + output = self._test( + bash, + "(a -b -c d e)", + 4, + "a -b -c d e", + 11, + arg='"" "@(-c|--foo)" "-[b]"', + ) + assert output == "2" + + def test_9(self, bash): + """a -b -c d e| with -b included should set args to 3""" + output = self._test( + bash, "(a -b -c d e)", 4, "a -b -c d e", 11, arg='"" "" "-b"' + ) + assert output == "3" diff --git a/test/t/unit/test_unit_expand.py b/test/t/unit/test_unit_expand.py new file mode 100644 index 00000000..7c0a9836 --- /dev/null +++ b/test/t/unit/test_unit_expand.py @@ -0,0 +1,13 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None) +class TestUnitExpand: + def test_1(self, bash): + assert_bash_exec(bash, "_expand >/dev/null") + + def test_2(self, bash): + """Test environment non-pollution, detected at teardown.""" + assert_bash_exec(bash, "foo() { _expand; }; foo; unset foo") diff --git a/test/t/unit/test_unit_expand_tilde_by_ref.py b/test/t/unit/test_unit_expand_tilde_by_ref.py new file mode 100644 index 00000000..fbc172df --- /dev/null +++ b/test/t/unit/test_unit_expand_tilde_by_ref.py @@ -0,0 +1,16 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None) +class TestUnitExpandTildeByRef: + def test_1(self, bash): + assert_bash_exec(bash, "__expand_tilde_by_ref >/dev/null") + + def test_2(self, bash): + """Test environment non-pollution, detected at teardown.""" + assert_bash_exec( + bash, + '_x() { local aa="~"; __expand_tilde_by_ref aa; }; _x; unset _x', + ) diff --git a/test/t/unit/test_unit_filedir.py b/test/t/unit/test_unit_filedir.py new file mode 100644 index 00000000..dcd52403 --- /dev/null +++ b/test/t/unit/test_unit_filedir.py @@ -0,0 +1,9 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=") +class TestUnitFiledir: + def test_1(self, bash): + assert_bash_exec(bash, "_filedir >/dev/null") diff --git a/test/t/unit/test_unit_find_unique_completion_pair.py b/test/t/unit/test_unit_find_unique_completion_pair.py new file mode 100644 index 00000000..25cf9d3b --- /dev/null +++ b/test/t/unit/test_unit_find_unique_completion_pair.py @@ -0,0 +1,55 @@ +import pytest + +from conftest import find_unique_completion_pair + + +@pytest.mark.bashcomp(cmd=None) +class TestUnitFindUniqueCompletionPair: + def _test(self, inp: str, exp: str) -> None: + res = find_unique_completion_pair(inp.split()) + if exp: + part, cont = exp.split() + assert res == (part, part + cont) + else: + assert not exp + + def test_1(self): + self._test("a", "") + + def test_2(self): + self._test("ab", "a b") + + def test_3(self): + self._test("ab ab ab", "a b") + + def test_4(self): + self._test("a ab abcd abc", "") + + def test_5(self): + self._test("user1 user2", "") + + def test_6(self): + self._test("root username1 username2", "ro ot") + + def test_7(self): + self._test("root username21 username2", "ro ot") + + def test_8(self): + self._test( + "long_user_name lang_user_name long_usor_name", "lang_us er_name" + ) + + def test_9(self): + self._test( + "lang_user_name1 long_user_name lang_user_name long_usor_name", + "long_use r_name", + ) + + def test_10(self): + self._test("root username", "user name") + + def test_11(self): + self._test("a aladin", "ala din") + + def test_12(self): + self._test("ala aladin", "alad in") diff --git a/test/t/unit/test_unit_get_comp_words_by_ref.py b/test/t/unit/test_unit_get_comp_words_by_ref.py new file mode 100644 index 00000000..1603bad6 --- /dev/null +++ b/test/t/unit/test_unit_get_comp_words_by_ref.py @@ -0,0 +1,167 @@ +import pytest + +from conftest import assert_bash_exec, TestUnitBase + + +@pytest.mark.bashcomp( + cmd=None, ignore_env=r"^(\+(cur|prev)|[+-]COMP_(WORDS|CWORD|LINE|POINT))=" +) +class TestUnitGetCompWordsByRef(TestUnitBase): + def _test(self, bash, *args, **kwargs): + assert_bash_exec(bash, "unset cur prev") + output = self._test_unit( + "_get_comp_words_by_ref %s cur prev; echo $cur,$prev", + bash, + *args, + **kwargs + ) + return output.strip() + + def test_1(self, bash): + assert_bash_exec(bash, "_get_comp_words_by_ref cur >/dev/null") + + def test_2(self, bash): + """a b|""" + output = self._test(bash, "(a b)", 1, "a b", 3) + assert output == "b,a" + + def test_3(self, bash): + """a |""" + output = self._test(bash, "(a)", 1, "a ", 2) + assert output == ",a" + + def test_4(self, bash): + """|a""" + output = self._test(bash, "(a)", 0, "a", 0) + assert output == "," + + def test_5(self, bash): + """|a """ + output = self._test(bash, "(a)", 0, "a ", 0) + assert output == "," + + def test_6(self, bash): + """ | a """ + output = self._test(bash, "(a)", 0, " a ", 1) + assert output.strip() == "," + + def test_7(self, bash): + """a b |""" + output = self._test(bash, "(a b '')", 2, "a b ", 4) + assert output == ",b" + + def test_8(self, bash): + """a b | with WORDBREAKS -= :""" + output = self._test(bash, "(a b '')", 2, "a b ", 4, arg="-n :") + assert output == ",b" + + def test_9(self, bash): + """a b|c""" + output = self._test(bash, "(a bc)", 1, "a bc", 3) + assert output == "b,a" + + def test_10(self, bash): + """a | b""" + output = self._test(bash, "(a b)", 1, "a b", 2) + assert output == ",a" + + def test_11(self, bash): + r"""a b\ c|""" + output = self._test(bash, r"(a 'b\ c')", 1, r"a b\ c", 6) + assert output == r"b\ c,a" + + def test_12(self, bash): + r"""a\ b a\ b|""" + output = self._test(bash, r"('a\ b' 'a\ b')", 1, r"a\ b a\ b", 9) + assert output == r"a\ b,a\ b" + + def test_13(self, bash): + r"""a b\| c""" + output = self._test(bash, r"(a 'b\ c')", 1, r"a b\ c", 4) + assert output == r"b\,a" + + def test_14(self, bash): + r"""a "b\|""" + output = self._test(bash, "(a '\"b')", 1, 'a "b\\', 5) + assert output == r'"b\,a' + + def test_15(self, bash): + """a 'b c|""" + output = self._test(bash, '(a "\'b c")', 1, "a 'b c", 6) + assert output == "'b c,a" + + def test_16(self, bash): + """a "b c|""" + output = self._test(bash, r'(a "\"b c")', 1, 'a "b c', 6) + assert output == '"b c,a' + + def test_17(self, bash): + """a b:c| with WORDBREAKS += :""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a b : c)", 3, "a b:c", 5) + assert output == "c,:" + + def test_18(self, bash): + """a b:c| with WORDBREAKS -= :""" + output = self._test(bash, "(a b : c)", 3, "a b:c", 5, arg="-n :") + assert output == "b:c,a" + + def test_19(self, bash): + """a b c:| with WORDBREAKS -= :""" + output = self._test(bash, "(a b c :)", 3, "a b c:", 6, arg="-n :") + assert output == "c:,b" + + def test_20(self, bash): + r"""a b:c | with WORDBREAKS -= :""" + output = self._test(bash, "(a b : c '')", 4, "a b:c ", 6, arg="-n :") + assert output == ",b:c" + + def test_21(self, bash): + """a :| with WORDBREAKS -= :""" + output = self._test(bash, "(a :)", 1, "a :", 3, arg="-n :") + assert output == ":,a" + + def test_22(self, bash): + """a b::| with WORDBREAKS -= :""" + output = self._test(bash, "(a b ::)", 2, "a b::", 5, arg="-n :") + assert output == "b::,a" + + def test_23(self, bash): + """a -n| + + This test makes sure `_get_cword' doesn't use `echo' to return its + value, because -n might be interpreted by `echo' and thus woud not + be returned. + """ + output = self._test(bash, "(a -n)", 1, "a -n", 4) + assert output == "-n,a" + + def test_24(self, bash): + """a b>c|""" + output = self._test(bash, r"(a b \> c)", 3, "a b>c", 5) + assert output.startswith("c,") + + def test_25(self, bash): + """a b=c|""" + output = self._test(bash, "(a b = c)", 3, "a b=c", 5) + assert output.startswith("c,") + + def test_26(self, bash): + """a *|""" + output = self._test(bash, r"(a \*)", 1, "a *", 4) + assert output == "*,a" + + def test_27(self, bash): + """a $(b c|""" + output = self._test(bash, "(a '$(b c')", 1, "a $(b c", 7) + assert output == "$(b c,a" + + def test_28(self, bash): + r"""a $(b c\ d|""" + output = self._test(bash, r"(a '$(b c\ d')", 1, r"a $(b c\ d", 10) + assert output == r"$(b c\ d,a" + + def test_29(self, bash): + """a 'b&c|""" + output = self._test(bash, '(a "\'b&c")', 1, "a 'b&c", 6) + assert output == "'b&c,a" diff --git a/test/t/unit/test_unit_get_cword.py b/test/t/unit/test_unit_get_cword.py new file mode 100644 index 00000000..3042dd29 --- /dev/null +++ b/test/t/unit/test_unit_get_cword.py @@ -0,0 +1,135 @@ +import pytest + +from conftest import assert_bash_exec, TestUnitBase + + +@pytest.mark.bashcomp( + cmd=None, ignore_env=r"^[+-]COMP_(WORDS|CWORD|LINE|POINT)=" +) +class TestUnitGetCword(TestUnitBase): + def _test(self, *args, **kwargs): + return self._test_unit("_get_cword %s; echo", *args, **kwargs) + + def test_1(self, bash): + assert_bash_exec(bash, "_get_cword >/dev/null") + + def test_2(self, bash): + """a b| should return b""" + output = self._test(bash, "(a b)", 1, "a b", 3) + assert output == "b" + + def test_3(self, bash): + """a | should return nothing""" + output = self._test(bash, "(a)", 1, "a ", 2) + assert not output + + def test_4(self, bash): + """a b | should return nothing""" + output = self._test(bash, "(a b '')", 2, "a b ", 4) + assert not output + + def test_5(self, bash): + """a b | with WORDBREAKS -= : should return nothing""" + output = self._test(bash, "(a b '')", 2, "a b ", 4, arg=":") + assert not output + + def test_6(self, bash): + """a b|c should return b""" + output = self._test(bash, "(a bc)", 1, "a bc", 3) + assert output == "b" + + def test_7(self, bash): + r"""a b\ c| should return b\ c""" + output = self._test(bash, r"(a 'b\ c')", 1, r"a b\ c", 6) + assert output == r"b\ c" + + def test_8(self, bash): + r"""a b\| c should return b\ """ + output = self._test(bash, r"(a 'b\ c')", 1, r"a b\ c", 4) + assert output == "b\\" + + def test_9(self, bash): + r"""a "b\| should return "b\ """ + output = self._test(bash, "(a '\"b\\')", 1, r"a \"b\\", 5) + assert output == '"b\\' + + def test_10(self, bash): + r"""a 'b c| should return 'b c""" + output = self._test(bash, '(a "\'b c")', 1, "a 'b c", 6) + assert output == "'b c" + + def test_11(self, bash): + r"""a "b c| should return "b c""" + output = self._test(bash, "(a '\"b c')", 1, 'a "b c', 6) + assert output == '"b c' + + def test_12(self, bash): + """a b:c| with WORDBREAKS += : should return c""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a b : c)", 3, "a b:c", 5) + assert output == "c" + + def test_13(self, bash): + """a b:c| with WORDBREAKS -= : should return b:c""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a b : c)", 3, "a b:c", 5, arg=":") + assert output == "b:c" + + def test_14(self, bash): + """a b c:| with WORDBREAKS -= : should return c:""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a b c :)", 3, "a b c:", 6, arg=":") + assert output == "c:" + + def test_15(self, bash): + """a :| with WORDBREAKS -= : should return :""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a :)", 1, "a :", 3, arg=":") + assert output == ":" + + def test_16(self, bash): + """a b::| with WORDBREAKS -= : should return b::""" + assert_bash_exec(bash, "add_comp_wordbreak_char :") + output = self._test(bash, "(a b::)", 1, "a b::", 5, arg=":") + assert output == "b::" + + def test_17(self, bash): + """ + a -n| should return -n + + This test makes sure `_get_cword' doesn't use `echo' to return its + value, because -n might be interpreted by `echo' and thus woud not + be returned. + """ + output = self._test(bash, "(a -n)", 1, "a -n", 4) + assert output == "-n" + + def test_18(self, bash): + """a b>c| should return c""" + output = self._test(bash, r"(a b \> c)", 3, "a b>c", 5) + assert output == "c" + + def test_19(self, bash): + """a b=c| should return c""" + output = self._test(bash, "(a b = c)", 3, "a b=c", 5) + assert output == "c" + + def test_20(self, bash): + """a *| should return *""" + output = self._test(bash, r"(a \*)", 1, "a *", 4) + assert output == "*" + + def test_21(self, bash): + """a $(b c| should return $(b c""" + output = self._test(bash, r"(a '$(b c')", 1, "a $(b c", 7) + assert output == "$(b c" + + def test_22(self, bash): + r"""a $(b c\ d| should return $(b c\ d""" + output = self._test(bash, r"(a '$(b c\ d')", 1, r"a $(b c\ d", 10) + assert output == r"$(b c\ d" + + def test_23(self, bash): + """a 'b&c| should return 'b&c""" + output = self._test(bash, '(a "\'b&c")', 1, "a 'b&c", 6) + assert output == "'b&c" diff --git a/test/t/unit/test_unit_init_completion.py b/test/t/unit/test_unit_init_completion.py new file mode 100644 index 00000000..64f3b511 --- /dev/null +++ b/test/t/unit/test_unit_init_completion.py @@ -0,0 +1,24 @@ +import pytest + +from conftest import assert_bash_exec, TestUnitBase + + +@pytest.mark.bashcomp( + cmd=None, + ignore_env=r"^[+-](COMP(_(WORDS|CWORD|LINE|POINT)|REPLY)|" + r"cur|cword|words)=", +) +class TestUnitInitCompletion(TestUnitBase): + def test_1(self, bash): + """Test environment non-pollution, detected at teardown.""" + assert_bash_exec( + bash, + "foo() { local cur prev words cword; _init_completion; }; " + "foo; unset foo", + ) + + def test_2(self, bash): + output = self._test_unit( + "_init_completion %s; echo $cur,$prev", bash, "(a)", 0, "a", 0 + ) + assert output == "," diff --git a/test/t/unit/test_unit_ip_addresses.py b/test/t/unit/test_unit_ip_addresses.py new file mode 100644 index 00000000..cd7a38ab --- /dev/null +++ b/test/t/unit/test_unit_ip_addresses.py @@ -0,0 +1,49 @@ +import pytest + +from conftest import assert_bash_exec, in_docker + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=") +class TestUnitIpAddresses: + @pytest.fixture(scope="class") + def functions(self, request, bash): + assert_bash_exec( + bash, + "_ia() { local cur=$(_get_cword);unset COMPREPLY;" + "_ip_addresses; }", + ) + assert_bash_exec(bash, "complete -F _ia ia") + assert_bash_exec( + bash, + "_iaa() { local cur=$(_get_cword);unset COMPREPLY;" + "_ip_addresses -a; }", + ) + assert_bash_exec(bash, "complete -F _iaa iaa") + assert_bash_exec( + bash, + " _ia6() { local cur=$(_get_cword);unset COMPREPLY;" + "_ip_addresses -6; }", + ) + assert_bash_exec(bash, "complete -F _ia6 ia6") + + def test_1(self, bash): + assert_bash_exec(bash, "_ip_addresses") + + @pytest.mark.complete("iaa ") + def test_2(self, functions, completion): + """_ip_addresses -a should complete ip addresses.""" + assert completion + assert all("." in x or ":" in x for x in completion) + + @pytest.mark.complete("ia ") + def test_3(self, functions, completion): + """_ip_addresses should complete ipv4 addresses.""" + assert completion + assert all("." in x for x in completion) + + @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") + @pytest.mark.complete("ia6 ") + def test_4(self, functions, completion): + """_ip_addresses -6 should complete ipv6 addresses.""" + assert completion + assert all(":" in x for x in completion) diff --git a/test/t/unit/test_unit_longopt.py b/test/t/unit/test_unit_longopt.py new file mode 100644 index 00000000..ac0ac836 --- /dev/null +++ b/test/t/unit/test_unit_longopt.py @@ -0,0 +1,34 @@ +# Based on work by Stephen Gildea, October 2010. + +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=") +class TestUnitLongopt: + @pytest.fixture(scope="class") + def functions(self, request, bash): + assert_bash_exec(bash, "_grephelp() { cat _longopt/grep--help.txt; }") + assert_bash_exec(bash, "complete -F _longopt _grephelp") + + @pytest.mark.complete("_grephelp --") + def test_1(self, functions, completion): + """First long option should be included""" + assert completion + assert all( + x in completion for x in "--quiet --recursive --text".split() + ) + + @pytest.mark.complete("_grephelp -") + def test_2(self, functions, completion): + """Only long options should be included""" + assert completion + assert all(x.startswith("--") for x in completion) + + @pytest.mark.complete("_grephelp --") + def test_3(self, functions, completion): + """Should have both ones ending with a = and ones not""" + assert completion + assert any(x.endswith("=") for x in completion) + assert any(not x.endswith("=") for x in completion) diff --git a/test/t/unit/test_unit_parse_help.py b/test/t/unit/test_unit_parse_help.py new file mode 100644 index 00000000..4a02155b --- /dev/null +++ b/test/t/unit/test_unit_parse_help.py @@ -0,0 +1,183 @@ +# Based on work by Stephen Gildea, October 2010. + +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+declare -f fn$") +class TestUnitParseHelp: + def test_1(self, bash): + assert_bash_exec(bash, "fn() { echo; }") + output = assert_bash_exec(bash, "_parse_help fn") + assert not output + + def test_2(self, bash): + assert_bash_exec(bash, "fn() { echo 'no dashes here'; }") + output = assert_bash_exec(bash, "_parse_help fn") + assert not output + + def test_3(self, bash): + assert_bash_exec(bash, "fn() { echo 'internal-dash'; }") + output = assert_bash_exec(bash, "_parse_help fn") + assert not output + + def test_4(self, bash): + assert_bash_exec(bash, "fn() { echo 'no -leading-dashes'; }") + output = assert_bash_exec(bash, "_parse_help fn") + assert not output + + def test_5(self, bash): + assert_bash_exec(bash, "fn() { echo '-one dash'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "-one".split() + + def test_6(self, bash): + assert_bash_exec(bash, "fn() { echo ' -space dash'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "-space".split() + + def test_7(self, bash): + assert_bash_exec(bash, "fn() { echo '-one -two dashes'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "-one".split() + + def test_8(self, bash): + assert_bash_exec(bash, "fn() { echo '-one,-t dashes'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "-one".split() + + def test_9(self, bash): + assert_bash_exec(bash, "fn() { echo '-one dash-inside'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "-one".split() + + def test_10(self, bash): + """Test value not included in completion.""" + assert_bash_exec(bash, "fn() { echo '--long-arg=value'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--long-arg=".split() + + def test_11(self, bash): + """Test -value not seen as option.""" + assert_bash_exec(bash, "fn() { echo '--long-arg=-value'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--long-arg=".split() + + def test_12(self, bash): + assert_bash_exec(bash, "fn() { echo '--long-arg=-value,--opt2=val'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--long-arg=".split() + + def test_13(self, bash): + assert_bash_exec(bash, "fn() { echo '-m,--mirror'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--mirror".split() + + def test_14(self, bash): + assert_bash_exec(bash, "fn() { echo '-T/--upload-file'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--upload-file".split() + + def test_15(self, bash): + assert_bash_exec(bash, "fn() { echo '-T|--upload-file'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--upload-file".split() + + def test_16(self, bash): + assert_bash_exec(bash, "fn() { echo '-f, -F, --foo'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo".split() + + def test_17(self, bash): + assert_bash_exec(bash, "fn() { echo '--foo[=bar]'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo".split() + + def test_18(self, bash): + assert_bash_exec(bash, "fn() { echo '--foo=<bar>'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo=".split() + + def test_19(self, bash): + assert_bash_exec(bash, "fn() { echo '--foo={bar,quux}'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo=".split() + + def test_20(self, bash): + assert_bash_exec(bash, "fn() { echo '--[no]foo'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo --nofoo".split() + + def test_21(self, bash): + assert_bash_exec(bash, "fn() { echo '--[no-]bar[=quux]'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--bar --no-bar".split() + + def test_22(self, bash): + assert_bash_exec(bash, "fn() { echo '--[no-]bar=quux'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--bar= --no-bar=".split() + + def test_23(self, bash): + assert_bash_exec(bash, "fn() { echo '--[dont-]foo'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo --dont-foo".split() + + def test_24(self, bash): + assert_bash_exec(bash, "fn() { echo '-[dont]x --[dont]yy'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--yy --dontyy".split() + + def test_25(self, bash): + assert_bash_exec(bash, "fn() { echo '-f FOO, --foo=FOO'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo=".split() + + def test_26(self, bash): + assert_bash_exec(bash, "fn() { echo '-f [FOO], --foo[=FOO]'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo".split() + + def test_27(self, bash): + assert_bash_exec(bash, "fn() { echo '--foo.'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo".split() + + def test_28(self, bash): + assert_bash_exec(bash, "fn() { echo '-f or --foo'; }") + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--foo".split() + + def test_29(self, bash): + """Test parsing from stdin.""" + output = assert_bash_exec( + bash, "echo '-f or --foo' | _parse_help -", want_output=True + ) + assert output.split() == "--foo".split() + + def test_30(self, bash): + """More than two dashes should not be treated as options.""" + assert_bash_exec( + bash, r"fn() { printf '%s\n' $'----\n---foo\n----- bar'; }" + ) + output = assert_bash_exec(bash, "_parse_help fn") + assert not output + + def test_31(self, bash): + assert_bash_exec( + bash, + r"fn() { printf '%s\n' " + r"'-F ERROR_FORMAT, --error-format ERROR_FORMAT'; }", + ) + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--error-format".split() + + def test_32(self, bash): + assert_bash_exec( + bash, + r"fn() { printf '%s\n' " + r"'-e CODE1,CODE2.. --exclude=CODE1,CODE2..'; }", + ) + output = assert_bash_exec(bash, "_parse_help fn", want_output=True) + assert output.split() == "--exclude=".split() diff --git a/test/t/unit/test_unit_parse_usage.py b/test/t/unit/test_unit_parse_usage.py new file mode 100644 index 00000000..f0cb7114 --- /dev/null +++ b/test/t/unit/test_unit_parse_usage.py @@ -0,0 +1,69 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+declare -f fn$") +class TestUnitParseUsage: + def test_1(self, bash): + assert_bash_exec(bash, "fn() { echo; }") + output = assert_bash_exec(bash, "_parse_usage fn") + assert not output + + def test_2(self, bash): + assert_bash_exec(bash, "fn() { echo 'no dashes here'; }") + output = assert_bash_exec(bash, "_parse_usage fn") + assert not output + + def test_3(self, bash): + assert_bash_exec(bash, "fn() { echo 'foo [-f]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "-f".split() + + def test_4(self, bash): + assert_bash_exec(bash, "fn() { echo 'bar [-aBcD] [-e X]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "-a -B -c -D -e".split() + + def test_5(self, bash): + assert_bash_exec(bash, "fn() { echo '[-[XyZ]] [--long=arg]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "-X -y -Z --long=".split() + + def test_6(self, bash): + assert_bash_exec(bash, "fn() { echo '[-s|--long]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "--long".split() + + def test_7(self, bash): + assert_bash_exec(bash, "fn() { echo '[-s, --long=arg]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "--long=".split() + + def test_8(self, bash): + assert_bash_exec(bash, "fn() { echo '[--long/-s] [-S/--longer]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "--long --longer".split() + + def test_9(self, bash): + assert_bash_exec(bash, "fn() { echo '[ -a ] [ -b foo ]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "-a -b".split() + + def test_10(self, bash): + assert_bash_exec(bash, "fn() { echo '[ -a | --aa ]'; }") + output = assert_bash_exec(bash, "_parse_usage fn", want_output=True) + assert output.split() == "--aa".split() + + def test_11(self, bash): + assert_bash_exec( + bash, "fn() { echo ----; echo ---foo; echo '----- bar'; }" + ) + output = assert_bash_exec(bash, "_parse_usage fn") + assert not output + + def test_12(self, bash): + output = assert_bash_exec( + bash, "echo '[-duh]' | _parse_usage -", want_output=True + ) + assert output.split() == "-d -u -h".split() diff --git a/test/t/unit/test_unit_tilde.py b/test/t/unit/test_unit_tilde.py new file mode 100644 index 00000000..35a4e4c6 --- /dev/null +++ b/test/t/unit/test_unit_tilde.py @@ -0,0 +1,42 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=") +class TestUnitTilde: + def test_1(self, bash): + assert_bash_exec(bash, "_tilde >/dev/null") + + def test_2(self, bash): + """Test environment non-pollution, detected at teardown.""" + assert_bash_exec( + bash, 'foo() { local aa="~"; _tilde "$aa"; }; foo; unset foo' + ) + + def test_3(self, bash): + """Test for https://bugs.debian.org/766163""" + assert_bash_exec(bash, "_tilde ~-o") + + def _test_part_full(self, bash, part, full): + res = ( + assert_bash_exec( + bash, + '_tilde "~%s"; echo "${COMPREPLY[@]}"' % part, + want_output=True, + ) + .strip() + .split() + ) + assert res + assert res[0] == "~%s" % full + + def test_4(self, bash, part_full_user): + """~full should complete to ~full unmodified.""" + _, full = part_full_user + self._test_part_full(bash, full, full) + + def test_5(self, bash, part_full_user): + """~part should complete to ~full.""" + part, full = part_full_user + self._test_part_full(bash, part, full) diff --git a/test/tmp/.gitignore b/test/tmp/.gitignore deleted file mode 100644 index 72e8ffc0..00000000 --- a/test/tmp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/test/unit/__expand_tilde_by_ref.exp b/test/unit/__expand_tilde_by_ref.exp index bcb931e1..5569fe37 100644 --- a/test/unit/__expand_tilde_by_ref.exp +++ b/test/unit/__expand_tilde_by_ref.exp @@ -21,15 +21,6 @@ proc teardown {} { setup home user -set test "function should run without errors" -assert_bash_exec {__expand_tilde_by_ref > /dev/null} $test -sync_after_int - -set test "function should not pollute environment" -# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown() -assert_bash_exec {foo() { local aa="~"; __expand_tilde_by_ref aa; }; foo; unset foo} $test -sync_after_int - 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/_count_args.exp b/test/unit/_count_args.exp deleted file mode 100644 index b528846a..00000000 --- a/test/unit/_count_args.exp +++ /dev/null @@ -1,51 +0,0 @@ -proc setup {} { - assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS} - save_env -} - - -proc teardown {} { - assert_bash_exec {unset args COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS} - # Delete 'COMP_WORDBREAKS' occupying two lines - assert_env_unmodified { - /COMP_WORDBREAKS=/{N - d - } - } -} - - -setup - - -set test "_count_args should run without errors" -assert_bash_exec {_count_args > /dev/null} $test -sync_after_int - -set test "a b| should set args to 1"; # | = cursor position -set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _count_args; echo $args} -assert_bash_list 1 $cmd $test -sync_after_int - -set test "a b|c should set args to 1"; # | = cursor position -set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _count_args; echo $args} -assert_bash_list 1 $cmd $test -sync_after_int - -set test "a b c| should set args to 2"; # | = cursor position -set cmd {COMP_WORDS=(a b c); COMP_CWORD=2; COMP_LINE='a b c'; COMP_POINT=4; _count_args; echo $args} -assert_bash_list 2 $cmd $test -sync_after_int - -set test "a b| c should set args to 1"; # | = cursor position -set cmd {COMP_WORDS=(a b c); COMP_CWORD=1; COMP_LINE='a b c'; COMP_POINT=3; _count_args; echo $args} -assert_bash_list 1 $cmd $test -sync_after_int - -set test "a b -c| d should set args to 2"; # | = cursor position -set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=2; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo $args} -assert_bash_list 2 $cmd $test -sync_after_int - - -teardown diff --git a/test/unit/_expand.exp b/test/unit/_expand.exp index 50453868..59dbed58 100644 --- a/test/unit/_expand.exp +++ b/test/unit/_expand.exp @@ -19,15 +19,6 @@ proc teardown {} { setup home user -set test "function should run without errors" -assert_bash_exec {_expand > /dev/null} $test -sync_after_int - -set test "function should not pollute environment" -# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown() -assert_bash_exec {foo() { _expand; }; foo; unset foo} $test -sync_after_int - set test "~$user should set $home to COMPREPLY" set cmd [format {cur="~%s" ; _expand ; printf "%%s\n" "$COMPREPLY"} $user] assert_bash_list "$home" $cmd $test diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp index 597e4acc..7395bf9a 100644 --- a/test/unit/_filedir.exp +++ b/test/unit/_filedir.exp @@ -53,10 +53,6 @@ proc teardown {} { setup -set test "_filedir should run without errors" -assert_bash_exec {_filedir > /dev/null} $test -sync_after_int - foreach name {f f2} { set test "completing $name ab/ should return e" diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp index 2683d163..a0e1886b 100644 --- a/test/unit/_get_comp_words_by_ref.exp +++ b/test/unit/_get_comp_words_by_ref.exp @@ -21,229 +21,12 @@ proc teardown {} { setup -set test "_get_comp_words_by_ref should run without errors" -assert_bash_exec {_get_comp_words_by_ref cur > /dev/null} $test -sync_after_int - # See also ./lib/completions/alias.exp. Here `_get_cword' is actually tested # by moving the cursor left into the current word. -set test "a b|"; # | = cursor position -set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"b a"} $cmd $test -sync_after_int - -set test "a |"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=1; COMP_LINE='a '; COMP_POINT=2; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" a"} $cmd $test -sync_after_int - -set test "|a"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; \ - unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" "} $cmd $test -sync_after_int - -set test "|a \$"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a '; COMP_POINT=0; \ - unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" "} $cmd $test -sync_after_int - -set test " | a \$"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE=' a '; COMP_POINT=1; \ - unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" "} $cmd $test -sync_after_int - -set test "a b |"; # | = cursor position -set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" b"} $cmd $test -sync_after_int - -set test "a b | with WORDBREAKS -= :"; # | = cursor position -set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_comp_words_by_ref -n : cur; printf %s "$cur"} -assert_bash_list {} $cmd $test -sync_after_int - -set test "a b|c"; # | = cursor position -set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"b a"} $cmd $test -sync_after_int - -set test "a | b"; # | = cursor position -set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=2; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {" a"} $cmd $test -sync_after_int - -set test {a b\ c| should return b\ c}; # | = cursor position -set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"b\\ c a"} $cmd $test -sync_after_int - -set test {a\ b a\ b| should return a\ b}; # | = cursor position -set cmd {COMP_WORDS=('a\ b' 'a\ b'); COMP_CWORD=1; COMP_LINE='a\ b a\ b'; COMP_POINT=9; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"a\\ b a\\ b"} $cmd $test -sync_after_int - -set test {a b\| c should return b\ }; # | = cursor position -set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"b\\ a"} $cmd $test -sync_after_int - -set test {a "b\|}; #"# | = cursor position -set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list {"\"b\\ a"} $cmd $test -sync_after_int - -set test {a 'b c|}; # | = cursor position -set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"} -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "'b c a\r\n/@" { pass "$test" } - -ex "c b\r\n/@" { fail "$test" } -} -sync_after_int - -set test {a "b c|}; #"# | = cursor position -set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur prev; echo "$cur $prev"}; -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\"b c a\r\n/@" { pass "$test" } - -ex "c b\r\n/@" { fail "$test" } -} -sync_after_int - -set test {a b:c| with WORDBREAKS += :}; # | = cursor position -set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3} -set expected {"c :"} -append cmd {; COMP_LINE='a b:c'; COMP_POINT=5} -# NOTE: Split-send cmd to prevent backspaces (\008) in output -assert_bash_exec $cmd $test -set cmd {_get_comp_words_by_ref cur prev; echo "$cur $prev"} -assert_bash_list $expected $cmd $test -sync_after_int - -set test {a b:c| with WORDBREAKS -= :}; # | = cursor position -set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3} -append cmd {; COMP_LINE='a b:c'; COMP_POINT=5} -assert_bash_exec $cmd $test -set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} -assert_bash_list {"b:c a"} $cmd $test -sync_after_int - -set test {a b c:| with WORDBREAKS -= :}; # | = cursor position -set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3} -append cmd {; COMP_LINE='a b c:'; COMP_POINT=6} -assert_bash_exec $cmd $test -set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} -assert_bash_list {"c: b"} $cmd $test -sync_after_int - -set test {a b:c | with WORDBREAKS -= :}; # | = cursor position -set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4} -append cmd {; COMP_LINE='a b:c '; COMP_POINT=6} -assert_bash_exec $cmd $test -set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} -assert_bash_list {" b:c"} $cmd $test -sync_after_int - -set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position -set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} -assert_bash_list {": a"} $cmd $test -sync_after_int - -set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position -set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2} -append cmd {; COMP_LINE='a b::'; COMP_POINT=5} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} -assert_bash_list {"b:: a"} $cmd $test -sync_after_int - -# This test makes sure `_get_cword' doesn't use `echo' to return it's value, -# because -n might be interpreted by `echo' and thus will not be returned. -set test "a -n| should return -n"; # | = cursor position -set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur; printf "%s\n" $cur} -assert_bash_list -n $cmd $test -sync_after_int - -set test {a b>c| should return c}; # | = cursor position -set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur prev; echo "$cur"} -assert_bash_list c $cmd $test -sync_after_int - -set test {a b=c| should return c}; # | = cursor position -set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3} -set expected c -append cmd {; COMP_LINE='a b=c'; COMP_POINT=5} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur prev; echo "$cur"} -assert_bash_list $expected $cmd $test -sync_after_int - -set test {a *| should return *}; # | = cursor position -set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur; echo "$cur"} -assert_bash_list * $cmd $test -sync_after_int - -set test {a $(b c| should return $(b c}; # | = cursor position -set cmd {COMP_WORDS=(a '$(b c'); COMP_CWORD=1; COMP_LINE='a $(b c'; COMP_POINT=7} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur; printf %s "$cur"} -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\$(b c/@" { pass "$test" } - # Expected failure on bash-4 - -ex "c/@" { xfail "$test" } -} -sync_after_int - -set test {a $(b c\ d| should return $(b c\ d}; # | = cursor position -set cmd {COMP_WORDS=(a '$(b c\ d'); COMP_CWORD=1; COMP_LINE='a $(b c\ d'; COMP_POINT=10} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur; printf %s "$cur"} -#assert_bash_list {{$(b\ c\\\ d}} $cmd $test -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\$(b c\\ d/@" { pass "$test" } - # Expected failure on bash-4 - -ex "c\\ d/@" { xfail "$test" } -} -sync_after_int - -set test {a 'b&c| should return 'b&c}; # | = cursor position -set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6} -assert_bash_exec $cmd -set cmd {_get_comp_words_by_ref cur prev; printf %s "$cur"} -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "'b&c/@" { pass "$test" } - -ex "c/@" { fail "$test" } -} -sync_after_int - set test {unknown argument should raise error} set cmd {_get_comp_words_by_ref dummy} -assert_bash_list {"bash: _get_comp_words_by_ref(): `dummy': unknown argument"} $cmd $test +assert_bash_list {"bash_completion: _get_comp_words_by_ref: `dummy': unknown argument"} $cmd $test sync_after_int set test "a b| to all vars"; # | = cursor position diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp index 9708a870..91bcb44e 100644 --- a/test/unit/_get_cword.exp +++ b/test/unit/_get_cword.exp @@ -19,167 +19,9 @@ proc teardown {} { setup -set test "_get_cword should run without errors" -assert_bash_exec {_get_cword > /dev/null} $test -sync_after_int - # See also ./lib/completions/alias.exp. Here `_get_cword' is actually tested # by moving the cursor left into the current word. -set test "a b| should return b"; # | = cursor position -set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_cword; echo} -assert_bash_list b $cmd $test -sync_after_int - -set test "a | should return nothing"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=1; COMP_LINE='a '; COMP_POINT=2; _get_cword} -send "$cmd\r" -expect -ex "$cmd\r\n/@" {pass "$test"} -sync_after_int - -set test "a b | should return nothing"; # | = cursor position -set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_cword} -send "$cmd\r" -expect -ex "$cmd\r\n/@" {pass "$test"} -sync_after_int - -set test "a b | with WORDBREAKS -= : should return nothing"; # | = cursor position -set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_cword :} -send "$cmd\r" -expect -ex "$cmd\r\n/@" {pass "$test"} -sync_after_int - -set test "a b|c should return b"; # | = cursor position -set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_cword; echo} -assert_bash_list b $cmd $test -sync_after_int - -set test {a b\ c| should return b\ c}; # | = cursor position -set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_cword; echo} -assert_bash_list {"b\\ c"} $cmd $test -sync_after_int - -set test {a b\| c should return b\ }; # | = cursor position -set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_cword; echo} -assert_bash_list {"b\\"} $cmd $test -sync_after_int - -set test {a "b\| should return "b\ }; # | = cursor position -set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_cword; echo} -assert_bash_list {"\"b\\"} $cmd $test -sync_after_int - -set test {a 'b c| should return 'b c}; # | = cursor position -set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_cword} -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "'b c/@" { pass "$test" } - -ex "c/@" { fail "$test" } -} -sync_after_int - -set test {a "b c| should return "b c}; # | = cursor position -set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6; _get_cword}; -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\"b c/@" { pass "$test" } - -ex "c/@" { fail "$test" } -} -sync_after_int - -set test {a b:c| with WORDBREAKS += : should return c}; # | = cursor position -set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3} -set expected c -append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword; echo} -assert_bash_list $expected $cmd $test -sync_after_int - -set test {a b:c| with WORDBREAKS -= : should return b:c}; # | = cursor position -set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3} -append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :; echo} -assert_bash_list b:c $cmd $test -sync_after_int - -set test {a b c:| with WORDBREAKS -= : should return c:}; # | = cursor position -set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3} -append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :; echo} -assert_bash_list c: $cmd $test -sync_after_int - -set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position -set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3; _get_cword :; echo} -assert_bash_list : $cmd $test -sync_after_int - -set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position -set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2} -append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :; echo} -assert_bash_list b:: $cmd $test -sync_after_int - -# This test makes sure `_get_cword' doesn't use `echo' to return it's value, -# because -n might be interpreted by `echo' and thus will not be returned. -set test "a -n| should return -n"; # | = cursor position -set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4; _get_cword; echo} -assert_bash_list -n $cmd $test -sync_after_int - -set test {a b>c| should return c}; # | = cursor position -set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5; _get_cword; echo} -assert_bash_list c $cmd $test -sync_after_int - -set test {a b=c| should return c}; # | = cursor position -set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3} -set expected c -append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword; echo} -assert_bash_list $expected $cmd $test -sync_after_int - -set test {a *| should return *}; # | = cursor position -set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4; _get_cword; echo} -assert_bash_list * $cmd $test -sync_after_int - -set test {a $(b c| should return $(b c}; # | = cursor position -set cmd {COMP_WORDS=(a '$(b c'); COMP_CWORD=1; COMP_LINE='a $(b c'; COMP_POINT=7; _get_cword} -#assert_bash_list {{$(b\ c}} $cmd $test -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\$(b c/@" { pass "$test" } - # Expected failure on bash-4 - -ex "c/@" { xfail "$test" } -} -sync_after_int - -set test {a $(b c\ d| should return $(b c\ d}; # | = cursor position -set cmd {COMP_WORDS=(a '$(b c\ d'); COMP_CWORD=1; COMP_LINE='a $(b c\ d'; COMP_POINT=10; _get_cword} -#assert_bash_list {{$(b\ c\\\ d}} $cmd $test -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "\$(b c\\ d/@" { pass "$test" } - # Expected failure on bash-4 - -ex "c\\ d/@" { xfail "$test" } -} -sync_after_int - -set test {a 'b&c| should return 'b&c}; # | = cursor position -set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1} -append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6; _get_cword} -send "$cmd\r" -expect -ex "$cmd\r\n" -expect { - -ex "'b&c/@" { pass "$test" } - -ex "c/@" { fail "$test" } -} -sync_after_int - set test "index shouldn't drop below 0" set dir $::srcdir/fixtures/_get_cword set cmd "scp" diff --git a/test/unit/_init_completion.exp b/test/unit/_init_completion.exp deleted file mode 100644 index 9408f86f..00000000 --- a/test/unit/_init_completion.exp +++ /dev/null @@ -1,30 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_bash_exec { \ - unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS cur prev words cword\ - } - assert_env_unmodified { - /COMPREPLY=/d - } -} - - -setup - - -set test "function should not pollute environment" -# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown() -assert_bash_exec {foo() { local cur prev words cword; _init_completion; }; foo; unset foo} $test -sync_after_int - -set test "|a"; # | = cursor position -set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; _init_completion; echo "$cur $prev"} -assert_bash_list {" "} $cmd $test -sync_after_int - - -teardown diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp deleted file mode 100644 index 43c5dc29..00000000 --- a/test/unit/_parse_help.exp +++ /dev/null @@ -1,138 +0,0 @@ -# By Stephen Gildea, October 2010. - -proc setup {} { - save_env -} - -proc teardown {} { - assert_env_unmodified { - /declare -f fn/d - /PIPESTATUS=/d - } -} - -setup - - -set cmd {fn() { printf '%s\n' ""; }; _parse_help fn} -assert_bash_list "" $cmd "empty" -sync_after_int - -set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_help fn} -assert_bash_list "" $cmd "no dashes" -sync_after_int - -set cmd {fn() { printf '%s\n' "internal-dash"; }; _parse_help fn} -assert_bash_list "" $cmd "internal dash 1" -sync_after_int - -set cmd {fn() { printf '%s\n' "no -leading-dashes"; }; _parse_help fn} -assert_bash_list "" $cmd "no leading dash" -sync_after_int - -set cmd {fn() { printf '%s\n' "-one dash"; }; _parse_help fn} -assert_bash_list "-one" $cmd "one dash" -sync_after_int - -set cmd {fn() { printf '%s\n' " -space dash"; }; _parse_help fn} -assert_bash_list "-space" $cmd "one dash after space" -sync_after_int - -set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn} -assert_bash_list "-one" $cmd "two dashes, space-separated" -sync_after_int - -set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn} -assert_bash_list "-one" $cmd "two dashes, comma-separated" -sync_after_int - -set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn} -assert_bash_list "-one" $cmd "internal dash 2" -sync_after_int - -set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn} -assert_bash_list "--long-arg=" $cmd "value stripped" -sync_after_int - -set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn} -assert_bash_list "--long-arg=" $cmd "value not seen as option" -sync_after_int - -set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn} -assert_bash_list "--long-arg=" $cmd "two options with values" -sync_after_int - -set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn} -assert_bash_list "--mirror" $cmd "short + long" -sync_after_int - -set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn} -assert_bash_list "--upload-file" $cmd "short + long, slash separated" -sync_after_int - -set cmd {fn() { printf '%s\n' "-T|--upload-file"; }; _parse_help fn} -assert_bash_list "--upload-file" $cmd "pipe separated" -sync_after_int - -set cmd {fn() { printf '%s\n' "-f, -F, --foo"; }; _parse_help fn} -assert_bash_list "--foo" $cmd "short + short + long" -sync_after_int - -set cmd {fn() { printf '%s\n' "--foo[=bar]"; }; _parse_help fn} -assert_bash_list "--foo" $cmd "long with value and eq sign in brackets" -sync_after_int - -set cmd {fn() { printf '%s\n' "--foo=<bar>"; }; _parse_help fn} -assert_bash_list "--foo=" $cmd "long with value in angle brackets" -sync_after_int - -set cmd {fn() { printf '%s\n' "--foo={bar,quux}"; }; _parse_help fn} -assert_bash_list "--foo=" $cmd "long with value in curly brackets" -sync_after_int - -set cmd {fn() { printf '%s\n' "--[no]foo"; }; _parse_help fn} -assert_bash_list "--foo\n--nofoo" $cmd "long with \[no\]" -sync_after_int - -set cmd {fn() { printf '%s\n' "--[no-]bar[=quux]"; }; _parse_help fn} -assert_bash_list "--bar\n--no-bar" $cmd "long with \[no-\] + optional arg" -sync_after_int - -set cmd {fn() { printf '%s\n' "--[no-]bar=quux"; }; _parse_help fn} -assert_bash_list "--bar=\n--no-bar=" $cmd "long with \[no-\] + required arg" -sync_after_int - -set cmd {fn() { printf '%s\n' "--[dont-]foo"; }; _parse_help fn} -assert_bash_list "--foo\n--dont-foo" $cmd "long with \[dont-\]" -sync_after_int - -set cmd {fn() { printf '%s\n' "-[dont]x, --[dont]yy"; }; _parse_help fn} -assert_bash_list "--yy\n--dontyy" $cmd "short and long with \[dont\]" -sync_after_int - -set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_help fn} -assert_bash_list "" $cmd "more than two dashes" -sync_after_int - -set cmd {fn() { printf '%s\n' "-f FOO, --foo=FOO"; }; _parse_help fn} -assert_bash_list "--foo=" $cmd "-f FOO, --foo=FOO" -sync_after_int - -set cmd {fn() { printf '%s\n' "-f [FOO], --foo[=FOO]"; }; _parse_help fn} -assert_bash_list "--foo" $cmd "-f \[FOO\], --foo\[=FOO\]" -sync_after_int - -set cmd {fn() { printf '%s\n' "--foo."; }; _parse_help fn} -assert_bash_list "--foo" $cmd "--foo." -sync_after_int - -set cmd {fn() { printf '%s\n' "-f or --foo"; }; _parse_help fn} -assert_bash_list "--foo" $cmd "-f or --foo" -sync_after_int - -set cmd { printf '%s\n' "-f or --foo" | _parse_help - } -assert_bash_list "--foo" $cmd "from stdin" -sync_after_int - - -teardown diff --git a/test/unit/_parse_usage.exp b/test/unit/_parse_usage.exp deleted file mode 100644 index 5a40b1fe..00000000 --- a/test/unit/_parse_usage.exp +++ /dev/null @@ -1,64 +0,0 @@ -proc setup {} { - save_env -} - -proc teardown {} { - assert_env_unmodified { - /declare -f fn/d - /PIPESTATUS=/d - } -} - -setup - - -set cmd {fn() { printf '%s\n' ""; }; _parse_usage fn} -assert_bash_list "" $cmd "empty" -sync_after_int - -set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_usage fn} -assert_bash_list "" $cmd "no dashes" -sync_after_int - -set cmd {fn() { printf '%s\n' "foo [-f]"; }; _parse_usage fn} -assert_bash_list "-f" $cmd "simple" -sync_after_int - -set cmd {fn() { printf '%s\n' "bar [-aBcD] [-e X]"; }; _parse_usage fn} -assert_bash_list "-a -B -c -D -e" $cmd "bundled + separate 1 short" -sync_after_int - -set cmd {fn() { printf '%s\n' "[-[XyZ]] [--long=arg]"; }; _parse_usage fn} -assert_bash_list "-X -y -Z --long=" $cmd "bundled in brackets + separate long" -sync_after_int - -set cmd {fn() { printf '%s\n' "[-s|--long]"; }; _parse_usage fn} -assert_bash_list "--long" $cmd "short or long" -sync_after_int - -set cmd {fn() { printf '%s\n' "[-s, --long=arg]"; }; _parse_usage fn} -assert_bash_list "--long=" $cmd "short or long with arg, comma" -sync_after_int - -set cmd {fn() { printf '%s\n' "[--long/-s] [-S/--longer]"; }; _parse_usage fn} -assert_bash_list "--long\n--longer" $cmd "long or short, slash" -sync_after_int - -set cmd {fn() { printf '%s\n' "[ -a ] [ -b foo ]"; }; _parse_usage fn} -assert_bash_list "-a\n-b" $cmd "whitespace in brackets" -sync_after_int - -set cmd {fn() { printf '%s\n' "[ -a | --aa ]"; }; _parse_usage fn} -assert_bash_list "--aa" $cmd "whitespace in brackets 2" -sync_after_int - -set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_usage fn} -assert_bash_list "" $cmd "many dashes" -sync_after_int - -set cmd { printf '%s\n' "[-duh]" | _parse_usage - } -assert_bash_list "-d -u -h" $cmd "from stdin" -sync_after_int - - -teardown diff --git a/test/unit/_tilde.exp b/test/unit/_tilde.exp deleted file mode 100644 index e313dcae..00000000 --- a/test/unit/_tilde.exp +++ /dev/null @@ -1,53 +0,0 @@ -proc setup {} { - save_env -} - -proc teardown {} { - assert_env_unmodified { - /COMPREPLY=/d - } -} - - -setup - - -set test "function should run without errors" -assert_bash_exec {_tilde > /dev/null} $test -sync_after_int - -set test "function should not pollute environment" -# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown() -assert_bash_exec {foo() { local aa="~"; _tilde "$aa"; }; foo; unset foo} $test -sync_after_int - -set failed_find_unique_completion 0 -assert_bash_exec {compgen -u} {} /@ users -if {![find_unique_completion_pair $users part full]} { - set failed_find_unique_completion 1 -} - -set test "~full should complete to ~full unmodified" -if {$failed_find_unique_completion} { - untested "Not running, no suitable test user found: $test" -} else { - set cmd [format {_tilde "~%s"; printf "%%s\n" "${COMPREPLY[@]}"} $full] - assert_bash_list "~$full" $cmd $test - sync_after_int -} - -set test "~part should complete to ~full" -if {$failed_find_unique_completion} { - untested "Not running, no suitable test user found: $test" -} else { - 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/find_unique_completion_pair.exp b/test/unit/find_unique_completion_pair.exp deleted file mode 100644 index 4a95c1bf..00000000 --- a/test/unit/find_unique_completion_pair.exp +++ /dev/null @@ -1,38 +0,0 @@ -# Note: This test actually tests a function in the test library. It doesn't -# need bash running; but it doesn't hurt either. - -# Run one test. Look below for usage. -proc test_find_ucp {{list} {epart} {econt} {eret 1}} { - set efull "$epart$econt" - set rret [find_unique_completion_pair $list rpart rfull] - if {$eret != $rret} { - if {$eret} { - fail "find_unique_completion_pair: Nothing found for {$list}" - } else { - fail "find_unique_completion_pair: Expected failure for {$list}" - } - } elseif {!$eret} { - pass "find_unique_completion_pair: No results for list {$list}" - } elseif {$rpart != $epart || $rfull != $efull} { - fail "find_unique_completion_pair: Got \"$rpart\", \"$rfull\" \ - instead of \"$epart\", \"$efull\" for list {$list}" - } else { - pass "find_unique_completion_pair: Got \"$epart\", \"$efull\" \ - for list {$list}" - } -} - -test_find_ucp {a} 0 0 0 -test_find_ucp {ab} a b -test_find_ucp {ab ab ab} a b -test_find_ucp {a ab abcd abc} 0 0 0 -test_find_ucp {a ab abcde abc} abcd e -test_find_ucp {user1 user2} 0 0 0 -test_find_ucp {root username2 username1} ro ot -test_find_ucp {root username21 username2} ro ot -test_find_ucp {long_user_name lang_user_name long_usor_name} lang_us er_name -test_find_ucp {lang_user_name1 long_user_name lang_user_name long_usor_name} \ - long_use r_name -test_find_ucp {root username} user name -test_find_ucp {a aladin} ala din -test_find_ucp {ala aladin} alad in |