diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:14:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:14:42 +0000 |
commit | 0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 | |
parent | Initial commit. (diff) | |
download | bash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.tar.xz bash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.zip |
Adding upstream version 1:2.11.upstream/1%2.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
1483 files changed, 50639 insertions, 0 deletions
diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..56279de --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,10 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((python-mode + (eval add-hook 'before-save-hook 'blacken-buffer nil t)) + (sh-mode + (mode . shfmt-on-save) + (shfmt-arguments "-s") + (flycheck-sh-bash-args "-O" "extglob") + (sh-indent-comment . t))) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..61f2dc9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +**/__pycache__/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..85032d1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +[*] +indent_style = space +indent_size = 4 +tab_width = 8 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 79 +# for shfmt +function_next_line = true +switch_case_indent = true + +[Makefile.am] +indent_style = tab + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae29894 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +*.tar* +*.swp +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.log +config.status +configure +configure.lineno +install-sh +missing +doc/*.xml +*~ +doc/html* +bash_completion.sh +bash-completion.pc +bash-completion-config.cmake +bash-completion-config-version.cmake +__pycache__/ +.pytest_cache/ +.python-version +pytestdebug.log diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..0204e77 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,4 @@ +MD007: + false # for lists in FAQ/A +MD033: + allowed_elements: [kbd] diff --git a/.perltidyrc b/.perltidyrc new file mode 100644 index 0000000..9f681d2 --- /dev/null +++ b/.perltidyrc @@ -0,0 +1,6 @@ +--perl-best-practices +--maximum-line-length=79 +--paren-tightness=2 +--cuddled-else +--warning-output +--converge diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..57d1264 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,97 @@ +repos: + + - repo: local + hooks: + - id: shfmt + name: shfmt + language: golang + additional_dependencies: [mvdan.cc/sh/v3/cmd/shfmt@v3.1.2] + entry: shfmt + args: [-w, -s] + types: [text] + files: ^(bash_completion|completions/.+|test/(config/bashrc|update-test-cmd-list)|.+\.sh(\.in)?)$ + exclude: ^completions/(\.gitignore|Makefile.*)$ + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.7.1.1 + hooks: + - id: shellcheck + args: [-f, gcc] + types: [text] + files: ^(bash_completion|completions/.+|test/(config/bashrc|update-test-cmd-list)|.+\.sh(\.in)?)$ + exclude: ^completions/(\.gitignore|Makefile.*)$ + require_serial: false # We disable SC1090 anyway, so parallel is ok + + - repo: local + hooks: + - id: update-test-cmd-list + name: update-test-cmd-list + language: script + entry: test/update-test-cmd-list + files: ^test/t/.+\.py$ + pass_filenames: false + + - repo: https://github.com/psf/black + rev: 19.10b0 + hooks: + - id: black + types: [text] + files: ^(helpers/python|.+\.py)$ + exclude: ^completions/ + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + args: [--config=test/setup.cfg] + additional_dependencies: [flake8-bugbear==20.1.4] + types: [text] + files: ^(helpers/python|.+\.py)$ + exclude: ^completions/ + + - repo: https://github.com/timothycrosley/isort + rev: 5.1.4 + hooks: + - id: isort + args: [--settings-path=test/setup.cfg] + types: [text] + files: ^(helpers/python|.+\.py)$ + exclude: ^completions/ + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.782 + hooks: + - id: mypy + args: [--config-file=test/setup.cfg] + # Intentionally not run on helpers/python (support very old versions) + exclude: ^completions/|^test/fixtures/pytest/ + + - repo: https://github.com/asottile/pyupgrade + rev: v2.7.2 + hooks: + - id: pyupgrade + args: [--py3-plus, --keep-percent-format] + exclude: ^completions/ + + - repo: https://github.com/perltidy/perltidy + rev: "20200619" + hooks: + - id: perltidy + types: [text] + files: ^(helpers/perl|.+\.p[ml])$ + + - repo: local + hooks: + - id: perlcritic + name: perlcritic + language: perl + additional_dependencies: [PETDANCE/Perl-Critic-1.138.tar.gz] + entry: perlcritic + args: [--quiet, --verbose, "5"] + types: [text] + files: ^(helpers/perl|.+\.p[ml])$ + + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.23.2 + hooks: + - id: markdownlint diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..cf5ed4b --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,16 @@ +shell=bash +disable=SC1090 # not really fixable usually (ever?) +disable=SC2034 # for localizing variables set in called functions +disable=SC2128 # intentional style choice +disable=SC2206 # suggested alternatives fail in posix mode or use temp files +disable=SC2207 # suggested alternatives fail in posix mode or use temp files + +# These disables are to be investigated and decided + +disable=SC1004 +disable=SC2015 +disable=SC2016 +disable=SC2086 +disable=SC2155 +disable=SC2162 +disable=SC2231 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1ab73f5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,56 @@ +language: generic + +dist: bionic + +services: + - docker + +jobs: + include: + - stage: lint + language: go + go: "1.14" + services: [] + cache: + directories: + - $HOME/.cache/pip + - $HOME/.cache/pre-commit + before_install: [] + script: + - pyenv shell 3.8 + - pip3 install "$(grep ^pre-commit test/requirements-dev.txt)" + - pre-commit run --all-files --color=always + - stage: test + env: DIST=alpine + - env: DIST=centos7 + - env: DIST=debian10 + - env: DIST=fedoradev + - env: DIST=ubuntu14 + - env: DIST=ubuntu14 BSD=true NETWORK=none + +before_install: + - docker build + --build-arg DIST=$DIST -t bash-completion:$DIST -f test/docker/Dockerfile . + +script: + - docker run --name bash-completion + -e CI=true -e DIST=$DIST -e BSD=$BSD -e NETWORK=$NETWORK + ${NETWORK:+--network $NETWORK} + -t bash-completion:$DIST + +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 = alpine + tags: true @@ -0,0 +1,7 @@ +David Paleino (Debian) <d.paleino@gmail.com> +Freddy Vulto <fvulto@gmail.com> +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ä <ville.skytta@iki.fi> @@ -0,0 +1,3141 @@ +bash-completion (2.11) + + [ Alexander Meshcheryakov ] + * _known_hosts_real: check that ruptime is present before calling + (#390) + + [ Andrew Gaul ] + * totem: reuse kaffeine completions (#372) + + [ Damien Nadé ] + * __reassemble_comp_words_by_ref: avoid triggering nounset on + indirect references + + [ Felix Lechner ] + * lintian: complete paths for Ubuntu's .ddeb and Debian's buildinfo + files (#397) + + [ Felix Yan ] + * ip: complete route add table arg + * ip: style fixes similar to ip-netns + * ip: add more completions for ip-rule + * ip: add support for netns (#391) + * ip: improve completion of route subcommands (#326) + + [ Hans-Christoph Steiner ] + * unzip, zipinfo: complete *.aar (#428) + + [ Jakub Jelen ] + * ssh: add new -Q completions in OpenSSH 8.2p1 (#400) + + [ Kevin Locke ] + * python: support executables with minor version (#389) + + [ Michal Suchánek ] + * insmod, modinfo, modprobe: support xz compressed modules (#401) + + [ Phan Duc Nhat Minh ] + * tshark: complete -r arg with all filenames (#422) + + [ Sebastian Jakubiak ] + * openssl: update -starttls completions (#403) + * _filedir*: update link to bug-bash discussion on -X (#404) + * test/python: add testcase for submodule completion + + [ Ville Skyttä ] + * Release 2.11 + * extra/make-changelog: check and output usage message + * pre-commit: anchor exclude patterns + * pytest: rewrite in bash, support toplevel funcs, avoid nondef ones + and classes + * test/xfreerdp: skip --help failure cases + * test/tshark: fix multiple -O completion with no http2 support + * test/ant: avoid complete-ant-cmd.pl interference with ANT_ARGS + * _xinetd_services: avoid nounset error on bash 4.2 + * pre-commit: upgrade isort to 5.1.4 + * pre-commit: upgrade pyupgrade to 2.7.2 + * pre-commit: add pyupgrade, run it + * test/ant: gitignore all target cache files + * _known_hosts_real: exclude Host negations + * pre-commit: upgrade isort to 5.0.7 + * pre-commit: update shellcheck-py URL + * test/inputrc: do not set print-completions-horizontally + * test/inputrc: comment typo fix + * pytest: complete async test class methods + * __get_cword_at_cursor_by_ref: fix regression on bash 4.2 + * test: upgrade markdownlint-cli to 0.23.2 + * _known_hosts_real: avoid errors in nounset mode on Ubuntu 14 and + 16 + * _longopt: exclude too many dashes, allow underscores, require ends + with alnum + * _included_ssh_config_files: support globs + * _known_hosts_real: prevent unwanted pathname expansion on host + entries + * test/shfmt: upgrade to 3.1.2, reformat with it + * test/_known_hosts_real: add explicit no globbing test case + * test: upgrade mypy to 0.782 + * CONTRIBUTING.md: add posix and nounset mode item + * test: upgrade mypy to 0.781 + * test: upgrade perltidy to 20200619 + * _known_hosts_real: fix completion of Host entries after a wildcard + etc + * _known_hosts_real: fix # handling in ssh configs + * test: upgrade flake8 to 3.8.3 + * test/xhost: multiple expected result handling fixes + * test/slapt-src: single expected result handling fixes + * test: partial hostname completion fixes + * test: simplify completion parsing + * test/dpkg-query: mark as xfail on non-Debian based systems + * .gitignore: clean up some no longer needed ignores + * test/lspci: skip -A arg test if lspci fails -A help, e.g. busybox + lspci + * test: regex escape our magic mark for completeness + * test: upgrade mypy to 0.780 + * test/_known_hosts_real: don't modify class scoped base expected + list + * test/_known_hosts_real: reset COMP_KNOWN_HOSTS_WITH_HOSTFILE + between tests + * test/_known_hosts_real: tolerate duplicates + * bash_completion: trivial cleanups + * gcc: avoid errors in nounset mode + * pytest: fix test class method completion with BSD awk + * man, mutt: avoid errors in nounset mode on Ubuntu 14 and 16 + * java, make: avoid errors in nounset mode on Ubuntu 14 and 16 + * README: document GNU make build requirement + * pytest: add test class method completion + * _known_hosts: avoid errors in nounset mode and no arguments + * bash_completion: fix array set checks with empty elements in them + * *: avoid more errors in nounset mode + * cfrun: fix $hostfile leak + * _command_offset, route: cleanups + * *: avoid more errors in nounset mode + * qemu: add -machine arg completion + * qemu, sbopkg: avoid unintentional globbing on option arg + completions + * test: enable shellcheck SC2035 + * *: drop support for bash 4.1 + * _init_completion: fix unassigned redirect completion in nounset + mode + * ip: route shfmt, arithmetic evaluation + * _filedir: avoid unbound variable error on Ubuntu 14 and 16 + * _pids, _pgids, _pnames: improve shfmt formatting + * scp, sftp, ssh: fix completion on options bundled with -4/-6 + * modprobe, tshark, _included_ssh_config_files: use [[ ]] instead of + [ ] + * test/runLint: warn about [ ] instead of [[ ]] use + * test: skip various tests if we don't get a useful usage message + * *: mark nounset mode as supported, issues with it are bugs now + * *: avoid more errors in nounset mode + * *: avoid more errors in nounset mode + * *: avoid more errors in nounset mode + * test/inputrc: comment and whitespace tweaks + * *: avoid more errors in nounset mode + * test/unit: sort files included in dist + * test/unit: include test_unit_known_hosts_real.py in dist + * bash_completion: line wrapping tweaks, NFC + * 7z: fix -o/-w attached arg completion + * postfix: try to arrange a fake tty so we can tickle the usage + message out + * _bashcomp_try_faketty: new function to try running command with a + fake tty + * mr: avoid herestrings, simplify command parsing + * test/mr: handle missing "clean" with skipif + * test: mark known non-ASCII issues with test suite as xfail + * dpkg-deb: add --raw-extract and -X arg completions + * test: add some dpkg-query test cases + * dpkg-deb: fix --show/-W completion + * test: upgrade markdownlint-cli to 0.23.1 + * *: use more arithmetic evaluation + * test: try harder to restore environment and cwd on failures + * *: use $ifs for storing/restoring $IFS + * test/irb: xfail options test if --help is not available + * test: upgrade flake8 to 3.8.1 + * test: pre-commit config cleanups, ordering + * test: upgrade pre-commit to 2.4.0+, drop shfmt kludge + * test: sync shfmt and shellcheck configs + * test: shfmt bashrc + * test: remove unused run-shellcheck, shellcheck is in pre-commit + now + * test: remove old test suite code no longer used \o/ + * test/_known_hosts_real: port remaining test cases to + pytest+pexpect + * test: remove more no longer needed old test suite code + * test/_known_hosts_real: port more test cases to pytest+pexpect + * test/_get_cword: port remaining test case to pytest+pexpect + * test: replace some echos with printfs + * test/_filedir: fix shutil.rmtree on Python < 3.6 + * test/_expand: port remaining test cases to pytest+pexpect + * test: drop some no longer needed old test suite code + * test/_filedir: port remaining test cases to pytest+pexpect + * test: run all Travis jobs on dist: bionic + * test: drop not needed sudo on Travis + * test/_filedir: port more test cases to pytest+pexpect + * test/__expand_tilde_by_ref: port remaining test cases to + pytest+pexpect + * test/_get_comp_words_by_ref: convert remaining test cases to + pytest+pexpect + * test: run pytest --verbose in docker + * lftp: use "bookmark list" command to list bookmarks + * test: drop some no longer needed old test suite code + * test/slapt-src: convert remaining test case to pytest+pexpect + * _xfunc: simplify + * apt-cache: avoid nonzero exit code from _apt_cache_packages + * test/slapt-get: convert remaining test case to pytest+pexpect + * test/secret-tool: add to test command list + * test/scp: port remaining test case to pytest+pexpect + * test/umount: convert remaining test case to pytest+pexpect + * secret-tool: new completion + * apt-get: complete build-dep with dirs + * travis: use golang 1.14 for shfmt + * *: run all shell code through shfmt -s + * pre-commit etc: add shfmt + * test: fix incorrect fixtures/shared/default xfails/expectations + * test: upgrade markdownlint to 0.23.0 + * nmap: simplify help scraping a bit, don't try to emit unnecessary + newlines + * test: prefix fake test commands with underscore + * test: port most umount test cases to pytest+pexpect + * test: add note about unescaped assert_complete single return + values + * editorconfig: apply yaml settings to .yaml too + * pre-commit: use local perlcritic hook + * *: doc and comment link updates + * pre-commit, *.md: add markdownlint, address findings + * README: clarify loading automatically on demand + * ssh-keygen: -O arg updates and improvements + * ssh-keygen: add -b arg completions according to specified -t + * ssh-keygen: option and arg completion updates for new versions + * _command: improve commentary + * reportbug, scp, sftp, svn: use compgen -c instead of _command + * find: fix -exec etc argument and its completion + * extra: trigger docker builds only on test-cmd-list.txt changes + * test: add script to maintain list of executables for full test + coverage + * test: run lint tests on Travis in a quickish separate first stage + * test/make: mark more cases as requiring command + * make: add bmake alias + * test: run pre-commit on host instead of docker + * test: add perlcritic to pre-commit, run on all perl + * *: remove some unused variables, thanks to shellcheck SC2034 + * *: various loop iteration improvements + * crontab: fix loop over already given args + * apt-cache: fix command mode handling + * doc: add loop variable naming guideline + * test: make at-point completion tests easier + * ssh, xsltproc: address shellcheck SC2006 + * scp: work around shellcheck SC1003 + * mutt: address shellchec SC2236 + * wget: address shellcheck SC2116 + * pytest: address shellcheck SC2002 + * bash_completion, java, tipc: for loop whitespace consistency + tweaks + * *: more arithmetic evaluation cleanups, thanks to shellcheck + SC2004 + * __reassemble_comp_words_by_ref, java: address and work around + shellcheck SC2102 + * test: enable parallel pre-commit shellcheck + * test: remove shellcheck severity filter, add explicit disables + instead + * doc: recommend arithmetic evaluation + * *: array subscript cleanups + * ssh-keygen: -s and -n completion improvements + * *: enable and address shellcheck SC2053 + * bash_completion, invoke-rc.d, svcadm: trivial cleanups + * *: replace various conditional expressions with arithmetic + evaluation + * carton: fix command parsing with BSD sed + * nmap: fix option parsing with BSD sed + * test/alias: port remaining test case to pytest+pexpect + * test: generalize complete at point test + * test/cd: fix test_dir_at_point for setups that repeat "trailer" + * pytest: add some option arg (non-)completions + * pytest: complete test classes + * pgrep, pkill: add --ns and --nslist arg completions + * test: run skipif and xfail commands without caring if they output + or not + * test: make it possible to not care whether command did output or + not + * test/xfreerdp: skip xfreerdp kbd test if kbd-list returns empty + * test: tolerate duplicates from compgen actions + * test: bump shellcheck severity to warning + some disables + * *: address shellcheck SC2046 + * test/lib/library.sh: address shellcheck SC2125 + * java, pkgadd, sysbench: address shellchec SC2124 + * scp: address shellcheck SC2089 and SC2090 + * _filedir_xspec: address shellcheck SC2140 + * rpm, ssh, umount.linux: address shellcheck SC2120 + * cvs, modprobe, sh: address shellcheck SC2209 + * mutt: address shellcheck SC2088 + * _upvar, _upvars, _variables, rpm: address shellcheck SC1083 + * test/run: address shellcheck SC2164 + * renice: address shellcheck SC2254 + * tipc: comment grammar and spelling fixes + * man, perl, route, tipc: address shellcheck SC2053 + * info, java: address shellcheck SC2153 + * quote_readline: fix $ret leak + * test: upgrade shellcheck to 0.7.1 + * test/printenv: xfail if --help doesn't contain options (e.g. + busybox) + * test/aptitude: require command where necessary + * _known_hosts_real, op: address shellcheck SC2184 + * test: don't run shellcheck on completions/.gitignore + * protoc: complete all --*_out without more specific handling with + dirs + * sysbench: add --test= deprecation TODO + * pkgadd: indentation fix + * chronyc, wvdial: address shellcheck SC2178 + * java, pkgadd, sysbench: address shellcheck SC2124 + * mplayer: address shellcheck SC1078 false positive + * smartctl: hush shellcheck SC2054 false positives + * *: address shellcheck SC2221 and SC2222 + * bash_completion: address shellcheck SC2220 + * crontab, wodim: silence shellcheck SC2191 and SC2192 + * aptitude: add some option arg (non)completions + * aptitude: parse options list from --help, hardcode less + * test/aptitude: add some test cases + * *: argument interation improvements + * *: whitespace tweaks + * apt-get etc: use _apt_cache_packages from apt-cache + * pre-commit: run most python checks on helpers/python too + * test/ldd: xfail if --help is not implemented + * test/printenv: require command for arg completion test + * printenv: indentation fixes + * test: upgrade mypy to 0.770 + * test: split dependencies requiring Python 3.6.1+ to requirements- + dev.txt + * git: trigger docker rebuild on pre-commit config change + * test: require openssl command for option argument tests + * test: move perltidy to pre-commit, run with --converge + * test: move shellcheck to pre-commit + * test: ignore flake8 messages that are in black's domain + * _xinetd_services: look up from $BASHCOMP_XINETDDIR, add some unit + tests + * printenv: new completion + * copyright: add 2020 + * test: fix CompletionResult.__eq__ UnboundLocalError + * test: run pre-commit in tools container + * test: shellcheck tweaks + * test: add isort to pre-commit, run it + * test: add flake8-bugbear + * test: install black for Python 3.6 too + * pre-commit: add config with black, flake8, and mypy + * test: drop redundant black args from docker runs + * *: python type hint fixes and improvements + * extra/make-changelog: run through black + * test/totem: add basic test case + * test/cd: remove unused import + * openssl: complete -writerand with filenames + * openssl: parse available options from $command -help + * openssl: support getting digest list from more recent openssl + versions + * nmap: handle options split on equals sign + * nmap: parse options from -h output + * test/cd: make dir_at_point produce better debuggable failures + * test/cd: convert remaining test case to pytest+pexpect + * test: remove some no longer needed old test suite code + * test/chown,sudo: parametrize special case test, improve xfail + targeting + * test/tsig-keygen: require command for test_options + * test/upgradepkg: port remaining test case to pytest+pexpect + * tsig-keygen: new completion + * test: host helper lint and usage fixes + * test: port some _known_hosts_real unit tests to pytest+pexpect + * test: remove some no longer needed tcl/expect code + * test: fix spurious hosts fixture failure without avahi-browse + installed + * test: port some scp test cases to pytest+pexpect + * test: port remaining finger, sftp, ssh, and xhost cases to + pytest+pexpect + * lilo: work around shellcheck false positive + * test/ipcalc: fix tests with busybox ipcalc + * chromium-browser, firefox: complete on *.txt (#379) + * README.md: add introduction + * ipcalc: new completion + * *: complete commands when prefixed with a backslash + * test/wol: don't fail MAC test if test system has /etc/ethers + entries + * test/dnssec-keygen: allow more alternatives in algorithm + completion + * lilo: don't complete on commented out labels + * lilo: honor -C when completing labels + * lilo: add -B and -E completions + + [ beantaxi ] + * Source user completion only if it's a file (#409) + + [ hugoziviani ] + * jarsigner: complete on *.apk too (#386) + * cryptsetup: add luksChangeKey arg completion (#380) + + -- Ville Skyttä <ville.skytta@iki.fi> Sat, 25 Jul 2020 11:25:09 +0300 + +bash-completion (2.10) + + [ Felix Lechner ] + * perltidy: associate *.t (#338) + + [ Gabriel F. T. Gomes ] + * perl: fix completion with space between option and argument + + [ Grisha Levit ] + * _variables: add TERM and LC_* completion (#353) + + [ Iñigo MartÃnez ] + * autotools: Replace pkgdatadir with datadir + * pkg-config: Relative paths + * pkg-config: generate Name from autotools PACKAGE + + [ Jakub Jelen ] + * ssh: option and argument completion updates (#332) + + [ MichaÅ‚ Górny ] + * test_arp: Skip if ARP tables are empty + * test_chromium_browser: Skip test_2 if 'chromium-browser --help' + fails + * test_rpm2tgz: Fix expected output + + [ Sebastian ] + * cppcheck: Add new standards to --std option. (#356) + + [ Tomasz N ] + * apt-get: fix pkg version completion if it contains a colon (#351) + + [ Ville Skyttä ] + * test: bump black to >=19.10b0 + * ssh, scp, sftp, ssh-copy-id, curl: improve identity file + completion + * update-rc.d: indentation fix + * update-rc.d: remove dead code + * screen: add serial device basic arg (non)completion + * screen: add //telnet completion + * test: add some trivial perl -E/-e cases + * perl: indentation fixes + * curl: make @filename completion do the right thing with dirs + * _filedir: avoid duplicate dirs internally, and a compgen -d call + for files + * _filedir: remove unused $x + * bash_completion.sh: shellcheck SC2086 fixes + * test: shellcheck config cleanups + * shellcheck: add some option arg (non)completions + * test: fix cpio users test in presence of usernames with whitespace + * test: python typing fixes + * test: add minimal mypy config + * .gitignore: mypy cache + * makepkg: fix option completion + * test: mark dcop and mr testcases requiring the cmd as such + * CONTRIBUTING: disable e-mail bug gateway due to spam + * carton: new completion + * op: direct command parsing stderr to /dev/null + * test: adjust java expectations based on whether jars can be listed + * valgrind: look tool names from lib/*-linux-gnu dirs too + * test: xfail locale-gen option completion if --help is not + available + * _sysvdirs: always return 0 + * java: don't assume jar is installed + * travis: test with Debian 10 + * wine: install for wine-development and wine-stable too + * travis: generate dist tarball on alpine + * dmypy: new completion + * test: add require_longopt xfail helper, use it + * test: mark more tests that parse command output as requiring + command + * sysctl: invoke completed sysctl instead of one from path to get + variables + * screen, smartctl, update-alternatives: _parse_help, drop hardcoded + option list + * lintian-info: _parse_help, add more option arg (non)completions + * gprof: _parse_usage, drop hardcoded option list + * test: fix retrieving command to test from request + * travis: pass NETWORK as env var, so we can actually use it + * test: xfail MAC address completion without networking + * test: ignore _makepkg_bootstrap in makepkg test env + * test: hush flake8-bugbear B010 + * test: don't sort expected completion lists under the hood + * test: add bunch of basic option parsing test cases + * test: always run tests which don't require tested command + * test: explodepkg and upgradepkg test fixes + * test: mark sbcl-mt xfail due to whitespace split issues + * _terms: search directly from various terminfo dirs + * _terms: combine and simplify somewhat + * pkg-get: fix $i leak + * pkgutil: fix $i leak + * test: portinstall/upgrade test case and setup fixes + * lvm pv*, vg*: parse help instead of hardcoding option list + * ipv6calc: parse help instead of hardcoding option list + * test: avoid some sed -r/-E runLint false positives + * test: use sh +* as ccache command test case + * java: make jar/zip listing work with unzip + * test: installpkg test fixes + * test: fix acroread fixture dir + * test: remove unnecessary returns after pytest.skip + * test: avoid gnome-mplayer core dump on Ubuntu 14 + * xvfb-run: new completion + * test: skip gssdp-discover --message-type when option not available + * test: expect failures for bc without --help useful with _longopt + * test: don't expect a .tox dir in fixture + * test: drop sourcing our no longer existing profile.d script + * tox: include -- in option completions + * tox: complete defaults after a -- + * gssdp-discover: new completion + * test: register our pytest markers to hush warnings from 4.5+ + * test: fix required pytest version + * ip: invoke the tool as $1 + * README: drop distro badges, link to Repology instead + * chromium-browser: add --proxy-server arg completion + * test: source our profile.d test env script in docker + * influx: new completion + * README: badge title tweaks + * tox: do simple parse on tox.ini if --listenvs* yields nothing + * test: add basic tox fixture + * man: fall back to _parse_usage for _parse_help + * test_wsimport: xfail options test on unparseable -help + * test: don't try to install black on Python < 3.6 + * pgrep: fix fallback to _parse_usage + * test: xfail unparseable mock and munin-node-configure --help cases + * test_pwdx: xfail more unparseable help cases + * build: make pytest executable configurable, look for pytest-3 too + * test: enforce minimum pytest version + * test: zopflipng flake8 fix + * test: xfail getent and pwdx option completions with unparseable + --help + * test: add more basic _parse_help use test cases + * test: add bunch of basic _parse_help use test cases + * .gitignore: add configure.lineno + * badblocks: fix $i leak + * postfix: option completion is expected to fail at the moment + * cal: try _parse_help before _parse_usage + * test: add bunch of basic _parse_usage use test cases + * chsh, pwck: try _parse_help before _parse_usage + * test: add basic autossh test + * test: convert more _filedir unit tests to pytest+pexpect + * test: flake8 fix + * test: convert bunch of _filedir unit tests to pytest+pexpect + * test: convert finger partial test case to pytest+pexpect + * README: add some badges, tweak existing + * test: port _variables unit tests to pytest+pexpect + * test: port compgen and quote tests to pytest+pexpect + * iconv, lz4, tipc, xsltproc: replace some seds with compgen -X + * test: disallow Alpine failure on Travis + * _pnames: adapt for busybox ps, rewrite in pure bash + * test: run our docker script in test containers by default + * test: use one Dockerfile for all dists + * test_ifup: accept short option completions too + * timeout: fallback to _parse_usage from _parse_help + * test_wget: test --s instead of --h + * test_lsusb: xfail with unparseable --help + * test: expect failures for various completions without useful + --help + * test: support xfail in our markers like skipif, use it a lot + * test: add Alpine Linux container, allow failures for now + * iconv: weed out ... from encoding completions + * test_iconv: add basic file completion test + * test_iconv: skip option completion if --help fails + * test_getconf: skip if -a doesn't output any POSIX_V* + * test_feh, test_makepkg: invoke grep as "command grep" + * test: generalize check whether we're being run in a container + * tar: simplify locating tarball from command line + * pkg_delete: don't limit to FreeBSD + * test: reformat test_chromium_browser.py source + * test: set up BASH_COMPLETION_COMPAT_DIR in bashrc (only) + * test: more thorough system location interference avoidance + * test: bashrc comment and whitespace tweaks + * build: makefile whitespace tweaks + * build: really reset return value before completions check + * build: simplify symlink setup + * tar: add missing bsdtar, gtar, and star symlinks + * README: use light gray badges for unknown versions + * README: link to cygwin package + + [ Wolf ] + * ri: hush some warnings + + [ andreabravetti ] + * unrar: complete on *.exe (#337) + + [ ezr ] + * chromium-browser: Add support for .mhtml files + + [ jerkey ] + * screen: complete first arg with serial devices + + [ marxin ] + * gcc: support new --completion option (#222) + + [ pcc ] + * unzip, zipinfo: complete *.aab (#340) + + [ versat ] + * cppcheck: Remove deprecated option 'posix' for '--std=' + + -- Ville Skyttä <ville.skytta@iki.fi> Thu, 05 Dec 2019 17:04:26 +0200 + +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 ] + * dpkg: Add -V/--verify arg completion + + [ Ben Wiederhake ] + * Add support for .lz4 extension to file-roller (#158) + + [ Eric A. Zarko ] + * unzip, zipinfo: Associate *.gar (#165) + + [ Gabriel F. T. Gomes ] + * openssl: Add completion for the genpkey, pkey, pkeyparam, and + pkeyutl commands + + [ Gonzalo TornarÃa ] + * test: run bash with --norc to avoid system bashrc + + [ Gábor Bernát ] + * tox: New completion (#163) + + [ Halt ] + * mplayer: Disable user config when parsing options + + [ Henry-Joseph Audéoud ] + * ebtables: new completion (#150) + + [ Jakub Jelen ] + * ssh,ssh-add,ssh-keygen: Complete pkcs11 options with *.so + + [ Kevin Pulo ] + * mkdir: Complete on files in addition to dirs + + [ Luca Capello ] + * dpkg-query: Fix -W/--show completion + + [ Mark Friedenbach ] + * Add support for .lzo extension (--lzop) to tar (#155) + + [ Martin d'Anjou ] + * java: Complete *.war + + [ Mateusz Piotrowski ] + * kldunload: Increase robustness of compgen filters (#185) + * kldunload: Show modules with digits + + [ MichaÅ‚ Górny ] + * lftp: Support ~/.local/... bookmark location (#144) + * test suite: Support overriding default match buffer size (#141) + + [ Pawel ] + * man: Don't use $MANPATH directly (#161) + + [ Uwe Storbeck ] + * dpkg: Complete --vextract on deb files + * dpkg: Fix man page section in comment + + [ Ville Skyttä ] + * make-changelog.py: Use python3 + * test: Fix getting username in non-login shells + * test/unit: Whitespace tweaks + * info, man, rsync: Defer _expand invocation + * _expand: Reuse __expand_tilde_by_ref and _tilde logic, clean up + * test: Add some _expand unit tests + * bzip2, gzip, and other compressors: Use _tilde instead of _expand + * test: Add assert_complete_homedir, use in dpkg and ls + * dd, find, gcc: Remove unnecessary tilde expansion + * dd: Omit space only when offering one completion ending with = + * __expand_tilde_by_ref: Eval tilde expansion only, simplify + * Bump copyright years to -2018 + * mkdir: Complete files without appending space + * __load_completion: Load "xspec" completions dynamically too + * __load_completion: Code cleanup + * _available_interfaces: Get rid of eval + * make: Pass script to sed as parameter instead of using process + substitution + * ccze: New completion + * *: Comma separated opt arg completion improvements + * test suite: Some more mplayer and mencoder coverage + * tox: Complete comma separated -e arguments + * xdg-mime,xdg-settings: Fix inclusion in tarball + * geoiplookup: New completion + * ping*,ssh,scp,sftp,tracepath6: Filter IPv4/IPv6 literal addresses + * _known_hosts_real: Add option to filter IPv4 and IPv6 addresses + * radvdump: New completion + * lsscsi: New completion + * python: Support completing dotted module hierarchies + * test/docker: Tweak work dir, add bash as default cmd + * test: Try to skip postconf variable test on broken postfix configs + altogether + * Revert "travis: Don't build local docker images, use vskytta/bash- + completion ones" + * test: Add "postconf -" test case + * test: Work around broken centos/fedora postfix config in non-IPv6 + setup + * travis: Don't build local docker images, use vskytta/bash- + completion ones + * pycodestyle: New completion + * flake8: Various option arg completion improvements + * perltidy: New completion + * lowriter,localc etc: Use corresponding oo* completions + * cryptsetup: Update option lists + * pv: New completion + * getconf: New completion + * nproc: New completion + * _known_hosts_real: Document -a better + * ssh: Add -J/ProxyJump completion + * ssh: Declare $prefix closer to use + * test: Ignore duplicates in find_unique_completion_pair list + * test: dpkg,ls,_tilde: Skip gracefully if no uniq user for + completion is found + * xdg-mime: New completion + * ssh-keygen: Add -E arg completion + * reportbug: Don't hardcode option lists, split option args at = + * reportbug: Add -A/--attach arg completion + * apt-get: Complete *.deb on install if argument contains a slash + * ri: Fix integrated ri 1.8 class completion + * test: Add files to test older ri with + * Whitespace + * test: Remove things moved to library.exp from bashrc + * test: Add some comments regarding bash init in library.exp + * xdg-settings: New completion + * tox: Remove spurious executable bits + * tox: Include ALL in -e completions + * tox: Avoid stderr spewage when -e invoked without tox.ini + * pylint: Invoke python3 to search for modules if command contains 3 + * pylint: Install for pylint-2 and pylint-3 too + * test suite: Add bunch of man and MANPATH test cases + * test suite: Make man test subject names less generic + * test suite: man cleanup + * rfkill: Rename to _rfkill to avoid conflict with util-linux >= + 2.31 + * test: Use prebuilt docker hub bash-completion images + * README.md: Whitespace cleanup + * iptables: Use invoked command instead of hardcoded "iptables" + * iptables: Avoid stderr trashing when invoked as non-root + * iptables: Parse options from --help output + * vpnc: Add some option argument (non)completions + * vpnc: Improve config completions + * test suite: Drop no longer needed fedoradev /usr/bin/which + workaround + * test suite: Skip fedoradev GPG checks at least for now + * lspci: New completion + * lsusb: New completion + * oggdec: New completion + * alias: Fix completion followed by = (#146) + * *: Protect shopt reset from non-default $IFS + * test suite: Limit amount of info and pinfo test output + * test suite: Add info and pinfo option test cases + * test suite: Add basic hid2hci and munin-node-configure test cases + * aptitude: Add keep to commands list (Debian: #867587) + * *: Protect _known_hosts_real from user input treated as options + * curl: Fix -x etc option argument hostname completion + * groupdel: Parse and handle long options + * aptitude-curses: Use aptitude completion + * test suite: Install aptitude in ubuntu14 container + * test suite: Enable wine in ubuntu14 + * xm: Don't leak args and commands environment variables + * uscan: Don't leak cword and words environment variables + * test suite: Add bunch of missing basic test cases + * ktutil: Don't leak i and command environment variables + * test suite: Limit amount of output from process name completion + * test suite: Limit number of screen -T completion matches + + [ j^ ] + * xine etc, ogg123, mplayer -audiofile: Associate with *.oga + + -- Ville Skyttä <ville.skytta@iki.fi> Sat, 17 Mar 2018 10:30:07 +0200 + +bash-completion (2.7) + + [ Eli Young ] + * Makefile: update default compatdir (#132) + + [ Ville Skyttä ] + * Make user completion file configurable, disable in tests + * test suite: Generalize xspec completion install check + * pyflakes: Remove redundant xspec completion + * test suite: Fix __expand_tilde_by_ref test expectation output + * pdfunite: New *.pdf completion + + -- Ville Skyttä <ville.skytta@iki.fi> Sat, 01 Jul 2017 14:08:43 +0300 + +bash-completion (2.6) + + [ Björn Kautler ] + * Add missing sidedoor to .gitignore (#114) + + [ Ville Skyttä ] + * test suite: Mark expected centos6 CI _filedir failures as such + * Expose version in BASH_COMPLETION_VERSINFO, use it in profile.d + script + * test suite: Skip an expected make test case failure in centos6 CI + * test suite: Fix ifdown and ifup CI test skipping + * test suite: Ignore env var pulled in by use of scp in tests + * test suite: If colon trim doesn't do anything, trim as usual + * tar: Comment spelling fixes + * test suite: Mark dpkg -L test case untested if no packages + installed + * test suite: Cosmetic tweaks + * dpkg: Fix dpkg -i home dir completion + * test suite: Improve ls home dir test descriptions + * python: Split module completion to separate helper + * micropython: New completion, aliased from python + * test suite: Add Python module completion test case + * python: Fix traceback avoidance on module completion error + * openssl: Parse available digests from dgst -h + * openssl: Add sha2 commands + * gm: New completion, commands only for now + * (test suite): Test screen -T completions + * (test suite): Set TERM to dumb, not dummy + * Revert "(test suite): Fix alias and cd cursor position tests" + * mplayer: Remove duplicate *.m4a and *.m4v associations + * mplayer, xine, etc: Associate *.mp4a and *.mp4v + * xine etc: Fix *.m4a association + * bind: Add option and argument (non-)completions + * _user_at_host: Set nospace only when completing username part + * _user_at_host: Append @ suffix to username part completions + * man: Don't check OSTYPE or GNU userland, just enable on all + systems + * (test suite): Set dcop result to untested if dcop server is not + running + * (test suite): Don't insist on loading all completions dynamically + * _configured_interfaces: Parse from /etc/network/interfaces.d/* on + Debian + * py.test: New completion + * oowriter: Associate with *.pdf + * Don't define BASH_COMPLETION_COMPAT_DIR + * ri: Add option and arg completions + * (test suite): Add our own dummy ri test fixture + * (test suite): Info test needs docs, don't exclude from CentOS + * (test suite): Fix CentOS 6 tcllib setup + * (test suite): Simplify renice test, fix with only one completion + * (test suite): Don't assume configured interfaces in CI setups + * Don't offer * as configured interface when there are none + * (test suite): Add basic CentOS 6 container for bash 4.1 coverage + * (test suite): Ignore runtime loaded env function changes + * (test suite): Add mailman bin dir to PATH for arch test + * arch: Parse options from --help + * (test suite): Load tested completions dynamically + * (test suite): Accept non-whitespace single word in + assert_complete_any + * (test suite): Avoid interference from user and system dirs (#87) + * (test suite): Install some things N/A in ubuntu14 to fedoradev + * (test suite): Add unrar to ubuntu14 container + * (test suite): Fix alias and cd cursor position tests + * (test suite): Add basic alpine test case + * alpine: Parse opts from -h output, add some opt arg completions + * (test suite): Install jshint globally in ubuntu14 + * (test suite): Add mailman bin dir to PATH for some mailman tools + * (test suite): Install jshint to ubuntu14 container with npm + * unshunt: Parse options from --help + * (test suite): Test lsof on ubuntu14 + * (test suite): Add basic hping3 test case + * (test suite): Add our ./configure to PATH to test it, test opts + * (test suite): Add bunch of packages to ubuntu14 container + * (test suite): Ensure /usr/(local/)games is in $PATH + * (test suite): Fix perl -d* test cases with no Devel::* installed + * (test suite): curl has lots of options, add more test prefix + * (test suite): Fix tar test case for ones having --owner-map + * (test suite): Unsupport various kill, renice cases if ps is N/A + * (test suite): Make chkconfig test behave better in container + * (test suite): Don't assume mounted filesystems in quota* tests + * newlist: Parse options from --help, add some arg non-completions + * (test suite): Delete trailing whitespace + * (test suite): Don't assume lists set up in newlist test cases + * (docker): Pull in missing fedoradev xvfb-run which dependency + * mr: Avoid stderr trash and test suite failure if man is N/A + * (test suite): Fix mmsitepass completion test + * tshark -G: Avoid stderr noise when running as superuser + * (docker): Run completion tests with xvfb-run, e.g. for gkrellm + * ssh-keygen: Make option parsing work with OpenSSH < 7 + * synclient, udevadm: Avoid use of posix char classes for awk + * test suite: Add WIP Fedora dev config + * Travis: Switch tests to docker, update to Ubuntu 14 + * xv: Associate with *.j2c, *.j2k, *.jp2, *.jpf, and *.jpg2 (Debian: + #859774) + * eog: Associate with *.j2c and *.jpg2 + * Bump copyright years + * xine etc: Associate uppercase *.WM[AV] + * mplayer: Associate *.weba (#112) + * xine etc: Associate *.webm and *.weba (#112) + + -- Ville Skyttä <ville.skytta@iki.fi> Tue, 27 Jun 2017 12:29:33 +0300 + +bash-completion (2.5) + + [ BartDeWaal ] + * Support for python gui source files (#91) + + [ Ben Webber ] + * mr: New completion + + [ Christian Kujau ] + * ssh-keygen: support ed25519 keys (#79) + + [ Dara Adib ] + * Add sidedoor to _ssh() completion (#106) + + [ George Kola ] + * .ipa is just a zip file and we should let unzip handle it (#71) + + [ Miroslav Å ustek ] + * ant: parse targets in imported buildfiles (#84) + + [ Reuben Thomas ] + * Add more tests for ccache + * ccache: fix completing compiler's flags + + [ Ville Skyttä ] + * test suite: Add java/javac non-completion fixture + * javac: Complete -cp like -classpath + * travis: Skip bluez and nis for now due to post-install script + issues + * test/config/*: Delete trailing whitespace + * (test suite): Avoid loading user's ~/.bash_completion, fixes #87 + * ip: Recognize a as alias for address and l for link + * ip: Recognize address in addition to addr + * mr: Disable "clean" test case, command N/A before mr 1.20141023 + * ssh-keygen: Parse switches with _parse_usage, not _parse_help + * mplayer: Associate with *.mjpg, *.mjpeg (Debian: #837779) + * dd: Sync completions with coreutils 8.24 + * travis: Add mr + * perl: Remove full path to cat in PERLDOC_PAGER call + * deja-dup: New completion + * CONTRIBUTING: Reorder sections + * *: Move indentation settings to .editorconfig + * make: Declare _make_target_extract_script like other functions + * Travis: zopfli is AWOL? + * *: Whitespace fixes + + [ Zearin ] + * Minor edits to README.md (mostly formatting) (#110) + + [ l3nticular ] + * Fix bug in 'make' completion when using BSD sed (#108) + + [ osu ] + * Add support for Include in ssh config (#70) (#80) + + -- Ville Skyttä <ville.skytta@iki.fi> Sat, 04 Feb 2017 18:07:27 +0200 + +bash-completion (2.4) + + [ Arash Esbati ] + * xetex, xelatex, luatex, lualatex: Associate with tex files + + [ Gene Pavlovsky ] + * Use shell globbing instead of ls to source files in compat dir + + [ Grisha Levit ] + * Support completing array variables and expansions + * Add tests for declare/typeset + * Better handling of typeset/declare + + [ Kylie McClain ] + * tar: silence --version's stderr output + + [ Paul M. Lambert ] + * Support pod document files for perldoc (#39) + + [ Richard Alpe ] + * tipc: fix missing last char in link name completion + * tipc: handle complete words without trailing space + * tipc: suppress tipc error messages + * tipc: use double brackets in if conditions + * tipc: make loop variables local + * tipc: remove unnecessary return values + * tipc: readd call to complete command + * tipc: use cur variable for flag completion + * tipc: add command prefix to link sed + * tipc: remove unnecessary function _tipc_get_val() + * tipc: use bash here string instead of echo + * tipc: merge functions into main + * tipc: add test framework + * tipc: add tipc completions + + [ Ville Skyttä ] + * Release 2.4 + * rpm: Offer --filetriggers with -q + * javadoc: Add bunch of option arg (non)completions + * lrzip: Add -m arg noncompletion + * pkg-get: Don't use hyphens in function names + * jarsigner: Add some option arg (non)completions + * pkg-get,pkgrm: Drop unnecessary _have calls + * *: Trivial cleanups + * *: Remove redundant return 0's + * pypy*: Add basic --jit arg completion + * pypy3: Alias to python + * hcitool,svcadm,tar: Spelling fixes + * Travis: Install more packages for more test coverage + * (test suite): Pass assert_complete_any for exact/only given arg + completed + * tipc: Invoke ls with "command" + * tipc: Indentation fix + * (test suite): Fix fallout from + fec077d555f112b9f455c45860f90a3b47392fcf + * (test suite): Remove Bash::Completion.3pm.gz from git, create on + the fly + * (test suite): Remove test/fixtures/_filedir/a"b from git, create + on the fly + * CONTRIBUTING: Note patch preferences if not using GitHub pull + requests + * python: Support -Q and -W arg completion without space + * apache2ctl, aspell, make: Don't hardcode completion generator + command + * mysql: Avoid --default-character-set error with failglob, fixes + #46 + * test suite: Add perldoc module+pod completion test case + * perl: Remove some duplicated code + * pushd: Use _cd completion for CDPATH support, closes #38 + * test suite: Add basic pushd test case + * abook: Parse long options from command including full path + * pyvenv: New completion + * chroot: New (generic long options) completion, see #38 + * Travis: First steps toward testing with OS X + * test suite: Add bashcomp_bash env var for better control on tested + bash + * aptitude: List packages using _apt_cache_packages, fixes #33 + * vncviewer: Cleanup shopt use, drop an eval + * make: Avoid a grep + * rpm: Fix --whatenhances arg completion + * aspell, minicom, mysql: Replace use of ls with printf + * cppcheck: Complete filenames too for --platform + * man: Prioritize MANPATH, simplify, add fallback e.g. for busybox, + fixes #28 + * aclocal: Install completion for 1.14 and 1.15, fixes #25 + * mpv: Don't install symlink for it, fixes #24 + * test suite: Add function and declare test cases + * CONTRIBUTING: Highlight request for test cases + + [ Wayne Scott ] + * The BitKeeper completion used the wrong set of commands + + -- Ville Skyttä <ville.skytta@iki.fi> Fri, 12 Aug 2016 22:43:27 +0300 + +bash-completion (2.3) + + [ Daniel Milde ] + * Completion for python zip archives + + [ Liuhua Wang ] + * lvm: pvcreate should be able to use all block devcices + * lvm: fix all commands that should get all PVs + + [ Ville Skyttä ] + * Release 2.3 + * make-changelog: Don't output "Merge pull request" entries + * make: Use <<< instead of printf + pipe + * gnokii: Use <<< instead of echo + pipe + * *: Use [:blank:] instead of $'\t ' tricks where appropriate, fixes + #19 + * test suite: Fix abook test case + * test suite: Don't insist on property completions if synclient -l + fails + * test suite: Tolerate "See 'man feh'" feh --help output + * test suite: Fix tar failure caused by previous tar change + * tar: Detect GNU/other from --version only once per session + * tar: Remove unused variable + * tar: Fix GNU tar help output parsing regex, fixes #15 + * test suite: Add tar xvf filename test case + * tar: Don't write to /tmp/jetel + * python: Simplify code + * python: Complete all files also after -m + * python: Don't offer options after -c + * python: Complete all files only if -c is before current word + * test suite: Add some python test cases + * unzip, zipinfo: Complete on *.pyz + * travis: configure and run completions syntax check + * make check: Test syntax of all completion files + * CONTRIBUTING.md: Ask for test cases + + -- Ville Skyttä <ville.skytta@iki.fi> Mon, 28 Mar 2016 18:32:47 +0300 + +bash-completion (2.2) + + [ Barry Warsaw ] + * _init_completion: Handle cword < 0 (LP: #1289597) + + [ Damien Nadé ] + * (testsuite) Use 'set' command posix behaviour when saving env + (Alioth: #314720) + * Added test/site.{bak,exp} to .gitignore + * _parse_help: Fix failglob failures (Alioth: #314707) + * _lvm: using a single-pattern case and invoking function according + to words[1] + * lvm: _lvm_count_args parameter must be quoted in order to failglob + not to complain + * gendiff: Quoting suffix pattern to avoid triggering failglob + + [ Dams Nadé ] + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (Alioth: + #314709) + * Quote unset array element to avoid globbing interference (Alioth: + #314708) + + [ David Paleino ] + * Refactor bts and uscan, since they use common functions + * uscan: New completion, thanks to Federico Ceratto + * bts: New completion, thanks to Federico Ceratto. + + [ Guillaume Rousse ] + * complete on freerdp-specific known hosts list + * nmcli completion was integrated upstream + + [ Igor Murzov ] + * isql: Fix failglob failure + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (take 2) + (Alioth: #314709) + * (testsuite): move testing of _linux_fstab() to umount.exp + * umount: Fix mount points escaping/unescaping with Bash-4.3 + * slapt-src: Handle --config=FILE option properly + * sbopkg, slapt-{get,src}: expand tilde in config file name + * slapt-{get,src}: Fix issue with sed not being able to handle some + characters + * slapt-src: split options from their arguments + * Quote _filedir arguments when appropriate to prevent failglob + failures + * psql: Tell psql to not load .psqlrc as it may change output format + (Alioth: #314636) + * testsuite: Add basic tests for portsnap and freebsd-update + * mplayer: -dvd-devices takes dvd devices, dirs and .iso files as + argument + * 7z: Improve completion + * f77, f95: Use the same completion as for g77, g95 if they are + links to gfortran + * aptitude: safe-upgrade accepts package name as parameters (Alioth: + #313638, Debian: 673235) + * _longopt: Run commands in C locale. + * make: Use only posix basic regexps with sed (Alioth: #314345) + * cppcheck: Add new --enable option argument and --library argument + completion + * dpkg: Suppress unwanted error messages (Debian: #706502) + * perl: -d/-dt option argument is optional (Alioth: #314242) + * Add config for cmake to bash-completion. + * kcov: Add new sort types, complete --replace-src-path arguments + * feh: Add new sort type + + [ Mathieu Parent ] + * Puppet: describe: update options list, accordind to 'puppet help + describe' + * Puppet: cert: update options list, accordind to 'puppet help cert' + * Puppet: apply: update options list, accordind to 'puppet help + apply' + * Puppet: agent: update options list, accordind to 'puppet help + agent' + * Puppet: puppet parser support + * Puppet: puppet -* doesn't imply 'puppet apply' + * Puppet: use puppet terminology + + [ Matthew Gamble ] + * Modify all usages of 'sed' to be run with command bash builtin + * Use command built-in to run sed to avoid any custom aliases + + [ Matthieu Crapet ] + * man: Use -w instead of --path + + [ Michael Gold ] + * profile.d: Avoid some warnings from shells in "nounset" mode + (Debian: #776160) + + [ Miroslav Lichvar ] + * chronyc: Update help text parsing + * chronyc: Add missing subcommands + * chronyc: Add -6 option + + [ Nevo Hed ] + * minicom: Recognize user ~/.minirc.* as config files + + [ Ondrej Oprala ] + * __get_cword: avoid $index < 0 (Alioth: #315107) + + [ Patrick Monnerat ] + * rpmbuild: Complete *.spec on --clean (RedHat: #1132959) + + [ Pavel Raiskup ] + * tar: rework the completion completely + + [ Peter Cordes ] + * upstart support for service completion + + [ Peter Dave Hello ] + * freebsd-update: New completion. + * portsnap: New completion. + + [ Peter Wu ] + * modprobe: fix params with multi-line descriptions + * gdb: support --args style completion (Alioth: #314664) + + [ Rainer Müller ] + * make: Fix basic regex for portability (Alioth: #314345) + + [ Raphaël Droz ] + * gnokii: New completion + + [ Rune Schjellerup Philosof (Olberd) ] + * dpkg: Add support in dpkg completion for .ddeb (LP: #568404) + + [ Shaun McCance ] + * xmllint, xmlwf, xsltproc: Complete on Mallard *.page files + + [ Stefano Rivera ] + * pypy: New completion identical to python (Alioth: #314501) + + [ Thilo Six ] + * Use more straightforward way to check bash version + * _mac_addresses: Use explicit C locale for ifconfig (Debian: + #704832). + + [ Tristan Wibberley ] + * make: Don't pick up variables when makefile is reloaded + * make: Offer hidden targets when it is clear that the user is + trying to complete one of them + * make: Fix detection of intermediate targets where make has changed + its database whitespace + * make: Add __BASH_MAKE_COMPLETION__ variable + * make: completion shouldn't be confused by the output of $(info + confuse: make) + + [ Uwe Kleine-König ] + * Don't complete hostnames found after Hostname in ~/.ssh/config + + [ Ville Skyttä ] + * Release 2.2 + * README.md: Note autoreconf need only in unprepared tarball + * make-changelog.py: Set myself in footer + * make-changelog.py: Fix footer line output + * make-changelog.py: flake8 fixes + * make-changelog.py: Make work with Python 3 + * README.md: More markdown tweaks + * README.md: Markdown tweaks + * zopflipng: New completion + * README.md: Not need for autoreconf, fixes #11 + * README: Expand troubleshooting section somewhat + * Merge pull request #9 from shaunix/master + * ssh: Extract duplicate code to _ssh_configfile + * Remove various comments related to bash versions we don't support + * travis: Install more packages for [xyz]* test coverage + * travis: Install more packages for [stuvw]* test coverage + * travis: Install more packages for [qr]* test coverage + * travis: Install more packages for [op]* test coverage + * travis: Install more packages for m* test coverage + * travis: Install more packages for [jkl]* test coverage + * Merge pull request #7 from ukleinek/master + * indent: Remove generic long option completion + * Update copyright year + * travis: Install more packages for [hi]* test coverage + * travis: Install more packages for [fg]* test coverage + * mysql: Fix --default-character-set completion with mariadb + * mysql, puppet: sed portability fixes + * gnokii, minicom: Use grep through "command" + * lint: Check for sed without "command" + * Merge pull request #2 from djmattyg007/avoid_sed_alias + * travis: Install more packages for [de]* test coverage + * travis: Install more packages for c* test coverage + * travis: Add note about (currently) N/A packages + * test suite: Mark unsupported look test case as such, not + unresolved + * test suite: Use unsupported instead of xfail for modinfo/modprobe + cases + * travis: Install more packages for [0-9][ab]* test coverage + * travis: Run tests with --all to get some more useful output + * test suite: Fix ssh partial hostname completion test + * README: Split contributing to separate CONTRIBUTING doc + * README: Convert to markdown + * Drop references to bash-completion-devel@lists.alioth.debian.org + * build system: Switch to xz compressed tarball + * aclocal, automake: Install for versioned 1.14 and 1.15 executables + * Update URLs and various instructions to GitHub + * README: Update POSIX spec link + * travis: Avoid Travis default ri, use distro one instead + * test suite: Make apt-get test less sensitive to available commands + * test suite: Output tool log on failure in CI + * Set up Travis + * test suite: Expect failure in modinfo/modprobe if there are no + modules + * test suite: Fix ssh-copy-id test on old setups with no identities + * cppcheck: Add native to --platform completions + * ssh: Avoid completing commands before hostname + * chronyc: Parse command args from help output + * chronyc: Wrap long lines + * Load completions also from $XDG_DATA_DIRS (RedHat: #1264094) + * (testsuite) Ignore files generated by complete-ant-cmd.pl + * scp, sftp: Complete -S on commands + * scp, sftp: Fix querying ssh options + * sftp: Add -l arg non-completion + * ssh-copy-id: Offer only *.pub to -i + * mpv: Remove mplayer-aliased completion + * __load_completion: New function, use in _completion_loader and + _xfunc + * modplug*: Associate *.oct and *.okt + * rpm: Add --whatenhances/recommends/suggests/supplements and + --recommends/supplements completions + * pgrep, pidof, pkill, pwdx, vmstat: Add support for procps-ng + * pdftotext: New completion + * checksec: New completion + * ssh: Complete HostbasedKeyTypes,HostKeyAlgorithms,KexAlgorithms + values + * ssh: Query ciphers and macs from ssh before hardcoded fallback + * ssh: Add -Q argument completion + * sysctl: Return early on --help, --version + * sysctl: Try parsing options from help before usage + * Document how to avoid command_not_found_handler interference + * eog: Complete on *.ppm (RedHat: #1090481) + * tar: Plug $line var leak + * tar: Style tweaks + * (testsuite) Add required "empty" dir for tar + * bsdtar, tar: Remove symlinks from git, have make create them + * jshint: New completion + * gnokii: Include and install it + * gnokii: Fix completions of options that are prefixes for others + * gnokii: Drop dead code + * (testsuite): Add basic gnokii test case + * gnokii: Various minor and cosmetic fixes + * _filedir: Avoid some unnecessary work with -d + * _filedir: Remove unused variable + * _filedir: Fix overquoted argument to compgen -d (RedHat: #1171396) + * 2015 + * Load user completions from $BASH_COMPLETION_USER_DIR/completions + * Revert "README: Don't hardcode /etc in cmake fallback dir" + * README: Don't hardcode /etc in cmake fallback dir + * README: Add cmake usage example + * README: Add autotools and cmake tips + * Drop reference to no longer used sysconf_DATA + * synclient: New completion + * tune2fs: Add missing return in -M arg completion + * reptyr: Rename file to _reptyr to avoid conflict with upstreamed + completion + * cppcheck: Option argument (non-)completion update + * dropuser: New completion + * createuser: New completion + * createdb, dropdb: Drop -o default, it does not appear to do + anything good here + * tshark: Simplify cut usage + * mcrypt: Simplify -m arg completion + * (testsuite): Add mcrypt -a and -m argument completion tests + * strings: Fix -T/--target arg completion with non-English locale + * chrome, firefox etc: Complete on *.pdf + * ccache: Add -o/--set-config arg name completion + * gphoto2: Replace tail with awk + * *: Invoke command to be completed, not its basename + * gphoto2: Fix split argument handing, and colon treatment in --port + args + * _completion_loader: Protect compgen from -* leakage (Debian: + #769399) + * Actually install the lz4 completion + * _pnames: Add -s for producing (possibly) truncated names (RedHat: + #744406) + * (testsuite) Add cd in dir without subdirs or CDPATH test case + * Protect various compgen invocations from -* leakage (Debian: + #766163) + * pigz, unpigz: Handle *.zz + * _completion_loader: Set empty command to _EmptycmD_ for cross + version compat + * Comment update + * rpmbuild: Complete *.spec on --nobuild + * mplayer, *xine: Complete on *.mts (Debian: #759219) + * ant: Support buildfile set in $ANT_ARGS (Alioth: #314735) + * (testsuite) Add ant -f <buildfile> test case + * ant: Don't offer more completions after options that exit + * 7z, adb: Trivial cleanups + * python(3): Add -X argument non-completion + * xsltproc. TODO fix for previous commit + * xmllint, xmlwf, xsltproc: Complete on *.dbk and *.docbook (Alioth: + #314770) + * xz: Complete -T/--threads argument + * (testsuite) Save shell variables when saving env (Alioth: #314720) + * adb: New completion + * modprobe: Try parsing help before using hardcoding option list + * (testsuite) Add vgcreate test case for _lvm_count_args with + failglob on + * _filedir_xspec: Fix with failglob on + * Various mostly array element unsetting fixes under failglob + * __reassemble_comp_words_by_ref: Make work with failglob on + (Alioth: #312741) + * _services: README in sysv init dir is not a service + * mpv: New completion alias + adjustments for mplayer (Debian: + #749115) + * (testsuite) Add puppet subcommand option test case + * puppet: Recognize some short options + * puppet: Parse most subcommand options from "help subcommand" + output + * puppet: Exit early on -h|-V|--version in addition to --help + * hostname: New completion + * nslookup: complete on hosts (Alioth: #314673) + * eog: Complete on *.pgm (RedHat: #1090481) + * pngfix: New completion + * qemu: Fix -balloon arg completion + * qemu: Apply completion to qemu-kvm/-system-i386/-system-x86_64 too + * xrandr: Use the invoked command internally, not hardcoded "xrandr" + * xrandr: Add (some) --setprovider* arg completion support + * profile.d: Don't return from a sourced script (Debian: #741657) + * FAQ: Clarify that we mean the bash man page for M-/ + * (testsuite) Avoid complete-ant-cmd.pl errors with our build.xml + * ri: Fix class completion with ri >= 3. + * ri: Fix colon handling in class completion. + * flake8: New completion + * pyflakes: New completion + * cal,chfn,chsh,dmesg,eject,hexdump,look,newgrp,renice,runuser,su,wr + ite: Deprecate on Linux in favor of util-linux ones (Debian: + #737672) + * testsuite: Add basic newgrp test case + * testsuite: Add basic test cases for deprecated completions + * _*: Install our deprecated completions too, try loading them + secondarily + * hwclock,ionice,rtcwake: Deprecate in favor of util-linux ones + (Debian: #737672) + * ssh-keygen: New completion + * Bump copyright years to 2014. + * jpegoptim: New completion + * ip: Add some addr, addrlabel, and route arg completions + * aptitude, dpkg: Replace some grep+cuts with awk + * gcc, lintian, make, pkgadd, slackpkg: grep -> "command grep" + (Debian: #734095) + * lintian: Replace some grep+cuts with awk + * (testsuite) Check for grep and ls invoked without "command", see + README + * lz4: New completion. + * optipng: New completion. + * cppcheck: Include - in --file-list completions. + * (testsuite): Limit wtf completions to A* to keep expect happier. + * wtf: Look for acronym db from /usr/share/games/bsdgames/acronyms + too. + * wtf: Don't offer -f if it was already specified. + * wtf: Hush stderr when db file doesn't exist. + * appdata-validate: New completion. + * timeout: New completion. + * _known_hosts_real: Exclude %h HostName entries (RedHat: #1015935). + * cc, c++: Check path to binary when finding out if it's gcc + (Alioth: #314417). + * cc, c++: Install minimal completion for non-gcc ones (Alioth: + #314417). + * abook, kldunload: Pre-expand \t instead of relying on sed + supporting it. + * dict: Trivial regex cleanup. + * _known_hosts_real: Pre-expand \t instead of relying on sed + supporting it (Alioth: #314393). + * zopfli: New completion. + * bzip2, gzip, lzma: Cleanups. + * Cosmetics. + * export, _variables: Do TZ= completion (Redhat: #994646). + * 2to3: New completion. + * file-roller: Reuse unzip's xspec. + * 7z: New completion. + * hcitool, rfcomm, ciptool, hciconfig: Don't leak $args. + * perl: Fix -dt: completion. + * perl*: Fix handling of relative paths in @INC. + * wget: Add --accept-regex/--reject-regex/--regex-type arg + (non)completions. + * wget: Drop incorrect -nv arg completion. + * wget: Stop completing after --help/--version. + * Clean up/compact various globs. + * cvs: Fix checkout -j non-completion. + * sh: Complete script arguments with all filenames (Alioth: + #314226). + * nmcli: Deprecate our completion, upstream has one in 0.9.8.0. + * Revert "nmcli completion was integrated upstream" + * Use == instead of =. + * cvs rm: Don't filter existing files with -f (RedHat: #949479). + * aclocal, automake: Install for *-1.10, *-1.12, and *-1.13 too. + + -- Ville Skyttä <ville.skytta@iki.fi> Thu, 03 Mar 2016 17:22:50 +0200 + +bash-completion (2.1) + + [ AllKind ] + * Fix __ltrim_colon_completions() fail on parameter (\$1) containing + a glob. + + [ Andreas Müller ] + * completions/Makefile.am: symlinks depends on $(DATA) to avoid race + conditions + + [ Christian von Roques ] + * Fix __reassemble_comp_words_by_ref for $COMP_CWORD == ${#COMP_WORDS[@]} + + [ David Paleino ] + * Fix helper script to create changelogs + + [ Guillaume Rousse ] + * New completions: nmcli, gphoto2 + * Improved completions: + - dsniff: add -p option completion + - dsniff: fix interface completion + + + [ Igor Murzov ] + * _command_offset: Restore compopts properly (Alioth: #313890) + * _parse_help, _parse_usage: Run commands in C locale. + * New completions: wget, zathura + * Improved completions: + - cppcheck: Add new standards to --std option. + - evince: Evince supports opening .pdf.xz files (Alioth: #313739). + - feh: Add new options introduced in feh-2.7. + - feh: Fix list of background styles. + - fusermount: Complete curlftpfs-mounts for "fusermount -u" (Debian: + #685377) + - kcov: Add new sort types (introduced in kcov-9). + - kcov: Complete arguments of --limits option. + - lvm: Fix typo in option name: s/continguous/contiguous/. + - make: Do not append space if target is a filepath. + - mount: Fix parsing /etc/fstab on *BSD. + - mount.linux: Add some new mount options intoduced in Linux 3.5 and 3.7 + - mount.linux: Add options completion for nfs and davfs. + - mount.linux: Clean up mount options, remove duplicates. + - mplayer: Add opus to the list of supported formats. + - mplayer: Add -subcp argument completion. + - opera: Handle options. + - slackpkg, slapt-get: Update the list of package sets. + - tar: Fix detection if the $prev is a tar file. + - valgrind: Add --soname-synonyms option arguments completion. + * Testsuite: + - _filedir: Remove the cruft from the a\$b->h unit test (Alioth: #313480) + + [ Jeroen Hoek ] + * Improved completions: + - unzip: Add support for OpenDocument formats. + + [ Ken Sharp ] + * Improved completions: + - wine: add .msi completion + + [ Martin Ueding ] + * Stylistic cleanup + + [ Tristan Wibberley ] + * Improved completions: + - make: incremental completion for make with compact display + - make: convert make completion to use smarter parser + + [ Ville Skyttä ] + * Avoid sourcing dirs in completion loader to avoid fd leaks (RedHat: #903540) + * Ignore colormake symlink. + * Line continuation, whitespace, and compgen -W ... -- "$cur" + quoting cleanups. + * _available_interfaces: Try with "ip link" if ifconfig is not available. + * _ip_addresses: Try with "ip addr" if ifconfig is not available. + * _known_hosts_real: Filter ruptime stdout error spewage (Alioth: #313893). + * _mac_addresses: Try local interfaces with "ip link" if ifconfig not + available. + * _mac_addresses: Try ARP cache with "ip neigh" if arp is not available. + * _mac_addresses: Fix with net-tools' ifconfig that outputs ether, not HWaddr. + * New completions: chronyc, eject, eog, file-roller, hexdump, interdiff, lua, + luac, luseradd, luserdel, lusermod, mussh, nc, ngrep, patch, pydoc, + pyflakes, pylint, ss, strings, tshark, wsimport, xxd + * Improved completions: + - acpi, chpasswd, dmesg, gkrellm, groupmems, hwclock, lastlog, pwd, vipw: + Complete options even without "-" given. + - arpspoof, dsniff, ether-wake, nmap: Offer active interfaces only. + - clzip, pdlzip, plzip: New lzip alias completions. + - colormake: New make alias completion (LP: #743208, Debian: #682557) + - cpio: Recognize pass thru when -p is bundled w/other options + (RedHat: #912113). + - cppcheck: Add --language/-x argument completion. + - cppcheck: Complete --include= with filenames. + - dnsspoof, filesnarf, macof, sshow, tcpkill, tcpnice, urlsnarf: Fix -i + completion. + - genisoimage: Use _parse_help instead of hardcoding options, add basic test + case. + - groupmems: Add -R/--root arg completion. + - hexdump: Actually install for hd as well. + - host: Complete with known hosts. + - ip: Improve addr show and link show completions. + - ip: Remove some stale TODOs. + - jar: Reuse unzip's xspec (RedHat: #928253). + - koji: Complete on build targets when --target is given to wait-repo. + - lv{create,resize,extend}, vg{create,reduce,extend,split}: Fix variable + leaks. + - lvm: Add _lvm prefix to helper functions. + - lvm: Take option args into account when counting args (RedHat: #860510). + - lvm volumes: Complete on /dev/mapper/* (RedHat: #851787). + - lzip: Do not append space after equal sign in long options. + - make: Convert internal variable names to lowercase, indentation fix. + - make: Don't leak $mode. + - make: Make work in POSIX mode. + - man: Add support for .lz man pages (RedHat: #839310). + - man: Don't expand man page extensions too early. + - man: Fix -P/--pager full path arg completion. + - modinfo: Use ,, for lowercasing instead of tr in a subshell. + - modprobe: Don't suggest installing already installed modules. + - ncftp: Add option completion. + - pkg-config: Try to complete --variable= if package name is already given. + - pydoc: Complete on keywords and topics. + - python, pydoc: Add module completion. + - scp: Treat strings with slash before colon or starting with [.~] as local. + - ssh: Add some -o and related arg completions. + - ssh: Add -O argument completion (Debian: #680652). + - tar: Don't take -I to mean bzip2. + - tar: Fix completing files inside *.tlz when J is explicitly given. + - tar: Simplify bzip patterns. + - tar: Support *.tar.lz (Debian: #703599). + - tar: Recognize taz and tb2 as compressed tarballs. + - tcpdump: Fix -z full path arg completion. + - unzip/zipinfo: Associate with more StarOffice extensions. + - useradd, userdel, usermod: Add -R/--root arg completion. + - useradd, usermod: Support comma separated -G/--groups arg completion. + - useradd: Fix -k, -K, and --home-dir argument completions. + - userdel: Add -h/--help non-completion. + - valgrind: Fix full path <command> arg completion. + - vgcreate: Add missing symlink. + - vipw: Add -R/--root arg completion. + - vpnc: Add bunch of option arg (non)completions. + - vpnc: Use _parse_help instead of hardcoding options, add basic test case. + - wget: Use == instead of =. + - wine: Fix extension glob to work on its own. + - wol: Try "ip addr" before ifconfig for finding out broadcast addresses. + - xrandr: Add bunch of option arg non-completions. + - xrandr: Use _parse_help. + - xrandr --mode: Clean up one awk call. + - xrandr: Avoid --mode completion error when --output is not given. + - xrandr: Don't leak $i when completing --mode. + * Deprecated completions: + - udevadm: one is shipped in systemd >= 196 (RedHat: #919246). + * Testsuite: + - Make pydoc test more likely to work with our limited expect buffer size. + - Fix pwd unit test + + [ Yann Rouillard ] + * New completions: pkgutil, pkgrm, pkgadd, pkg-get, svcadm. + + [ wonder.mice ] + * Fixed tilde expanding in _filedir_xspec + + -- David Paleino <d.paleino@gmail.com> Fri, 05 Apr 2013 12:05:15 +0200 + +bash-completion (2.0) + + [ Anthony Ramine ] + * Properly declare 'symlinks' dependencies + + [ David Paleino ] + * apt-get: add 'changelog' to completed commands + + [ Guillaume Rousse ] + * Add xz compression extension for kernel modules + + [ Igor Murzov ] + * sudo: Handle options (Alioth: #311414). + * sudoedit: New completion. + * _command_offset: Properly quote arguments of eval (Alioth: + #313499). + * mount.linux: Add some new mount options intoduced in Linux 3.0-3.2 + * _modules: Ignore error messages. + * modprobe, modinfo, insmod: Move modprobe and modinfo completions + to their own files. + * sbopkg: Use _parse_help. + * sbopkg, slackpkg, slapt-{get,src}: Use shorter form of the check + if file exists. + * _filedir: Properly quote paths to avoid unexpected expansion. + * su: Add linux-specific completion + * insmod, modprobe: Don't hardcode path to modinfo (Alioth: #313569) + * man: --path option is supported on Darwin (Alioth: #313584) + * man: Move variable declaration to the right place. + * feh: Update option argument completions. + * fbi, feh: Complete more supported file formats. + * fbgs: Add new options introduced in fbida-2.09. + * cppcheck: Complete new --relative-paths option arguments + * _expand: Suppress unwanted bash error messages (Alioth: #313497) + + [ Itaï BEN YAACOV ] + * scp: Recognise symlinks to directories as directories (Debian: + #666055). + + [ Jonathan Nieder ] + * ri: Rename ri_get_methods helper to add leading underscore + + [ Ville Skyttä ] + * rmmod: Add option completions. + * testsuite/generate: Generate less linefeeds. + * insmod: Install for insmod.static too. + * mplayer: Add -monitoraspect arg completion. + * mplayer: Add generic handling of options that take arguments. + * testsuite: Fix spurious modinfo and modprobe test failures on + systems that have /lib and /lib64 dirs. + * pigz: Add -p/--processes arg completion. + * testsuite: Add basic su test case. + * su: Fix long option handling. + * su: Add --session-command arg completion. + * su: Complete -s/--shell with shells instead of all files. + * lyx: Remove simple completion, upstream has more complete one + (Debian: #662203) + * testsuite/generate: Tweak linefeeds. + * make: Add generic variable completion. + * man: Recognize 3gl as man page filename extension -- at least Mesa + uses it. + * _realcommand: Try greadlink before readlink (Alioth: #313659). + * Comment spelling fix. + * qiv: Add *.svg. + * xmllint: Add *.svgz. + * autotools: Use MKDIR_P instead of mkdir_p (Alioth: #313671). + * lbzip2: Add -n argument completion. + * *_tilde*: Escape tilde in [[ $1 == \~* ]] tests (RedHat: #817902). + * New completions: + - acpi, hwclock, pwd, ssh-add, vmstat + + [ Sung Pae ] + * Workaround bash bug that fails to complete <, > + + -- David Paleino <d.paleino@gmail.com> Sun, 17 Jun 2012 20:01:36 +0200 + +bash-completion (1.99) + + * Hopefully the last 2.0 preview. + + [ David Paleino ] + * Correctly list purgeable packages for dpkg --listfiles and dpkg + --purge (Debian: #647684) + * Fix bash_completion paths in README (Debian: #647941) + + [ Florian Hubold ] + * xv: Add *.eps and *.ps to filename completions (Alioth: #313477) + + [ Igor Murzov ] + * Add and use _sysvdirs() function that sets correct SysV init + directory. + * cppcheck: Add new options introduced in cppcheck-1.52. + * cppcheck: Several ids separated by commas can be given for + --enable=. + * _known_hosts_real: Add some quotes (Alioth #313158) + * Merge completions/service into the bash_completion script. + * _modules: Follow symlinks in /lib/modules/$(uname -r) (Alioth: + #313461) + * mount, umount: Add linux-specific completions. + * mount: Don't suggest short options. + * pidof: Don't check OS type (Alioth #311403) + * removepkg: Make it possible to complete filenames. + * umount: Fix for completion of relative paths. + * upgradepkg: Support oldpackage%newpackage notation. + * wine: Complete all files after an .exe (Alioth #313131) + * New completions: + - htop, nethogs. + + [ Jan Kratochvil ] + * rpm: Treat -r as --root (RedHat: #759224). + + [ Raphaël Droz ] + * Added a word about compopt -o nospace in styleguide.txt. + * _ip_addresses: Make it locale agnostic. + + [ Ville Skyttä ] + * cc, c++: Install gcc completion if compiler looks like GCC + (Alioth: #311408). + * cppcheck: Offer header filename completions too. + * curl: Add bunch of new option argument completions. + * dequote: Use printf instead of echo (Alioth: #312163). + * dict: Speed up word completion with common use cases and large + word lists. + * dmesg: Adapt to versions returning long options. + * Document $split && return. + * _filedir, _tilde: Ignore compopt stderr for direct invocations in + unit tests. + * Include doc/ in dist tarball. + * _known_hosts_real: Handle more than two hostnames per known hosts + line (Debian: #647352). + * _known_hosts_real: Include hosts reported by ruptime (Alioth: + #313308). + * _known_hosts_real: Support > 1 files per *KnownHostsFile line + (Debian: #650514). + * lintian: Use <<< instead of echo and a pipe (Alioth: #312163). + * lrzip: -T no longer takes an argument since version 0.570. + * _mac_addresses: Grab addresses from FreeBSD's ifconfig -a output + too. + * make: Add -j/--jobs completion, complete up to number of CPUs * 2. + * _muttconffiles: Use printf instead of echo (Alioth: #312163). + * _parse_help, _parse_usage: If first arg is "-", read from stdin. + * rpm: Add --delsign completion, don't suggest --resign (identical + to --addsign). + * _variables: New function split from _init_completion. + * vi and friends: Fix /etc/ld.so.conf.d/* completion (Alioth: + #312409). + * New completions: + - plague-client, desktop-file-validate, valgrind, ccache, iperf, + koji, lzip, udevadm. + + -- David Paleino <d.paleino@gmail.com> Sat, 07 Jan 2012 23:52:36 +0100 + +bash-completion (1.90) + + * bash-completion 2 preview: dynamic loading of completions. + + [ David Paleino ] + * If _filedir 'ext' returns nothing, just fallback to generic file + completion. It is optional, and off by default. Patch by Clint Byrum + (Debian: #619014, LP: #533985) + * Fix __get_cword_at_cursor_by_ref: check for $index when completing with a + cword+1 argument already present (Debian: #622383) + * Layout change: everything is now in /usr/share/bash-completion/, rather + than in /etc/. + * Get rid of BASH_COMPLETION_DIR, BASH_COMPLETION_HELPERS_DIR, BASH_COMPLETION + * Fix autotools to use pkgdatadir instead of redefining datadir, get rid of + helpersdir. + * Implemented a blacklist for unwanted third-parties completions + * New completions: + - epdfview, lpr and lpq (Raphaël Droz), mysql (Raphaël Droz) + * Improved completions: + - ant: handle "extension-point" the same as "target" tag (Petr Kozelka, + Alioth: #313105) + - apt: add 'download' to subcommands (Debian: #625234, Ubuntu: #720541) + - aptitude: add 'versions' command (Debian: #604393) + - dpkg-query: use the 'dpkg' completion (Debian: #642526) + - lintian: remove --unpack-level (Debian: #623680) + - {shadow,coreutils}: fix broken _allowed_groups usage + - rrdtool: complete filenames after commands (Debian: #577933) + - sitecopy: fixed a bug with grep and brackets: use sitecopy -v to fetch + sites (Raphaël Droz). + + [ Freddy Vulto ] + * Improve __reassemble_comp_words_by_ref() (Alioth #313057) + * Testsuite: + - add -unsorted option to _get_hosts() + + [ Guillaume Rousse ] + * Use $() for subshell, instead of backquotes + * Use simple quotes for constant strings + * Drop -o filenames, as suggested by Ville + * New completions: puppet + + [ Igor Murzov ] + * Abort completion file loading earlier if required commands are not + available. + * docs: Improve tester's manual + * Make completions that use _command also work with file names + * _command_offset: Restore compopts used by called command. + * New completions: + - pkgtool, makepkg, rmp2tgz, slapt-get, slapt-src, slackpkg, kcov, feh, + xgamma, fbi, fbgs + * Improved completions: + - file: ddd few missing --exclude arguments completions + - host, nslookup: Remove completions for bind utils from bash_completion. + - {install,upgrade,explode}pkg: use -o plusdirs instead of -o dirnames + - makepkg: should complete filenames + - removepkg, upgradepkg, installpkg: add option completion + - xrandr: Add more option completions. + - overall clean up of different slackware-specific completions + * Testsuite: + - add basic tests for pkgtools, rpm2tgz, slapt, sbopkg, slackpkg + - fix broken tests for finger and xhost + - remove unused -expect-cmd-full option from assert_complete* + + [ Sergey V ] + * New completions: sbopkg + + [ Ville Skyttä ] + * Load completions in separate files dynamically, get rid of have() + * Drop unnecessary $USERLAND checks + * Try /usr/sbin before /sbin in have() + * Try both full path and basename completions for sudo etc (Alioth: #313065) + * Add _init_completion() for common completion initialization and generic + redirection handling + * Replace actual sysconfdir in bash_completion on install (Alioth: #313081) + * Drop support for bash < 4.1 + * Drop no longer needed _compopt_o_filenames() + * Drop no longer needed "type compopt" checks + * docs: Update "simply sourcing" instructions to match new layout, check + $PS1. + * Get rid of bash_completion self-parsing from _filedir_xspec + (RedHat: #479936). + * Provide profile.d hook for per user disabling of bash_completion + (Debian: #593835) + * New completions: + - a2x, arping, asciidoc, base64, cal, chrpath, cppcheck, curl, dmesg, + dot, file, gnome-mplayer, gprof, hddtemp, host, htpasswd, idn, ionice, + jps, lbunzip2, lbzip2, lbzcat, prelink, protoc, pwdx, pwgen, reptyr, + sum (RedHat: #717341), watch + - phing: reuse ant completion (Elan Ruusamäe, Alioth: #312910) + - pinfo: reuse info completion + * Improved completions: + - bluez, e2fsprogs, grpck, java (Mattias Ulbrich), passwd, pwck, route, + rsync, smartctl + - ant: improve -lib, -find/-s, and -D argument completions; rewrite build + target parsing in plain bash, add build file test case + - aspell: add --add-filter|--rem-filter completions; get --mode completions + from 'aspell modes' output + - bzip2, gzip, python, sysbench: quote command argument to _parse_help() + - chsh: use _allowed_users instead of plain compgen -u + - cksfv: add -g argument completion + - cpan2dist: don't hang if no package list files exist + - crontab: use /sys/fs/selinux and /selinux instead of /etc/selinux to + find out if SELinux is around + - cvs: (diff) parse options from cvs diff instead of plain diff; drop -o + default to fix CVS root completions; (commit) complete on entries + instead of default if COMP_CVS_REMOTE is not set; improve CVS + controlled file completions; add CVS controlled file completions for + admin and update; list "primary" command names first in mode switch; + recognize some additional commands and synonyms; add editors/watchers + completion; sort mode completions alphabetically + - freeciv: complete freeciv-* in addition to civclient/civserver + - gdb: improve filename completion + - gendiff: do file completion after output redirection + - getent: add gshadow to known databases; allow multiple completions from + same db, add option completion + - info: add option completion support + - ipsec (Tobias Brunner): drop uname check, add strongSwan specific + completion with fallback, complete connection names for 'up', 'down' and + other commands + - jar: complete on *.sar (JBoss service archive) + - java, javac: add -X* completions + - javadoc: implement -linkoffline two argument completion + - killall: activate completion on Darwin (Alioth: #312350) + - (la)tex (Ted Pavlic): add *.dbj to filename completions (RedHat: #678122) + - man: add option parsing and completion + - modplug*: add more extensions for files supported by libmodplug + - mutt: support tildes when recursively sourcing muttrc files + (Debian: #615134); expand tilde in mutt query command (Alioth: #312759) + - ntpdate: add some option argument (non)completions + - oo{writer,impress,calc,draw} (Matej Cepl): complete on LibreOffice + FlatXML extensions (RedHat: #692548) + - perldoc (Scott Bronson): override MANPAGER when generating perldoc + completions (RedHat: #689180); don't parse man page when we know it'll + produce no completions; use perldoc itself instead of man + - pgrep: add option and option argument completions + - rpm: make rpm --queryformat use more consistent; drop rpm query support + for rpm < 4.1 + - rpmbuild: add --buildpolicy completion + - rpmcheck: drop reference to undefined $files variable (Alioth: #313270) + - screen: add _terms() and -T completion; add commands completion + (Alioth: #312164, RedHat: #547852) + - _services: avoid bogus completions when init or xinetd dirs exist but are + empty; include systemd services + - smartctl: fix short alternative for --tolerance + - ssh, scp, sftp, ssh-copy-id: add some option argument (non)completions + - strace: don't append space for -e *= completions; don't try to extract + syscall names if they're not going to be used; rewrite arch specific + syscall extraction in plain bash + - svn*: don't suggest short options + - tar: fix completion of files inside *.tar.bz2 archives when [Ijy] is not + given; added option completions; improve tar *[cr]*f completions + (Debian: #618734) + - unzip: complete on *.sar (JBoss service archive) + - xmllint, xmlwf: complete on *.tld (tag library descriptor) + - xmlwf: add -v non-completion + - xmms: add some option argument completions + - xz: apply xz completion to pxz too; non-complete + --memlimit{,-compress,-decompress} + * Testsuite: + - add basic tests for gendiff, mdadm, puppet, xzdec, mii-diag, mii-tool, + grpck, passwd, pwck, samba, rdesktop, fusermount, tcpdump, l2ping, + ssh-copy-id, postfix, qemu, ldap*, medusa, mdtool, monodevelop, + msynctool, cfagent, lpr, lpq, mysql, nslookup, compare, conjure, + import, stream + - fix tests for ri + - fix get_hosts option docs. + - add test case for Debian: #622383. + - add chown foo: and :foo test cases, should complete files + (RedHat: #710714) + + -- David Paleino <d.paleino@gmail.com> Thu, 03 Nov 2011 09:53:55 +0000 + +bash-completion (1.3) + + [ Guillaume Rousse ] + * added pure-perl perldoc completion helper, using work from Aristotle + Pagaltzis (pagaltzis@gmx.de) + * added completions for xfreerdp and iscsiadm + * updated xm subcommands list + + [ David Paleino ] + * Fixed "service" completion, thanks to John Hedges (Debian: #586210) + * Complete on all files for mplayer's -dvd-device + * Fixed typo in openssl completion (Debian: #609552) + + [ Ville Skyttä ] + * Activate hping2 completion also for hping and hping3. + * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake, + filefrag, gendiff, growisofs, iftop, ip (Debian: #600617), javaws, kid3, + lrzip, lsof, mktemp, portecle, POSIX sh, sha{,224,256,384,512}sum, + sysbench, tune2fs, xmodmap, and xrdb completions. + * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2, + *.awb, and *.iso (Alioth: #311420) to mplayer filename completions. + * Add "short" tarball extensions to unxz, unlzma etc completions. + * Improve /etc/init.d/*, ipmitool, jar, java, javadoc, man, mencoder, mkdir, + mplayer, pack200, povray, python, rpmbuild, sqlite3, tar, wodim, and + general help parsing completions. + * Fix p4 and povray completions (Alioth: #312625). + * Add *.xsd, *.xsl, *.rng, *.wsdl, and *.jnlp to xmllint and xmlwf filename + completions, and *.gz versions of all of the supported ones for xmllint. + * Recognize rpm query mode based on the --file, --group, --package, and + --all long options (RedHat: #630328). + * Improve rpm query option completions. + * Drop bad kompare filename completion (Alioth: #312708). + * Make _filedir and _filedir_xspec complete uppercase versions of their + filename extension arguments in addition to exact case matches. + * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658). + * Fixes to completions for filenames containing tabs (RedHat: #629518). + * Add *.iso (Alioth: #311420), *.m2t and *.m2ts (Alioth: #312770) to + xine-based player filename completions. + * Add /etc/ethers to MAC address completion sources. + * Add *.gem and *.spkg to tar filename completions. + * Complete known hosts from avahi-browse only if $COMP_KNOWN_HOSTS_WITH_AVAHI + is non-empty (Alioth: #312691, RedHat: #630326). + * Improve relevance of many user/group completions, depending on context. + * Remove most "-o filenames" options to "complete", turn "-o filenames" on + dynamically when needed instead. + * Add/improve various autotools completions. + * Add *.apk to unzip and jar filename completions. + * Do not load bash_completion in profile.d script if progcomp is not enabled. + * Ignore muttrc source entries that are not files (Alioth: #312881). + * Re-enable postgresql database and user completion (Alioth: #312914, + Ubuntu: #164772). + * Add *.fdf to various PDF viewer completions. + + [ Freddy Vulto ] + * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) + * Speed up `compopt' availability detection + * Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646) + * Fix __reassemble_comp_words_by_ref (Alioth #312740) + + [ Anton Khirnov ] + * Improve mplayer and mencoder completions. + + [ Paul Walmsley ] + * Add *.webm to mplayer file completions (Debian: #588079). + + [ Miklos Vajna ] + * Add *.amr to mplayer file completions (Alioth: #312634). + + [ Andrej Gelenberg ] + * Add *.part (partially downloaded) to mplayer and xine-based player + completions (Alioth: #312657). + + [ Stephen Gildea ] + * Fix false posives for non-option words in _parse_help (Alioth: #312750). + + [ Andrey G. Grozin ] + * Add *.fb2 to okular filename completions. + + -- David Paleino <d.paleino@gmail.com> Sun, 06 Feb 2011 19:03:46 +0100 + +bash-completion (1.2) + + [ David Paleino ] + * Don't use pidof in _known_hosts_real() to detect whether Avahi is + available, since it's not available on MacOS X. Thanks to Rainer + Müller <raimue@codingfarm.de> (bash-completion MacPorts maintainer) + * Fixed "freq" and "rate" completion for iwconfig + * contrib/munin-node fixed (Debian: #550943) + * contrib/dpkg fixed -W and --show completing on .?(u)deb's (Debian: #552109) + * contrib/aptitude: add @(add|remove)-user-tag + * Added munindoc completion to contrib/munin-node, thanks to Tom + Feiner (Debian: #553371) + * Added colordiff completion, same as diff + * contrib/cpio: added missing completions for -?, --help, --license, --usage, + --version and (-p) --to-stdout (Debian: #557436) + * Style policy: don't use fancy globbing in case labels + * Added .fdf completion to okular and evince + * Added .okular completion to okular (Debian: #545530) + * Added lintian completion + * Refreshed reportbug completion, added --from-buildd (Debian: #579471) + * Special-case "apt-get source" (Debian: #572000) + * Added lintian completion (Debian: #547361) + * contrib/dpkg: update completion to current API + * Styleguide: establish line wrapping and $() instead of `` + + [ Ville Skyttä ] + * Create bz2 dist tarball too. + * Include CHANGES in dist tarball. + * Include profile snippet in tarball, install it. + * Rename contrib/bluez-utils to contrib/bluez to follow bluez 4.x naming. + * Apply cardctl completion to pccardctl too. + * Apply pine completion to alpine too. + * Remove many unnecessary short option completions where long ones exist. + * Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip, + iconv, lftp, look, lzma, make, man, mdadm, modprobe, mount, mplayer, + mysqladmin, perldoc, rsync, screen, service, scp, ssh, sshfs, unzip, + update-alternatives, vncviewer, wget, yp-tools, xine based players' and + general hostname completions. + * Add abook and wtf completion, based on work by Raphaël Droz. + * Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, modplug123, + pm-utils, rtcwake, pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz, + unpigz, and wol completions. + * Don't overwrite other host completions when completing from multiple + SSH known hosts files. + * Speed up installed rpm package completion on SUSE, based on work by + Marco Poletti (Alioth: #312021). + * Improve sourcing snippets from completion dirs. + * Drop support for bash < 3. The compatibility global variables $bashN, + $default, $dirnames, $filenames, $compopt, $nospace, $bashdefault, and + $plusdirs have been dropped too. 3rd party completions should switch + to using the complete/compgen features directly, and BASH_VERSINFO + for bash version checks. + * Protect various completions from unusual user input by not embedding the + input in external command arguments (Debian: #552631). + * Add /sbin to $PATH when invoking ifconfig and iwconfig. + * Combine dcop and qdbus completions into the latter. + * awk and sed usage portability fixes (Alioth: #311393, Debian: #501479). + * Fix leaking local variables from various completions. + * Turn on -o filenames in _filedir on bash >= 4. + * Deprecate modules completion, upstream modules >= 3.2.7 ships one. + * Protect grep invocations from user aliases (Alioth: #312143). + * Split sshfs completion from contrib/ssh into contrib/sshfs. + * Split mount and umount completion into contrib/mount. + * Split service completion into contrib/service. + * Split chown, chgrp, and id completions into contrib/coreutils. + * Split kill, look, and renice completions into contrib/util-linux. + * Split killall, pkill, pgrep and related completions into contrib/procps. + * Split ipsec completion into contrib/ipsec. + * Split ifup and ifdown completions into contrib/ifupdown. + * Do basic HTML file completion with Firefox and Chrome and friends, + and Epiphany. + * Do basic diff/patch completion with cdiff and kompare. + * Don't install mock completion by default, it's in upstream mock > 1.1.0. + * Do basic text editor completion with xemacs, sxemacs, kate, and kwrite. + * Do meta-command completion for aoss and padsp. + + [ Freddy Vulto ] + * Prevent root PATH expansion prolifering in _root_command (bash >= 4.1.4) + * Only complete xhost if (_)xhost is available. + * Added _get_comp_words_by_ref to replace both _get_cword & _get_pword. + Also additional variables `words' and `cword' can be returned. + * Added _upvar & _upvars helper functions to aid in passing variables + by reference. + * Make _filedir emulate `-o filenames' + * Fixed completion perl modules containing colons. + * Merged __get_cword3 & __get_cword4 to _get_cword. + * Added __expand_tilde_by_ref helper function. + * Added __ltrim_colon_completions to fix completions containing colons + * Improved mutt completion + * Added _get_pword helper function, thanks to Sung Pae (Alioth: #312030) + + [ Ted Stern ] + * Fix modules completion for "(default)" entries. + + [ Jeremie Lasalle Ratelle ] + * Fix rsync remote path completion (Alioth: #312173, Gentoo: #297818). + + [ Leonard Crestez ] + * Improve ssh -o suboption completion (Alioth: #312122). + * Fix NFS mounts completion (Alioth: #312285). + * Fix completion of usernames (Alioth: #311396, Debian: #511788). + * Fix chown test crashing on systems with no root group (Alioth: #312306). + * Fixed tests when BASH_COMPLETION or TESTDIR contain spaces. + * Fix mount handling of escapes (Alioth: #311410, Launchpad: #219971, + Debian: #511149). + * Cleanup scripts to run tests. Make runUnit and runCompletion use test/run. + Make it possible to run tests from any directory. + * Add a --debug-xtrace option to test/run using BASH_XTRACEFD from bash-4.1. + * Add a --timeout option to test/run to override the default expect timeout. + + [ Raphaël Droz ] + * Add xsltproc completion (Alioth: #311843). + + [ Adrian Friedli ] + * Add ipv6calc completion. + + [ Ildar Mulyukov ] + * Add showmount completion (Alioth: #312285). + + [ Neville Gao ] + * Fix mount completion error "bash: [: too many arguments" (Alioth #312381). + + [ Austin English ] + * Make lookup of wine file completions case insensitive. + + [ Igor Murzov ] + * Improve xz completion (Alioth: #312466). + + [ Mario Schwalbe ] + * Update find completion (Alioth: #312491, Launchpad: #570113). + + [ Mark van Rossum ] + * Add basic lyx completion. + + -- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:44:59 +0200 + +bash-completion (1.1) + + [ David Paleino ] + * Permit .gz files concatenation (Debian: #514377) + * Fix svk completion using $filenames instead of $default (Debian: #524961) + * Really add build-dep to aptitude's completion (Debian: #495883) + * Fix checks for GNUish userland, thanks to Robert Millan (Debian: #529510) + * Fix typo in .ass subtitles completion for mplayer (Debian: #531337) + * Fix regression on man(1) completion: also complete on local .3pm files + (Debian: #531343) + * Split mutt completion to contrib/mutt + * Split iconv completion to contrib/iconv + * Split dict completion to contrib/dict + * Split {update,invoke}-rc.d completions to contrib/sysv-rc + * Don't install _subversion anymore, upstream completion is better than + ours. Added to EXTRA_DIST in Makefile.am + * Split autorpm completion to contrib/autorpm + * Split jar completion to contrib/jar + * Split chkconfig completion to contrib/chkconfig + * Split chsh completion to contrib/chsh + * Split apt_build completion to contrib/apt-build + * Split aptitude-related completions to contrib/aptitude + * Split apt-cache and apt-get completions to contrib/apt + * Split rpm-related completions to contrib/rpm + * Split cvs-related completions to contrib/cvs + * Split man completion to contrib/man + * Split bash builtins completions to contrib/bash-builtins + * Split dpkg-related completions to contrib/dpkg (and re-enable usage + of grep-status if available) + * Split gcc completion to contrib/gcc + * Split dselect completion to contrib/dselect + * Split cardctl completion to contrib/cardctl + * Split pineaddr completion to contrib/pine + * Added avahi-discovered hosts to _known_hosts_real() (Debian: #518561) + * Added m4v completion to mplayer (Debian: #504213) + * Improve qemu completion (Debian: #534901) + * Added sshfs completion (shares the same as scp) (Debian: #545978) + * Fixed obvious brokenness (typos) in contrib/mdadm + * Clean [1.2.3.4]:port format in known_hosts, thanks to + Xuefer (Gentoo: #284563) + * Added --no-generate to "apt-cache pkgnames" calls, make it faster + on certain configurations (Debian: #547550) + * Split okular from evince filename extension completion, needed to add + okular-specific completions: xps, epub, odt, fb, mobi, g3 and chm. + Also, okular can read any of its formats also in .gz/.bz2 compressed + format, so change the regular expression to match this. + * Remove --with-suggests and --without-suggests from aptitude completion + * Patches from PLD Linux (thanks to Elan Ruusamäe): + - avoid sed pipe as ps itself can omit the headers + - improve service(8) completion, also look for "msg_usage" + + [ Ville Skyttä ] + * Split yum completion to contrib/_yum (no longer installed by default, the + intent is to move it to yum upstream soon). + * Split yum-arch completion into contrib/yum-arch, load completion only if + yum-arch is installed. + * Update list of yum commands and options. + * Add yum repolist, --enable/disablerepo, --disableexcludes, -d, -e, --color, + and --enable/disableplugin completions. + * Add chkconfig --override and resetpriorities completions. + * Split mplayer and friends completions to contrib/mplayer. + * Parse top level mplayer and friends option completions from -list-options. + * Fix dir-only completion for make to include only dirs, not files. + * Remove unused variable RELEASE. + * Improve aspell dictionary completion: don't hardcode data-dir, get + canonical dicts from "aspell dicts". + * Always use /etc/shells for chsh -s completion, don't complete on comment + lines in it. + * Fix rpm --whatrequires/--whatprovides completions with spaces and other + unusual characters, add filename based --whatrequires completions. + * Add modplugplay filename completion. + * Add more mod-like audio file extensions for xine-based players and timidity. + * Complete on plain alternatives like update-alternatives. + * Rename installed_alternatives() to _installed_alternatives(). + * Add /etc/pki/tls/openssl.cnf to list of default openssl config files, + search for default ones only if -config is not given. + * Use POSIX compliant arguments to tail in mkisofs completion. + * Protect various completions from unusual user input by not embedding the + input in external command arguments. + * Add _split_longopt() helper for improved handling of long options that + take arguments in both "--foo bar" and "--foo=bar" formats. + * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp, + chown, chkconfig, cpio, dpkg, heimdal, iptables, mailman, make, mc, + mii-diag, mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug, + samba, smartctl, yum, and generic long option completion (Alioth: #311398). + * Add chown --from and --reference value completions. + * Add chgrp --reference value completion. + * Do not assume all --foo= options take filenames in generic long option + completion, assume only that --*file*= does, and that --*dir*= takes dirs. + * Add make --old/new-file, --assume-old/new, --what-if value completions. + * Add smartctl -n/--nocheck completion, add more other value completions. + * Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, service, + and tcpdump completions. + * Split ant completion to contrib/ant, improve the built in one. + * Improve postfix completion. + * Improve samba completion. + * Split lilo completion to contrib/lilo. + * Split reportbug and querybts completions to contrib/reportbug. + * Remove debug output noise from quotaon completion. + * Split Linux wireless tools completion to contrib/wireless-tools. + * Add mock completion. + * Split FreeBSD kld(un)load completion to contrib/kldload. + * Split FreeBSD pkg_* completion to contrib/pkg_install. + * Split FreeBSD portupgrade and friends completion to contrib/portupgrade. + * Split Slackware pkgtools completion to contrib/pkgtools. + * Improve rpm group completion (displayed completions are still wrong). + * Change many completions to load in memory only if the completed commands + are available. + * Invoke the actual mplayer/mencoder command being completed (with full path) + to get various completions instead of simply "mplayer" or "mencoder". + * Associate OOXML/MS Office 2007 extensions with OpenOffice applications. + * Associate .tsv with oocalc. + * Add xmlwf completion. + * Associate *.po with poedit, gtranslator, kbabel, and lokalize. + * Add xz, xzcat, xzdec, and unxz completion. + * Add lzcat, lz*grep, lzless, lzmore, and unlzma completion. + * Load "modules" completion if /etc/profile.d/modules.sh exists even if + the "module" alias has not been defined (yet). + * Add *.ogv to xine-based players (Debian: #540033). + * Add $compopt (":" i.e. no-op with bash < 4, "compopt" with >= 4). + * Complete bzcat and zcat only on compressed files. + * Do not require a dot in bzcmp, bzdiff, bz*grep, zcmp, zdiff, z*grep, zless, + and zmore filename completions. + * Add xz and compress support and more tarball filename extensions to + rpmbuild -t*/--tarbuild completion. + * Don't hardcode path to lsmod. + * Fix sbcl file/dirname completion (Debian: #545743). + * Add /sbin to $PATH when invoking lspci and lsusb. + * Support .xz suffix in info page completions. + * Prevent rpm --define/-D completions from falling through. + * Add more common options to rpm option completions. + + [ Todd Zullinger ] + * Make yum complete on filenames after install, deplist, update and upgrade + when the following argument contains a slash. + + [ Mike Kelly ] + * Fix _filedir on bash 4. + * Add support for xz to tar completion. + * Fix _quote_readline on bash 4 (Debian: #544024). + + [ Guillaume Rousse ] + * Split mkinitrd completion to contrib/mkinitrd, improve it. + * Split smartctl completion to contrib/smartctl. + * Better ssh and sftp completion + * Better xhost completion + * Split _known_hosts completion in two parts, to avoid parsing command line + twice + * Added strace completion + * Added xm completion + * Added rpcdebug completion + * Added msynctool completion + * Added openldap completion + * Added ldapvi completion + * Added heimdal completion + * Added vpnc completion + * Added rpmcheck completion + * Added munin-node completion + * Added bluez-utils completion + * Added samba completion + * Added cfengine completion + * Added xmllint completion, contributed by Ville + * Added shadow completion, contributed by Ville + * Added repomanage completion, contributed by Ville + * Splitted and enhanced openssl completion + * Added rfkill, mdadm and resolvconf completions + + [ Raphaël Droz ] + * Add mount -L and -U completion. + + [ Philipp Weis ] + * Add .dvi.{gz,bz2} completion for evince/okular (Debian: #522656) + + [ Freddy Vulto ] + * Patched _known_hosts() to support multiple {Global,User}KnownHosts in SSH + config files, thanks to Thomas Nilsson (Alioth: #311595) (Debian: #524190) + * Fix leaking $i from info, man and python completions. + * Added setting COMP_KNOWN_HOSTS_WITH_HOSTFILE. _known_hosts_real() will add + hosts from HOSTFILE, unless COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an + empty value (Alioth: #311821) + * Quoted $cur to prevent globbing - thanks to Eric Blake (Alioth #311614) + * Fix leaking $muttcmd from mutt completion + * Fix completing multiple hosts (Debian: #535585) + + [ Michele Ballabio ] + + * Add more extensions to pkgtools completion. + + -- David Paleino <d.paleino@gmail.com> Sat, 03 Oct 2009 15:41:49 +0200 + +bash-completion (1.0) + + [ Guillaume Rousse ] + * Make bibtex complete on .aux files + * Add .xvid and .XVID to player completion + * Added cowsay/cowthink completion + * Added brctl completion + * Added cpan2dist completion + * Added qemu completion + * Added net-tools (mii-tool and mii-diag) completions + * Added minicom completion + * Added quota-tools completion + * Added rdesktop completion + * Added tightvncviewer completion + * Cleanup screen completion, and make it completes on options + + [ David Paleino ] + * Added .kar to Timidity completion. + * Fix killall completion, remove trailing ":" on certain process + names + * Fix man -l completing filenames (Debian: #497074) + * (Partly) fixed java classes completion (Debian: #496828). Look for + FIXME in source. + * Dump to /dev/null error message from look(1) with no arguments + (Debian: #495142) + * Set ssh as default for rsync (was rsh) (Debian: #492328) + * Added .oga, .ogv, .ogx to mplayer completion (Debian: #496162) + * Added .epub to unzip|zipinfo completion (Debian: #492476) + * Added ssh-copy-id completion (Debian: #491856) + * Moved ssh completion to separate file (Debian: #360628) + * Bogus completion when mounting subdirs fixed (Debian: #322238) + * Fix `apt-cache showsrc` completing only on source package names + (Debian: #361535) + * Fixed bugs with gdb completion: + - when an empty directory is in $PATH (thanks to Morita Sho) + (Debian: #497597) + - when a non-existing directory is in $PATH (Debian: #499780) + * Fix missing completion for "-n" and "-e" (we were using echo, now + using printf) (thanks to Morita Sho) (Debian: #498105) + * Fixed gpg completion: + - --@(export|@(?(l|nr|nrl)sign|edit)-key)) (Debian: #500316) + - -@(r|-recipient)) + * Fixed .cb[rz] completion for evince (Debian: #502885) + * Added gksudo, gksu, kdesudo completion + * Added apache2ctl completion + * Added gpg2 completion (Debian: #489927) + * Fixed mplayer -skin completion (Debian: #501473) + * Fixed errors with POSIX enabled (Debian: #502804) + * Fixed dpkg-source wrong exit() with return() (Debian: #) + * Added --schedule-only to aptitude's completion (Debian: #502664) + * Added build-dep to aptitude's completion (Debian: #495883) + * Added support for `-F configfile' to _known_hosts(), ssh, scp and + sftp, thanks to Freddy Vulto (Debian: #504141) + * Fixed sed quoting bug in _known_hosts(), thanks to Freddy Vulto + (Debian: #504650) + * Allow `Host(Name)' in ssh config file to be indented + * Allow `Host(Name)' in ssh config file to have trailing comment. + * Allow for comments in known_hosts files (Debian: #511789) + * Fixed perl -I/-x completion, thanks to Freddy Vulto + (Debian: #504547) + * README updated: explain how to use bash-completion correctly. + (Debian: #506560) + * TODO updated: the Alioth team is now upstream. + * Added qdbus completion, thanks to Terence Simpson (Ubuntu: #257903) + * Added monodevelop and mdtool completions. + * Split subversion-related completions to contrib/_subversion + (prefixed with _ to avoid file conflicts with upstream's one) + * Fixed completion of environment variables, thanks to Morita Sho + (Debian: #272660) + * Fix dpkg completion bug: it listed only non-Essential packages + (Debian: #511790) + * Fixed _dpkg_source completion (Debian: #503317) + * Added _parse_help() to try to parse options listed in $command + --help + * Fixed gzip completion to use _parse_help(), since the available + options vary with distributions + * Added to_review/ directory, where completions needing a review would + go. After it gets accepted, the completion would go into contrib/. + * Remove unused UNAME local variable in _info() (Debian: #501843) + * AUTHORS added + * Make _alias() use _get_cword + * Added .zip to jar completions (Debian: #521041) + * Merge from Gentoo: + - fix 'find' completion so that it properly completes on -?(i)whilename. + Patch by Ciaran McCreesh. + - use make -qp to parse the Makefile for us, so we get proper completion + on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>. + - complete on gkrellm2 as well. Patch by Aaron Walker. + - fix CVS completion + * Merge from Ubuntu: + - consume error messages in configure completion (Ubuntu: #223882) + (Mika Fischer) + - quote $xspec in _filedir_xspec in case it is empty, which would + cause errors if there was no match under failglob. (Ubuntu: #194419) + (Mika Fischer) + * debian/links fixed (Debian: #494292) + * debian/control: + - fixed typo in the long description + - added Vcs-* fields + * debian/install: + - correctly install contrib/* under /etc/bash_completion.d/ + * debian/copyright updated + * extra/dh_bash-completion: + - updated to support a list of files in debian/<package>.bash-completion + (Debian: #512917) + + [ Ville Skyttä ] + * Added JPEG 2000 files to display completion, thanks to Bastien Nocera + (RedHat: #304771) + * Improved rpm macro completion. + * Added -E to rpm completion. + * Improved rpm backup file avoidance. + * Improved /var/log/rpmpkgs based rpm installed package completion. + * Improved performance of rpm -qa based rpm installed package completion. + * Improved features and performance of yum completion. + * Added support for p (POSIX) and x (x.org) man sections. + * Improved filename based man page completion. + * Added minimal sqlite3 completion. + * Improved getent completion (Ville Skyttä, Guillaume Rousse). + * (Re)fix gzip and bzip2 options completion. + * Improved svn filename completion (RedHat: #430059). + * Add lzma completion (Per Øyvind Karlsen, Ville Skyttä). + * Add .mp2 and .vdr to mplayer completion (RedHat: #444467). + * Add .mkv, .mp2 and .vdr to *xine completion (RedHat: #444467). + * Added lzop completion. + * Fix scp metacharacter escaping. + * Remove duplicate cpio completion, thanks to Freddy Vulto (Debian: #512823) + * Fix awk error in "modprobe -r /" completion (Debian: #512556). + * Expand ~foo to dir name more eagerly to avoid quoting issues. + * Fix -sourcepath handling in javadoc packages completion. + * Extract process name completion from _killall to _pnames, make it work + for others than Linux and FreeBSD. + * Fix process name completion with relative paths (RedHat: #484578). + * Use improved process name completion in pgrep in addition to killall. + * Enable pgrep and pkill completion if the commands are available, not just + on Linux and FreeBSD. + * Drop hg completion, an improved version is shipped with Mercurial + (contrib/bash_completion in the tarball). + * Make okular complete on same files as evince, thanks to Mary Ellen Foster + (RedHat: #486998). + * Apply ps2pdf completion to ps2pdf{12,13,14,wr} too. + * Simplify bash_completion.sh, return earlier in non-applicable environments. + * Remove obsolete --buildarch and --buildos rpm(build) completions. + * Add rpmbuild --target completion. + * Use "-profile help" to get mplayer and friends -profile completions. + * Fix local array initialization under bash 3.0, prevents "()" occurring in + file and dir name completions. + + [ Freddy Vulto ] + * Restored `_display()' completion for `display' by removing + completion-by-extension for `display' (Alioth#311429) + * Removed duplicate completion option `-borderwidth' for `display' + * Prevent completion dir from being sourced twice if + BASH_COMPLETION_DIR and BASH_COMPLETION_COMPAT_DIR are equal (Alioth#311433) + * Make `_mii-tool()' and `_mii-diag()' POSIX-compliant + * Fix _isql completion waiting for grep input if $ODBCINI not set; handle + whitespace in $ODBCINI. + * Split vncviewer completion in _tightvncviewer() and _xvnc4viewer() + Added _realcommand() global function. + + [ Jakob Unterwurzacher ] + * ps2pdf can run on .pdf files as well. (Debian: #516614, Ubuntu: #316943) + + [ Santiago M. Mola ] + * Add .ape to mplayer supported extensions (Alioth#311510). + + -- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100 + +bash-completion (20080705) unstable; urgency=low + + [ David Paleino ] + * Added more completions to imagemagick (thanks to Nelson A. de + Oliveira) (Debian: #487786) + * Added xrandr completion (thanks to Anton Khirnov) (Debian: #487825) + * Improving _gdb completion: + - $filenames to $default (Debian: #463969) + - also show directory names (i.e. compgen -d) in COMPREPLY. + - added . to $PATH, to allow debugging "local" executables. + - do not complete Bash's builtins (thanks to Morita Sho) + + [ Luk Claes ] + * Remove use of ucf for /etc/bash-completion (Debian: #488171). + + -- Luk Claes <luk@debian.org> Sat, 05 Jul 2008 16:14:15 +0200 + +bash-completion (20080617.5) unstable; urgency=medium + + * Revert way of setting environment variables (Debian: #487774). + * Add equals sign to _get_cword for mutt_aliases (Debian: #482635). + * Enhance mlayer completion (Debian: #487826, #487838). + + -- Luk Claes <luk@debian.org> Tue, 24 Jun 2008 19:50:57 +0200 + +bash-completion (20080617.4) experimental; urgency=low + + [ David Paleino ] + * Merged Ubuntu changes: + - added quote(), quote_readline(), dequote() helper functions. + - added _remove_word() + - fixed _get_cword() + - refactored _filedir using quote_readline() + - refactored _filedir_xspec using quote_readline() + - fixed COMPREPLY's in _iwconfig + - fixed _cvs() + - _known_hosts(): use files from UserKnownHostsFile options in + addition to standard ones. + - fixed _command() to correctly prune the command line + - disabled completion of PostgreSQL users and databases (Ubuntu: #164772) + - fixed _java_packages() + - fixed _muttquery() + - added flv/FLV completion to mplayer + - added --installed to apt-cache + - only complete on filenames for aspell + - fixed code for exclusions compspecs + - added code to gracefully handle debug options (set +/-v) + + -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 19:25:25 +0200 + +bash-completion (20080617.3) unstable; urgency=low + + [ David Paleino ] + * Fixed IFS for filedir_xspec - Thanks to Stefan Lippers-Hollmann + (Debian: #487571) + + [ Luk Claes ] + * Install dh-bash-completion to ease installation of completions. + + -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 07:24:21 +0200 + +bash-completion (20080617.2) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - provide a manpage for extra/dh_bash-completion + - fix semi-serious problem with _filedir() (Debian: #487449) + * debian/rules: + - added rule to generate dh_bash-completion's manpage + * debian/install, debian/dirs: + - installing dh_bash-completion into /usr/bin + * debian/control: + - new package dh-bash-completion + + [ Luk Claes ] + * Comment new package to make sure current fix gets in the archive first. + * Add compression completion for vi(m). + + -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 19:47:23 +0200 + +bash-completion (20080617.1) unstable; urgency=medium + + [ David Paleino ] + * Urgency set to medium because the package is currently unusable. + * New upstream sub-release + - fixed some typos here and there which prevented bash completions + at all (Debian: #487441). + - really closing Debian bug #455510. + + -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 00:22:53 +0200 + +bash-completion (20080617) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - add more completions to aptitude (Debian: #432289) + - fixed UTF-8 problem with _get_cword(), thanks to + Andrei Paskevich (Debian: #472132) + - fixed autoremove completion, thanks to Flavio Visentin + (Debian: #474974) + - cmf and CMF added to playmidi completion (Debian: #365658) + - added rrdtool completion, thanks to Justin Pryzby (Debian: #428641) + - added OpenDocument completion for unzip/zipinfo (.od{f,g,p,s,t}) + (Debian: #472940) + - fixed escaping problems with job control (i.e. disown, jobs, bg, + fg): the argument is now surrounded by "" (Debian: #347316) + - make mkdir complete also on filenames (Debian: #376433) + - {bz,z}{cat,cmp,diff,egrep,fgrep,grep,less,more} now should complete + on all filenames, not just compressed archives (just commented out) + (Debian: #455510) + - fixes Perl completion (Debian: #470742) + - fixes get_cword -> _get_cword typo (Debian: #478596) + - fixes _get_cword() function to properly handle filenames with + whitespaces (Debian: #394636, #468254, #474094) + - added .pdf.bz2 completion to evince (Debian: #424736) + - added .svg completion to display (Debian: #441017) + - added .m2ts completion to mplayer (Debian: #480879) + - added extra/dh_bash-completion to ease future rewrite of bc. + * debian/copyright - now in a fancier machine-parsable format. + * debian/control: + - added myself to Uploaders + - debhelper Build-Depends updated to >= 6. + * debian/watch: + - improved current watch line regex + - added (commented out) probable future watch line + * debian/compat bumped to 6 + * debian/dirs, debian/install and debian/links added + * debian/rules: + - refactored to make use of debian/{dirs,install,links} + + [ Steve Kemp ] + * Applied patch to fix completion of umount command. + (Debian: #470539) + * Fixed the completion of Perl manpages. + (Debian: #404976) + * Added 'aif' to the filenames offed for completion for mplayer. + (Debian: #474517) + * Allow tsocks completion. + (Debian: #409423) + * Update mutt completion to handle local usernames. + (Debian: #416655) + * Update apt-get completion to include the flag "--no-install-recommends" + (Debian: #475242) + + -- Luk Claes <luk@debian.org> Sat, 21 Jun 2008 21:59:43 +0200 + +bash-completion (20060301-4) unstable; urgency=low + + * Add some fixes from Ubuntu: + * Fix completion of filenames with spaces (Debian: #468254). + * Fix parsing of SSH config files (Debian: #435117). + * Change priority to standard (Debian: #471666). + * Add some more completions for xine (Debian: #452083, #471249). + * Fix completion of gzip (Debian: #351913). + * Also use $HOSTFILE in hostname completion (Debian: #400380). + + -- Luk Claes <luk@debian.org> Sat, 22 Mar 2008 23:10:30 +0000 + +bash-completion (20060301-3) unstable; urgency=low + + * Fix kpdf completion (Debian: #468163, #413374). + * Fix completion of - or -- with _command (Debian: #415276). + * Add sux to the complete -u list (Debian: #466089). + * Add dvipdfm to the list of dvi programs (Debian: #396644). + * Add --purge-unused option completion for aptitude (Debian: #438471). + * Add divx extension completion for mplayer (Debian: #444294). + * Add pdf.gz completion for evince (Debian: #456887). + * Add --remove-all completion for update-alternatives (Debian: #269173). + + -- Luk Claes <luk@debian.org> Wed, 05 Mar 2008 22:57:27 +0100 + +bash-completion (20060301-2) unstable; urgency=low + + * Take over the package. + + -- Luk Claes <luk@debian.org> Wed, 27 Feb 2008 19:22:03 +0100 + +bash-completion (20060301-1) unstable; urgency=low + + * Upload to unstable. + + -- Matthias Klose <doko@debian.org> Sat, 09 Feb 2008 23:18:20 +0100 + +bash-completion (20060301-0ubuntu2) hardy; urgency=low + + * Replace bash (<< 3.1dfsg-9), handle upgrade in preinst. + * Exclude hashed hostnames from ssh host completion results. Debian: #428085. + * Fix: ifup/down don't really complete. Debian: #463756. + * Allow perl completion to complete filenames, complete -I and -x arguments. + Debian: #443394. + * Add find -wholename completion. Debian: #431220. + * Handle whitespaces in $HOME for _known_hosts() completion. Debian: #414821. + * dpkg -L: complete for removed-but-not-purged packages. Debian: #372156. + * Complete for apt-get autoremove. Debian: #433542, #443816, #445332. + * Update completion for mplayer (mka/flac). Debian: #340452. + * Add ping6/fping6 completion. Debian: #413170. + * Handle whitespace in paths for mount/umount completion. Debian: #367957. + * apt-get: Support --auto-remove. Ubuntu: #60666. + + -- Matthias Klose <doko@ubuntu.com> Sat, 09 Feb 2008 23:11:32 +0100 + +bash-completion (20060301-0ubuntu1) hardy; urgency=low + + * Initial release, split out from the bash package. + The software currently is unsupported upstream. + * Don't try to set a readonly variable. Ubuntu: #149527. + * Support purge in apt-get auto completion (Mathias Gug). Ubuntu: #151677. + * evince: Autocomplete on cbr/cbz/djvu files. Ubuntu: #156200, #175220. + Debian: #400678. + * kdvi: complete .*\.dvi\.(gz|bz2). Ubuntu: #128234. + * kpdf: Complete postscript files. Ubuntu: #162319. + * Make completion working in the middle of a word (Adam Simpkins). + Ubuntu: #139666. + + -- Matthias Klose <doko@ubuntu.com> Fri, 08 Feb 2008 16:46:34 +0100 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9c8292c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,191 @@ +# Contributing to bash-completion + +Contributions to the bash completion project are more than +welcome. Fixes, clean-ups and improvements of existing code are much +appreciated, as are completion functions for new commands. + +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 + presence of one of those languages. + + For example, if you were writing completion code for perldoc(1), the + use of Perl to achieve your goal would be acceptable. irb(1) + completion would similarly make the use of Ruby acceptable. + + Even so, please consider alternatives to these large and slow to + start interpreters. Use lightweight programs such as grep(1), awk(1) + and sed(1). + +- Use the full power of bash >= 4.2. We no longer support earlier bash + versions, so you may as well use all the features of that version of + bash to optimise your code. However, be careful when using features + added since bash 4.2, since not everyone will be able to use them. + + For example, extended globs often enable you to avoid the use of + external programs, which are expensive to fork and execute, so do + make full use of those: + + `?(pattern-list)` - match zero or one occurrences of patterns + `*(pattern-list)` - match zero or more occurrences of patterns + `+(pattern-list)` - match one or more occurrences of patterns + `@(pattern-list)` - match exactly one of the given patterns + `!(pattern-list)` - match anything except one of the given patterns + +- Following on from the last point, be sparing with the use of + external processes whenever you can. Completion functions need to be + fast, so sacrificing some code legibility for speed is acceptable. + + For example, judicious use of sed(1) can save you from having to + call grep(1) and pipe the output to cut(1), which saves a fork(2) + and exec(3). + + Sometimes you don't even need sed(1) or other external programs at + all, though. Use of constructs such as `${parameter#word}`, + `${parameter%word}` and `${parameter/pattern/string}` can provide + you a lot of power without having to leave the shell. + + For example, if `$foo` contains the path to an executable, + `${foo##*/}` will give you the basename of the program, without + having to call basename(1). Similarly, `${foo%/*}` will give you the + dirname, without having to call dirname(1). + + As another example, + + ```shell + bar=$(echo $foo | command sed -e 's/bar/baz/g') + ``` + + can be replaced by: + + ```shell + bar=${foo//bar/baz} + ``` + + These forms of parameter substitutions can also be used on arrays, + which makes them very powerful (if a little slow). + +- We want our completions to work in `posix` and `nounset` modes. + + Unfortunately due to a bash < 5.1 bug, toggling POSIX mode interferes + with keybindings and should not be done. This rules out use of + process substitution which causes syntax errors in POSIX mode. + + Instead of toggling `nounset` mode, make sure to test whether + variables are set (e.g. with `[[ -v varname ]]`) or use default + expansion (e.g. `${varname-}`). + +- Prefer `compgen -W '...' -- $cur` over embedding `$cur` in external + command arguments (often e.g. sed, grep etc) unless there's a good + reason to embed it. Embedding user input in command lines can result + in syntax errors and other undesired behavior, or messy quoting + requirements when the input contains unusual characters. Good + reasons for embedding include functionality (if the thing does not + sanely work otherwise) or performance (if it makes a big difference + in speed), but all embedding cases should be documented with + rationale in comments in the code. + +- When completing available options, offer only the most descriptive + ones as completion results if there are multiple options that do the + same thing. Usually this means that long options should be preferred + over the corresponding short ones. This way the user is more likely + to find what she's looking for and there's not too much noise to + choose from, and there are less situations where user choice would + be needed in the first place. Note that this concerns only display + of available completions; argument processing/completion for options + that take an argument should be made to work with all known variants + for the functionality at hand. For example if `-s`, `-S`, and + `--something` do the same thing and require an argument, offer only + `--something` as a completion when completing option names starting + with a dash, but do implement required argument processing for all + `-s`, `-S`, and `--something`. Note that GNU versions of various + standard commands tend to have long options while other userland + implementations of the same commands may not have them, and it would + be good to have the completions work for as many userlands as + possible so things aren't always that simple. + +- Do not write to the file-system under any circumstances. This can + create race conditions, is inefficient, violates the principle of + least surprise and lacks robustness. + +- Use printf(1) instead of echo(1) for portability reasons, and be + sure to invoke commands that are often found aliased (such as `ls` + or `grep` etc) using the `command` (or `builtin`) command as + appropriate. + +- Make small, incremental commits that do one thing. Don't cram + unrelated changes into a single commit. + +- If your code was written for a particular platform, try to make it + portable to other platforms, so that everyone may enjoy it. If your + code works only with the version of a binary on a particular + platform, ensure that it will not be loaded on other platforms that + have a command with the same name. + + In particular, do not use GNU extensions to commands like sed and + awk if you can write your code another way. If you really, REALLY must + use them, do so if there's no other sane way to do what you're doing. + The "Shell and Utilities" volume of the POSIX specification is a good + starting reference for portable use of various utilities, see + <https://pubs.opengroup.org/onlinepubs/9699919799/>. + +- Use an editor that supports EditorConfig, see <https://editorconfig.org/>, + and format source code according to our settings. + +- Read the existing source code for examples of how to solve + particular problems. Read the bash man page for details of all the + programming tools available to you within the shell. + +- Please test your code thoroughly before sending it to us. We don't + have access to all the commands for which we are sent completion + functions, so we are unable to test them all personally. If your + code is accepted into the distribution, a lot of people will try it + out, so try to do a thorough job of eradicating all the bugs before + you send it to us. If at all practical, **add test cases** to our + test suite (in the test/ dir) that verify that the code does what it + is intended to do, fixes issues it intends to fix, etc. + +- 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. + +- 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 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, + send them as attachments formatted by `git format-patch` or directly + with `git send-email`. @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..26f3c7c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,41 @@ +SUBDIRS = completions doc helpers test + +pkgdata_DATA = bash_completion + +# Empty, but here just to get the compat dir created with install +compatdir = $(sysconfdir)/bash_completion.d +compat_DATA = + +profiledir = $(sysconfdir)/profile.d +profile_DATA = bash_completion.sh + +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = bash-completion.pc + +cmakeconfigdir = $(datadir)/cmake/$(PACKAGE)/ +cmakeconfig_DATA = bash-completion-config.cmake \ + bash-completion-config-version.cmake + +%: %.in Makefile + $(SED) \ + -e 's|@prefix[@]|$(prefix)|' \ + -e 's|@datadir[@]|$(datadir)|' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|' \ + -e 's|@PACKAGE[@]|$(PACKAGE)|' \ + -e 's|@VERSION[@]|$(VERSION)|' \ + <$(srcdir)/$@.in >$@ + +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 pyproject.toml .perltidyrc \ + .shellcheckrc bash-completion.pc.in bash-completion-config.cmake.in \ + bash-completion-config-version.cmake.in setup-symlinks.sh + +install-data-hook: + tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ + $(SED) -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ + $(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion >$$tmpfile && \ + cat $$tmpfile >$(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion && \ + rm $$tmpfile diff --git a/README.md b/README.md new file mode 100644 index 0000000..11d2940 --- /dev/null +++ b/README.md @@ -0,0 +1,347 @@ +# bash-completion + +[](https://travis-ci.org/scop/bash-completion) + +## Introduction + +bash-completion is a collection of command line command completions for the +[Bash shell](https://www.gnu.org/software/bash/), collection of helper +functions to assist in creating new completions, and set of facilities for +loading completions automatically on demand, as well as installing them. + +## Installation + +The easiest way to install this software is to use a package; refer to +[Repology](https://repology.org/project/bash-completion) for a comprehensive +list of operating system distributions, package names, and available versions. + +Depending on the package, you may still +need to source it from either `/etc/bashrc` or `~/.bashrc` (or any +other file sourcing those). You can do this by simply using: + +```shell +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion +``` + +(if you happen to have *only* bash >= 4.2 installed, see further if not) + +If you don't have the package readily available for your distribution, or +you simply don't want to use one, you can install bash completion using the +standard commands for GNU autotools packages: + +```shell +autoreconf -i # if not installing from prepared release tarball +./configure +make # GNU make required +make check # optional, requires python3 with pytest >= 3.6, pexpect +make install # as root +``` + +These commands install the completions and helpers, as well as a +`profile.d` script that loads `bash_completion` where appropriate. + +If your system does not use the `profile.d` directory (usually below +`/etc`) mechanism—i.e. does not automatically source shell scripts in +it—you can source the `$sysconfdir/profile.d/bash_completion.sh` +script in `/etc/bashrc` or `~/.bashrc`. + +The `profile.d` script provides a configuration file hook that can be +used to prevent loading `bash_completion` on per user basis when it's +installed system wide. To do this: + +1. Turn off programmable completion with `shopt -u progcomp` in + `$XDG_CONFIG_HOME/bash_completion` (or `~/.config/bash_completion` + if `$XDG_CONFIG_HOME` is not set) +2. Turn it back on (for example in `~/.bashrc`) if you want to use + programmable completion for other purposes. + +### macOS (OS X) + +If you're using macOS (formerly OS X), `/etc/bashrc` is apparently not sourced at +all. In that case, you can put the `bash_completion` file in `/sw/etc` +and add the following code to `~/.bash_profile`: + +```shell +if [ -f /sw/etc/bash_completion ]; then + . /sw/etc/bash_completion +fi +``` + +## Troubleshooting + +If you find that a given function is producing errors or does not work +as it should under certain circumstances when you attempt completion, +try running `set -v` or `set -x` prior to attempting the completion +again. This will produce useful debugging output that will aid us in +fixing the problem if you are unable to do so yourself. Turn off the +trace output by running either `set +v` or `set +x`. + +To debug dynamic loading of a completion, tracing needs to be turned +on before the debugged completion is attempted the first time. The +easiest way to do this is to start a new shell session, and to turn +tracing on in it before doing anything else there. + +## Known problems + +1. There seems to be some issue with using the bash built-in `cd` within + Makefiles. When invoked as `/bin/sh` within `Makefile`s, bash seems + to have a problem changing directory via the `cd` command. A + work-around for this is to define `SHELL=/bin/bash` within your + `Makefile`. This is believed to be a bug in bash. + +2. Many of the completion functions assume GNU versions of the various + text utilities that they call (e.g. `grep`, `sed`, and `awk`). Your + mileage may vary. + +## FAQ + +**Q. The bash completion code inhibits some commands from completing on + files with extensions that are legitimate in my environment. Do I + have to disable completion for that command in order to complete on + the files that I need to?** + +A. No. Use `M-/` to (in the words of the bash man page) attempt file + name completion on the text to the left of the cursor. This will + circumvent any file type restrictions put in place by the bash + completion code. + +**Q. How can I override a completion shipped by bash-completion?** + +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 automatically + on demand when the respective command is being completed. + 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 + that interactive bash shells will find it and source it?** + +A. Install it in one of the directories pointed to by + bash-completion's `pkgconfig` file variables. There are two + alternatives: + + - The recommended directory is `completionsdir`, which you can get with + `pkg-config --variable=completionsdir bash-completion`. From this + directory, completions are automatically loaded on demand based on invoked + commands' names, so be sure to name your completion file accordingly, and + to include (for example) symbolic links in case the file provides + completions for more than one command. + - The other directory (which only present for backwards compatibility) + is `compatdir` (get it with + `pkg-config --variable=compatdir bash-completion`) from which files + are loaded when `bash_completion` is loaded. + + For packages using GNU autotools the installation can be handled + for example like this in `configure.ac`: + + ```m4 + PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , + bashcompdir="${sysconfdir}/bash_completion.d") + AC_SUBST(bashcompdir) + ``` + + ...accompanied by this in `Makefile.am`: + + ```makefile + bashcompdir = @bashcompdir@ + dist_bashcomp_DATA = # completion files go here + ``` + + For cmake we ship the `bash-completion-config.cmake` and + `bash-completion-config-version.cmake` files. Example usage: + + ```cmake + find_package(bash-completion) + if(BASH_COMPLETION_FOUND) + message(STATUS + "Using bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + else() + set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d") + message (STATUS + "Using fallback bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + endif() + + install(FILES your-completion-file DESTINATION + ${BASH_COMPLETION_COMPLETIONSDIR}) + ``` + +**Q. I use CVS in combination with passwordless SSH access to my remote + repository. How can I have the `cvs` command complete on remotely + checked-out files where relevant?** + +A. Define `$COMP_CVS_REMOTE`. Setting this to anything will result in + the behaviour you would like. + +**Q. When I'm running a `./configure` script and completion returns a list + of long options to me, some of these take a parameter, + e.g. `--this-option=DESCRIPTION`.** + + **Running `./configure --help` lists these descriptions, but + everything after the `=` is stripped when returning completions, so + I don't know what kind of data is expected as a given option's + parameter.** + + **Is there a way of getting `./configure` completion to return the + entire option string, so that I can see what kind of data is + required and then simply delete the descriptive text and add my own + data?** + +A. Define `$COMP_CONFIGURE_HINTS`. Setting this to anything will + result in the behaviour you would like. + +**Q. When doing tar completion on a file within a tar file like this:** + + ```shell + tar tzvf foo.tar.gz <Tab> + ``` + + **the pathnames contained in the tar file are not displayed + correctly. The slashes are removed, and everything looks like it's + in a single directory. Why is this?** + +A. It's a choice we had to make. bash's programmable completion is + limited in how it handles the list of possible completions it + returns. + + Because the paths returned from within the tar file are likely not + existing paths on the file system, `-o dirnames` must be passed to + the `complete` built-in to make it treat them as such. However, + then bash will append a space when completing on directories during + pathname completion to the tar files themselves. + + It's more important to have proper completion of paths to tar files + than it is to have completion for their contents, so this sacrifice + was made and `-o filenames` is used with complete instead. + + If you would rather have correct path completion for tar file + contents, define `$COMP_TAR_INTERNAL_PATHS` *before* sourcing + `bash_completion`. + +**Q. When completing on a symlink to a directory, bash does not append + the trailing `/` and I have to hit <kbd><Tab></kbd> again. + I don't like this.** + +A. This has nothing to do with `bash_completion`. It's the default for + completing symlinks to directories since bash 2.05a, and was added + because sometimes you want to operate on the symlink itself, rather + than what it points to. + + You can get the pre-2.05a behaviour back by putting `set + mark-symlinked-directories on` in your `/etc/inputrc` or + `~/.inputrc` file. + +**Q. Completion goes awry when I try to complete on something that contains + a colon.** + +A. This is actually a 'feature' of bash. bash recognises a colon as + starting a new completion token, which is often what you want when + completing something like a `PATH` variable: + + ```shell + export PATH=/bin:/sbin:/usr<Tab> + ``` + + Without the special treatment of the colon, the above wouldn't work + without programmable completion, so it has long been a feature of + the shell. + + Unfortunately, you don't want the colon to be treated as a special + case when doing something like: + + ```shell + man File::B<Tab> + ``` + + Here, the colons make bash think that it's completing a new token + that begins with 'B'. + + Unfortunately, there's no way to turn this off. The only thing you + can do is escape the colons with a backslash. + +**Q. Why is `rpm` completion so slow with `-q`?** + +A. Probably because the database is being queried every time and this uses a + lot of memory. + + You can make this faster by pregenerating the list of installed + packages on the system. Make sure you have a readable file called + `/var/log/rpmpkgs`. It's generated by `/etc/cron.daily/rpm` on + some Red Hat and Mandrake and derivative Linux systems. + + If you don't have such a cron job, make one: + + ```shell + #!/bin/sh + + rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ + | sort >/var/log/rpmpkgs + ``` + + rpm completion will use this flat text file instead of the RPM database, + unless it detects that the database has changed since the file was created, + in which case it will still use the database to ensure accuracy. + +**Q. bash-completion interferes with my `command_not_found_handler` function!** + +A. If your `command_not_found_handler` function is not intended to + address (possibly missing) commands invoked during bash + programmable completion functions, you can account for this + by, for example, testing if the `$COMP_`\* variables are set and + taking appropriate bypass or other action. + +**Q. Can tab completion be made even easier?** + +A. The `readline(3)` library offers a few settings that can make tab + completion easier (or at least different) to use. + + For example, try putting the following in either `/etc/inputrc` or + `~/.inputrc`: + + ```inputrc + set show-all-if-ambiguous on + ``` + + This will allow single tab completion as opposed to requiring a + double tab. This makes things much more pleasant, in our opinion. + + ```inputrc + set visible-stats on + ``` + + This will suffix each returned file completion with a character + denoting its type, in a similar way to `ls(1)` with `-F` or `--classify`. + + ```inputrc + set page-completions off + ``` + + This turns off the use of the internal pager when returning long + completion lists. + +**Q. Is bash the be-all-and-end-all of completion as far as shells go?** + +A. Absolutely not. zsh has an extremely sophisticated completion system + that offers many features absent from the bash implementation. Its + users often cannot resist pointing this out. More information can + be found at <https://www.zsh.org/>. diff --git a/bash-completion-config-version.cmake.in b/bash-completion-config-version.cmake.in new file mode 100644 index 0000000..265e075 --- /dev/null +++ b/bash-completion-config-version.cmake.in @@ -0,0 +1,7 @@ +set (PACKAGE_VERSION "@VERSION@") +if (NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_COMPATIBLE 1) + if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_EXACT 1) + endif () +endif () diff --git a/bash-completion-config.cmake.in b/bash-completion-config.cmake.in new file mode 100644 index 0000000..2b7de6c --- /dev/null +++ b/bash-completion-config.cmake.in @@ -0,0 +1,12 @@ +# config file for bash-completion +# https://github.com/scop/bash-completion + +set (BASH_COMPLETION_VERSION "@VERSION@") + +set (BASH_COMPLETION_PREFIX "@prefix@") + +set (BASH_COMPLETION_COMPATDIR "@sysconfdir@/bash_completion.d") +set (BASH_COMPLETION_COMPLETIONSDIR "@datadir@/@PACKAGE@/completions") +set (BASH_COMPLETION_HELPERSDIR "@datadir@/@PACKAGE@/helpers") + +set (BASH_COMPLETION_FOUND "TRUE") diff --git a/bash-completion.pc.in b/bash-completion.pc.in new file mode 100644 index 0000000..f0a3572 --- /dev/null +++ b/bash-completion.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +compatdir=${sysconfdir}/bash_completion.d +completionsdir=${datadir}/@PACKAGE@/completions +helpersdir=${datadir}/@PACKAGE@/helpers + +Name: @PACKAGE@ +Description: programmable completion for the bash shell +URL: https://github.com/scop/bash-completion +Version: @VERSION@ diff --git a/bash_completion b/bash_completion new file mode 100644 index 0000000..1a7f563 --- /dev/null +++ b/bash_completion @@ -0,0 +1,2266 @@ +# -*- shell-script -*- +# +# bash_completion - programmable completion functions for bash 4.2+ +# +# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> +# © 2009-2020, Bash Completion Maintainers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# The latest version of this software can be obtained here: +# +# https://github.com/scop/bash-completion + +BASH_COMPLETION_VERSINFO=(2 11) + +if [[ $- == *v* ]]; then + BASH_COMPLETION_ORIGINAL_V_VALUE="-v" +else + BASH_COMPLETION_ORIGINAL_V_VALUE="+v" +fi + +if [[ ${BASH_COMPLETION_DEBUG-} ]]; then + set -v +else + set +v +fi + +# Blacklisted completions, causing problems with our code. +# +_blacklist_glob='@(acroread.sh)' + +# Turn on extended globbing and programmable completion +shopt -s extglob progcomp + +# A lot of the following one-liners were taken directly from the +# completion examples provided with the bash 2.04 source distribution + +# start of section containing compspecs that can be handled within bash + +# user commands see only users +complete -u groups slay w sux + +# bg completes with stopped jobs +complete -A stopped -P '"%' -S '"' bg + +# other job commands +complete -j -P '"%' -S '"' fg jobs disown + +# readonly and unset complete with shell variables +complete -v readonly unset + +# set completes with set options +complete -A setopt set + +# shopt completes with shopt options +complete -A shopt shopt + +# helptopics +complete -A helptopic help + +# unalias completes with aliases +complete -a unalias + +# type and which complete on commands +complete -c command type which + +# builtin completes on builtins +complete -b builtin + +# start of section containing completion functions called by other functions + +# Check if we're running on the given userland +# @param $1 userland to check for +_userland() +{ + local userland=$(uname -s) + [[ $userland == @(Linux|GNU/*) ]] && userland=GNU + [[ $userland == "$1" ]] +} + +# This function sets correct SysV init directories +# +_sysvdirs() +{ + sysvdirs=() + [[ -d /etc/rc.d/init.d ]] && sysvdirs+=(/etc/rc.d/init.d) + [[ -d /etc/init.d ]] && sysvdirs+=(/etc/init.d) + # Slackware uses /etc/rc.d + [[ -f /etc/slackware-version ]] && sysvdirs=(/etc/rc.d) + return 0 +} + +# This function checks whether we have a given program on the system. +# +_have() +{ + # Completions for system administrator commands are installed as well in + # case completion is attempted via `sudo command ...'. + PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null +} + +# Backwards compatibility for compat completions that use have(). +# @deprecated should no longer be used; generally not needed with dynamically +# loaded completions, and _have is suitable for runtime use. +have() +{ + unset -v have + _have $1 && have=yes +} + +# This function checks whether a given readline variable +# is `on'. +# +_rl_enabled() +{ + [[ "$(bind -v)" == *$1+([[:space:]])on* ]] +} + +# This function shell-quotes the argument +quote() +{ + local quoted=${1//\'/\'\\\'\'} + printf "'%s'" "$quoted" +} + +# @see _quote_readline_by_ref() +quote_readline() +{ + local ret + _quote_readline_by_ref "$1" ret + printf %s "$ret" +} # quote_readline() + +# This function shell-dequotes the argument +dequote() +{ + eval printf %s "$1" 2>/dev/null +} + +# Assign variable one scope above the caller +# Usage: local "$1" && _upvar $1 "value(s)" +# Param: $1 Variable name to assign value to +# Param: $* Value(s) to assign. If multiple values, an array is +# assigned, otherwise a single value is assigned. +# NOTE: For assigning multiple variables, use '_upvars'. Do NOT +# use multiple '_upvar' calls, since one '_upvar' call might +# reassign a variable to be used by another '_upvar' call. +# See: https://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 + else + eval $1=\(\"\$"{@:2}"\"\) # Return array + fi + fi +} + +# Assign variables one scope above the caller +# Usage: local varname [varname ...] && +# _upvars [-v varname value] | [-aN varname [value ...]] ... +# Available OPTIONS: +# -aN Assign next N values to varname as array +# -v Assign single value to varname +# Return: 1 if error occurs +# See: https://fvue.nl/wiki/Bash:_Passing_variables_by_reference +_upvars() +{ + if ! (($#)); then + 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_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_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_completion: $FUNCNAME: $1:" \ + "missing argument(s)" >&2 + return 1 + } + ;; + *) + echo "bash_completion: $FUNCNAME: $1: invalid option" >&2 + return 1 + ;; + esac + done +} + +# Reassemble command line words, excluding specified characters from the +# list of word completion separators (COMP_WORDBREAKS). +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 here. +# @param $2 words Name of variable to return words to +# @param $3 cword Name of variable to return cword to +# +__reassemble_comp_words_by_ref() +{ + local exclude i j line ref + # Exclude word separator characters? + if [[ $1 ]]; then + # Yes, exclude word separator characters; + # Exclude only those characters, which were really included + exclude="[${1//[^$COMP_WORDBREAKS]/}]" + fi + + # Default to cword unchanged + printf -v "$3" %s "$COMP_CWORD" + # Are characters excluded which were former included? + if [[ -v exclude ]]; then + # Yes, list of word completion separators has shrunk; + line=$COMP_LINE + # Re-assemble words to complete + for ((i = 0, j = 0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Is current word not word 0 (the command itself) and is word not + # empty and is word made up of just word separator characters to + # be excluded and is current word not preceded by whitespace in + # original line? + while [[ $i -gt 0 && ${COMP_WORDS[i]} == +($exclude) ]]; do + # Is word separator not preceded by whitespace in original line + # and are we not going to append to word 0 (the command + # itself), then append to current word. + [[ $line != [[:blank:]]* ]] && ((j >= 2)) && ((j--)) + # Append word separator to current or new word + ref="$2[$j]" + printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}" + # Indicate new cword + ((i == COMP_CWORD)) && printf -v "$3" %s "$j" + # Remove optional whitespace + word separator from line copy + line=${line#*"${COMP_WORDS[i]}"} + # Start new word if word separator in original line is + # followed by whitespace. + [[ $line == [[:blank:]]* ]] && ((j++)) + # Indicate next word if available, else end *both* while and + # for loop + ((i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2 + done + # Append word to current word + ref="$2[$j]" + printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}" + # Remove optional whitespace + word from line copy + line=${line#*"${COMP_WORDS[i]}"} + # Indicate new cword + ((i == COMP_CWORD)) && printf -v "$3" %s "$j" + done + ((i == COMP_CWORD)) && printf -v "$3" %s "$j" + else + # No, list of word completions separators hasn't changed; + for i in "${!COMP_WORDS[@]}"; do + printf -v "$2[i]" %s "${COMP_WORDS[i]}" + done + fi +} # __reassemble_comp_words_by_ref() + +# @param $1 exclude Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 in this case. +# @param $2 words Name of variable to return words to +# @param $3 cword Name of variable to return cword to +# @param $4 cur Name of variable to return current word to complete to +# @see __reassemble_comp_words_by_ref() +__get_cword_at_cursor_by_ref() +{ + local cword words=() + __reassemble_comp_words_by_ref "$1" words cword + + local i cur="" index=$COMP_POINT lead=${COMP_LINE:0:COMP_POINT} + # Cursor not at position 0 and not leaded by just space(s)? + if [[ $index -gt 0 && ($lead && ${lead//[[:space:]]/}) ]]; then + cur=$COMP_LINE + for ((i = 0; i <= cword; ++i)); do + # Current word fits in $cur, and $cur doesn't match cword? + while [[ ${#cur} -ge ${#words[i]} && \ + ${cur:0:${#words[i]}} != "${words[i]-}" ]]; do + # Strip first character + cur="${cur:1}" + # Decrease cursor position, staying >= 0 + ((index > 0)) && ((index--)) + done + + # Does found word match cword? + if ((i < cword)); then + # No, cword lies further; + local old_size=${#cur} + cur="${cur#"${words[i]}"}" + local new_size=${#cur} + ((index -= old_size - new_size)) + fi + done + # Clear $cur if just space(s) + [[ $cur && ! ${cur//[[:space:]]/} ]] && cur= + # Zero $index if negative + ((index < 0)) && index=0 + fi + + local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 ${words+"${words[@]}"} \ + -v $3 "$cword" -v $4 "${cur:0:index}" +} + +# Get the word to complete and optional previous words. +# This is nicer than ${COMP_WORDS[COMP_CWORD]}, since it handles cases +# where the user is completing in the middle of a word. +# (For example, if the line is "ls foobar", +# and the cursor is here --------> ^ +# Also one is able to cross over possible wordbreak characters. +# Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES] +# Available VARNAMES: +# cur Return cur via $cur +# prev Return prev via $prev +# words Return words via $words +# cword Return cword via $cword +# +# Available OPTIONS: +# -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp +# where we want to return host:path and not only path, so we +# would pass the colon (:) as -n option in this case. +# -c VARNAME Return cur via $VARNAME +# -p VARNAME Return prev via $VARNAME +# -w VARNAME Return words via $VARNAME +# -i VARNAME Return cword via $VARNAME +# +# Example usage: +# +# $ _get_comp_words_by_ref -n : cur prev +# +_get_comp_words_by_ref() +{ + local exclude flag i OPTIND=1 + local cur cword words=() + local upargs=() upvars=() vcur vcword vprev vwords + + while getopts "c:i:n:p:w:" flag "$@"; do + case $flag in + c) vcur=$OPTARG ;; + i) vcword=$OPTARG ;; + n) exclude=$OPTARG ;; + p) vprev=$OPTARG ;; + w) vwords=$OPTARG ;; + *) + echo "bash_completion: $FUNCNAME: usage error" >&2 + return 1 + ;; + esac + done + while [[ $# -ge $OPTIND ]]; do + case ${!OPTIND} in + cur) vcur=cur ;; + prev) vprev=prev ;; + cword) vcword=cword ;; + words) vwords=words ;; + *) + echo "bash_completion: $FUNCNAME: \`${!OPTIND}':" \ + "unknown argument" >&2 + return 1 + ;; + esac + ((OPTIND += 1)) + done + + __get_cword_at_cursor_by_ref "${exclude-}" words cword cur + + [[ -v vcur ]] && { + upvars+=("$vcur") + upargs+=(-v $vcur "$cur") + } + [[ -v vcword ]] && { + upvars+=("$vcword") + upargs+=(-v $vcword "$cword") + } + [[ -v vprev && $cword -ge 1 ]] && { + upvars+=("$vprev") + upargs+=(-v $vprev "${words[cword - 1]}") + } + [[ -v vwords ]] && { + upvars+=("$vwords") + upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"}) + } + + ((${#upvars[@]})) && local "${upvars[@]}" && _upvars "${upargs[@]}" +} + +# Get the word to complete. +# This is nicer than ${COMP_WORDS[COMP_CWORD]}, since it handles cases +# where the user is completing in the middle of a word. +# (For example, if the line is "ls foobar", +# and the cursor is here --------> ^ +# @param $1 string Characters out of $COMP_WORDBREAKS which should NOT be +# considered word breaks. This is useful for things like scp where +# we want to return host:path and not only path, so we would pass the +# colon (:) as $1 in this case. +# @param $2 integer Index number of word to return, negatively offset to the +# current word (default is 0, previous is 1), respecting the exclusions +# given at $1. For example, `_get_cword "=:" 1' returns the word left of +# the current word, respecting the exclusions "=:". +# @deprecated Use `_get_comp_words_by_ref cur' instead +# @see _get_comp_words_by_ref() +_get_cword() +{ + local LC_CTYPE=C + local cword words + __reassemble_comp_words_by_ref "${1-}" words cword + + # return previous word offset by $2 + if [[ ${2-} && ${2//[^0-9]/} ]]; then + printf "%s" "${words[cword - $2]}" + elif ((${#words[cword]} == 0 && COMP_POINT == ${#COMP_LINE})); then + : # nothing + else + local i + local cur="$COMP_LINE" + local index="$COMP_POINT" + for ((i = 0; i <= cword; ++i)); do + # Current word fits in $cur, and $cur doesn't match cword? + while [[ ${#cur} -ge ${#words[i]} && \ + ${cur:0:${#words[i]}} != "${words[i]}" ]]; do + # Strip first character + cur="${cur:1}" + # Decrease cursor position, staying >= 0 + ((index > 0)) && ((index--)) + done + + # Does found word match cword? + if ((i < cword)); then + # No, cword lies further; + local old_size="${#cur}" + cur="${cur#${words[i]}}" + local new_size="${#cur}" + ((index -= old_size - new_size)) + fi + done + + if [[ ${words[cword]:0:${#cur}} != "$cur" ]]; then + # We messed up! At least return the whole word so things + # keep working + printf "%s" "${words[cword]}" + else + printf "%s" "${cur:0:index}" + fi + fi +} # _get_cword() + +# Get word previous to the current word. +# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4 +# will properly return the previous word with respect to any given exclusions to +# COMP_WORDBREAKS. +# @deprecated Use `_get_comp_words_by_ref cur prev' instead +# @see _get_comp_words_by_ref() +# +_get_pword() +{ + if ((COMP_CWORD >= 1)); then + _get_cword "${@:-}" 1 + fi +} + +# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with +# word-to-complete. +# With a colon in COMP_WORDBREAKS, words containing +# colons are always completed as entire words if the word to complete contains +# a colon. This function fixes this, by removing the colon-containing-prefix +# from COMPREPLY items. +# The preferred solution is to remove the colon (:) from COMP_WORDBREAKS in +# your .bashrc: +# +# # Remove colon (:) from list of word completion separators +# COMP_WORDBREAKS=${COMP_WORDBREAKS//:} +# +# See also: Bash FAQ - E13) Why does filename completion misbehave if a colon +# appears in the filename? - https://tiswww.case.edu/php/chet/bash/FAQ +# @param $1 current word to complete (cur) +# @modifies global array $COMPREPLY +# +__ltrim_colon_completions() +{ + if [[ $1 == *:* && $COMP_WORDBREAKS == *:* ]]; then + # Remove colon-word prefix from COMPREPLY items + local colon_word=${1%"${1##*:}"} + local i=${#COMPREPLY[*]} + while ((i-- > 0)); do + COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"} + done + fi +} # __ltrim_colon_completions() + +# This function quotes the argument in a way so that readline dequoting +# results in the original argument. This is necessary for at least +# `compgen' which requires its arguments quoted/escaped: +# +# $ ls "a'b/" +# c +# $ compgen -f "a'b/" # Wrong, doesn't return output +# $ compgen -f "a\'b/" # Good +# a\'b/c +# +# See also: +# - https://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html +# - https://www.mail-archive.com/bash-completion-devel@lists.alioth.debian.org/msg01944.html +# @param $1 Argument to quote +# @param $2 Name of variable to return result to +_quote_readline_by_ref() +{ + if [[ $1 == \'* ]]; then + # Leave out first character + printf -v $2 %s "${1:1}" + else + printf -v $2 %q "$1" + fi + + # If result becomes quoted like this: $'string', re-evaluate in order to + # drop the additional quoting. See also: + # https://www.mail-archive.com/bash-completion-devel@lists.alioth.debian.org/msg01942.html + [[ ${!2} == \$* ]] && eval $2=${!2} +} # _quote_readline_by_ref() + +# This function performs file and directory completion. It's better than +# simply using 'compgen -f', because it honours spaces in filenames. +# @param $1 If `-d', complete only on directories. Otherwise filter/pick only +# completions with `.$1' and the uppercase version of it as file +# extension. +# +_filedir() +{ + local IFS=$'\n' + + _tilde "${cur-}" || return + + local -a toks + local reset arg=${1-} + + if [[ $arg == -d ]]; then + reset=$(shopt -po noglob) + set -o noglob + toks=($(compgen -d -- "${cur-}")) + IFS=' ' + $reset + IFS=$'\n' + else + local quoted + _quote_readline_by_ref "${cur-}" quoted + + # Munge xspec to contain uppercase version too + # https://lists.gnu.org/archive/html/bug-bash/2010-09/msg00036.html + # news://news.gmane.io/4C940E1C.1010304@case.edu + local xspec=${arg:+"!*.@($arg|${arg^^})"} plusdirs=() + + # Use plusdirs to get dir completions if we have a xspec; if we don't, + # there's no need, dirs come along with other completions. Don't use + # plusdirs quite yet if fallback is in use though, in order to not ruin + # the fallback condition with the "plus" dirs. + local opts=(-f -X "$xspec") + [[ $xspec ]] && plusdirs=(-o plusdirs) + [[ ${COMP_FILEDIR_FALLBACK-} || -z ${plusdirs-} ]] || + opts+=("${plusdirs[@]}") + + reset=$(shopt -po noglob) + set -o noglob + toks+=($(compgen "${opts[@]}" -- $quoted)) + IFS=' ' + $reset + IFS=$'\n' + + # Try without filter if it failed to produce anything and configured to + [[ -n ${COMP_FILEDIR_FALLBACK-} && -n $arg && ${#toks[@]} -lt 1 ]] && { + reset=$(shopt -po noglob) + set -o noglob + toks+=($(compgen -f ${plusdirs+"${plusdirs[@]}"} -- $quoted)) + IFS=' ' + $reset + IFS=$'\n' + } + fi + + if ((${#toks[@]} != 0)); then + # 2>/dev/null for direct invocation, e.g. in the _filedir unit test + compopt -o filenames 2>/dev/null + COMPREPLY+=("${toks[@]}") + fi +} # _filedir() + +# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it +# easier to support both "--foo bar" and "--foo=bar" style completions. +# `=' should have been removed from COMP_WORDBREAKS when setting $cur for +# this to be useful. +# Returns 0 if current option was split, 1 otherwise. +# +_split_longopt() +{ + if [[ $cur == --?*=* ]]; then + # Cut also backslash before '=' in case it ended up there + # for some reason. + prev="${cur%%?(\\)=*}" + cur="${cur#*=}" + return 0 + fi + + return 1 +} + +# Complete variables. +# @return True (0) if variables were completed, +# False (> 0) if not. +_variables() +{ + if [[ $cur =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]; then + # Completing $var / ${var / ${!var / ${#var + if [[ $cur == '${'* ]]; then + local arrs vars + vars=($(compgen -A variable -P ${BASH_REMATCH[1]} -S '}' -- ${BASH_REMATCH[3]})) + arrs=($(compgen -A arrayvar -P ${BASH_REMATCH[1]} -S '[' -- ${BASH_REMATCH[3]})) + if ((${#vars[@]} == 1 && ${#arrs[@]} != 0)); then + # Complete ${arr with ${array[ if there is only one match, and that match is an array variable + compopt -o nospace + COMPREPLY+=(${arrs[*]}) + else + # Complete ${var with ${variable} + COMPREPLY+=(${vars[*]}) + fi + else + # Complete $var with $variable + COMPREPLY+=($(compgen -A variable -P '$' -- "${BASH_REMATCH[3]}")) + fi + return 0 + elif [[ $cur =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]; then + # Complete ${array[i with ${array[idx]} + local IFS=$'\n' + COMPREPLY+=($(compgen -W '$(printf %s\\n "${!'${BASH_REMATCH[2]}'[@]}")' \ + -P "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[" -S ']}' -- "${BASH_REMATCH[3]}")) + # Complete ${arr[@ and ${arr[* + if [[ ${BASH_REMATCH[3]} == [@*] ]]; then + COMPREPLY+=("${BASH_REMATCH[1]}${BASH_REMATCH[2]}[${BASH_REMATCH[3]}]}") + fi + __ltrim_colon_completions "$cur" # array indexes may have colons + return 0 + elif [[ $cur =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*\]$ ]]; then + # Complete ${array[idx] with ${array[idx]} + COMPREPLY+=("$cur}") + __ltrim_colon_completions "$cur" + return 0 + else + case ${prev-} in + TZ) + cur=/usr/share/zoneinfo/$cur + _filedir + for i in "${!COMPREPLY[@]}"; do + if [[ ${COMPREPLY[i]} == *.tab ]]; then + unset 'COMPREPLY[i]' + continue + elif [[ -d ${COMPREPLY[i]} ]]; then + COMPREPLY[i]+=/ + compopt -o nospace + fi + COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/} + done + return 0 + ;; + TERM) + _terms + return 0 + ;; + LANG | LC_*) + COMPREPLY=($(compgen -W '$(locale -a 2>/dev/null)' \ + -- "$cur")) + return 0 + ;; + esac + fi + return 1 +} + +# Initialize completion and deal with various general things: do file +# and variable completion where appropriate, and adjust prev, words, +# and cword as if no redirections exist so that completions do not +# need to deal with them. Before calling this function, make sure +# cur, prev, words, and cword are local, ditto split if you use -s. +# +# Options: +# -n EXCLUDE Passed to _get_comp_words_by_ref -n with redirection chars +# -e XSPEC Passed to _filedir as first arg for stderr redirections +# -o XSPEC Passed to _filedir as first arg for other output redirections +# -i XSPEC Passed to _filedir as first arg for stdin redirections +# -s Split long options with _split_longopt, implies -n = +# @return True (0) if completion needs further processing, +# False (> 0) no further processing is necessary. +# +_init_completion() +{ + local exclude="" flag outx errx inx OPTIND=1 + + while getopts "n:e:o:i:s" flag "$@"; do + case $flag in + n) exclude+=$OPTARG ;; + e) errx=$OPTARG ;; + o) outx=$OPTARG ;; + i) inx=$OPTARG ;; + s) + split=false + exclude+== + ;; + *) + echo "bash_completion: $FUNCNAME: usage error" >&2 + return 1 + ;; + esac + done + + COMPREPLY=() + local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)" + _get_comp_words_by_ref -n "$exclude<>&" cur prev words cword + + # Complete variable names. + _variables && return 1 + + # Complete on files if current is a redirect possibly followed by a + # filename, e.g. ">foo", or previous is a "bare" redirect, e.g. ">". + # shellcheck disable=SC2053 + if [[ $cur == $redir* || ${prev-} == $redir ]]; then + local xspec + case $cur in + 2'>'*) xspec=${errx-} ;; + *'>'*) xspec=${outx-} ;; + *'<'*) xspec=${inx-} ;; + *) + case $prev in + 2'>'*) xspec=${errx-} ;; + *'>'*) xspec=${outx-} ;; + *'<'*) xspec=${inx-} ;; + esac + ;; + esac + cur="${cur##$redir}" + _filedir $xspec + return 1 + fi + + # Remove all redirections so completions don't have to deal with them. + local i skip + for ((i = 1; i < ${#words[@]}; )); do + if [[ ${words[i]} == $redir* ]]; then + # If "bare" redirect, remove also the next word (skip=2). + # shellcheck disable=SC2053 + [[ ${words[i]} == $redir ]] && skip=2 || skip=1 + words=("${words[@]:0:i}" "${words[@]:i+skip}") + ((i <= cword)) && ((cword -= skip)) + else + ((i++)) + fi + done + + ((cword <= 0)) && return 1 + prev=${words[cword - 1]} + + [[ ${split-} ]] && _split_longopt && split=true + + return 0 +} + +# Helper function for _parse_help and _parse_usage. +__parse_options() +{ + local option option2 i IFS=$' \t\n,/|' + + # Take first found long option, or first one (short) if not found. + option= + local -a array=($1) + for i in "${array[@]}"; do + case "$i" in + ---*) break ;; + --?*) + option=$i + break + ;; + -?*) [[ $option ]] || option=$i ;; + *) break ;; + esac + done + [[ $option ]] || return 0 + + IFS=$' \t\n' # affects parsing of the regexps below... + + # Expand --[no]foo to --foo and --nofoo etc + if [[ $option =~ (\[((no|dont)-?)\]). ]]; then + option2=${option/"${BASH_REMATCH[1]}"/} + option2=${option2%%[<{().[]*} + printf '%s\n' "${option2/=*/=}" + option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"} + fi + + option=${option%%[<{().[]*} + printf '%s\n' "${option/=*/=}" +} + +# Parse GNU style help output of the given command. +# @param $1 command; if "-", read from stdin and ignore rest of args +# @param $2 command options (default: --help) +# +_parse_help() +{ + eval local cmd="$(quote "$1")" + local line + { + case $cmd in + -) cat ;; + *) LC_ALL=C "$(dequote "$cmd")" ${2:---help} 2>&1 ;; + esac + } | + while read -r line; do + + [[ $line == *([[:blank:]])-* ]] || continue + # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc + while [[ $line =~ \ + ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+([,_-]+[A-Z0-9]+)?(\.\.+)?\]? ]]; do + line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"} + done + __parse_options "${line// or /, }" + + done +} + +# Parse BSD style usage output (options in brackets) of the given command. +# @param $1 command; if "-", read from stdin and ignore rest of args +# @param $2 command options (default: --usage) +# +_parse_usage() +{ + eval local cmd="$(quote "$1")" + local line match option i char + { + case $cmd in + -) cat ;; + *) LC_ALL=C "$(dequote "$cmd")" ${2:---usage} 2>&1 ;; + esac + } | + while read -r line; do + + while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do + match=${BASH_REMATCH[0]} + option=${BASH_REMATCH[1]} + case $option in + -?(\[)+([a-zA-Z0-9?])) + # Treat as bundled short options + for ((i = 1; i < ${#option}; i++)); do + char=${option:i:1} + [[ $char != '[' ]] && printf '%s\n' -$char + done + ;; + *) + __parse_options "$option" + ;; + esac + line=${line#*"$match"} + done + + done +} + +# This function completes on signal names (minus the SIG prefix) +# @param $1 prefix +_signals() +{ + local -a sigs=($(compgen -P "${1-}" -A signal "SIG${cur#${1-}}")) + COMPREPLY+=("${sigs[@]/#${1-}SIG/${1-}}") +} + +# This function completes on known mac addresses +# +_mac_addresses() +{ + local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}' + local PATH="$PATH:/sbin:/usr/sbin" + + # Local interfaces + # - ifconfig on Linux: HWaddr or ether + # - ifconfig on FreeBSD: ether + # - ip link: link/ether + COMPREPLY+=($( + { + LC_ALL=C ifconfig -a || ip link show + } 2>/dev/null | command sed -ne \ + "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne \ + "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne \ + "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne \ + "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$|\2|p" + )) + + # ARP cache + COMPREPLY+=($({ + arp -an || ip neigh show + } 2>/dev/null | command sed -ne \ + "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \ + "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p")) + + # /etc/ethers + COMPREPLY+=($(command sed -ne \ + "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null)) + + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + __ltrim_colon_completions "$cur" +} + +# This function completes on configured network interfaces +# +_configured_interfaces() +{ + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=($(compgen -W "$(command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p' \ + /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null)" \ + -- "$cur")) + elif [[ -f /etc/SuSE-release ]]; then + # SuSE system + COMPREPLY=($(compgen -W "$(printf '%s\n' \ + /etc/sysconfig/network/ifcfg-* | + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")) + elif [[ -f /etc/pld-release ]]; then + # PLD Linux + COMPREPLY=($(compgen -W "$(command ls -B \ + /etc/sysconfig/interfaces | + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")) + else + # Assume Red Hat + COMPREPLY=($(compgen -W "$(printf '%s\n' \ + /etc/sysconfig/network-scripts/ifcfg-* | + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")) + fi +} + +# Local IP addresses. +# -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' ;; + *) n= ;; + esac + local PATH=$PATH:/sbin + 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")) +} + +# This function completes on all available network interfaces +# -a: restrict to active interfaces only +# -w: restrict to wireless interfaces only +# +_available_interfaces() +{ + local PATH=$PATH:/sbin + + COMPREPLY=($({ + if [[ ${1:-} == -w ]]; then + iwconfig + elif [[ ${1:-} == -a ]]; then + ifconfig || ip link show up + else + ifconfig -a || ip link show + fi + } 2>/dev/null | awk \ + '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')) + + COMPREPLY=($(compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur")) +} + +# Echo number of CPUs, falling back to 1 on failure. +_ncpus() +{ + local var=NPROCESSORS_ONLN + [[ $OSTYPE == *linux* ]] && var=_$var + local n=$(getconf $var 2>/dev/null) + printf %s ${n:-1} +} + +# Perform tilde (~) completion +# @return True (0) if completion needs further processing, +# False (> 0) if tilde is followed by a valid username, completions +# are put in COMPREPLY and no further processing is necessary. +_tilde() +{ + local result=0 + if [[ ${1-} == \~* && $1 != */* ]]; then + # Try generate ~username completions + COMPREPLY=($(compgen -P '~' -u -- "${1#\~}")) + result=${#COMPREPLY[@]} + # 2>/dev/null for direct invocation, e.g. in the _tilde unit test + ((result > 0)) && compopt -o filenames 2>/dev/null + fi + return $result +} + +# Expand variable starting with tilde (~) +# We want to expand ~foo/... to /home/foo/... to avoid problems when +# word-to-complete starting with a tilde is fed to commands and ending up +# quoted instead of expanded. +# Only the first portion of the variable from the tilde up to the first slash +# (~../) is expanded. The remainder of the variable, containing for example +# a dollar sign variable ($) or asterisk (*) is not expanded. +# Example usage: +# +# $ v="~"; __expand_tilde_by_ref v; echo "$v" +# +# Example output: +# +# v output +# -------- ---------------- +# ~ /home/user +# ~foo/bar /home/foo/bar +# ~foo/$HOME /home/foo/$HOME +# ~foo/a b /home/foo/a b +# ~foo/* /home/foo/* +# +# @param $1 Name of variable (not the value of the variable) to expand +__expand_tilde_by_ref() +{ + if [[ ${!1-} == \~* ]]; then + eval $1="$(printf ~%q "${!1#\~}")" + fi +} # __expand_tilde_by_ref() + +# This function expands tildes in pathnames +# +_expand() +{ + # Expand ~username type directory specifications. We want to expand + # ~foo/... to /home/foo/... to avoid problems when $cur starting with + # a tilde is fed to commands and ending up quoted instead of expanded. + + case ${cur-} in + ~*/*) + __expand_tilde_by_ref cur + ;; + ~*) + _tilde "$cur" || + eval COMPREPLY[0]="$(printf ~%q "${COMPREPLY[0]#\~}")" + return ${#COMPREPLY[@]} + ;; + esac +} + +# Process ID related functions. +# for AIX and Solaris we use X/Open syntax, BSD for others. +if [[ $OSTYPE == *@(solaris|aix)* ]]; then + # This function completes on process IDs. + _pids() + { + COMPREPLY=($(compgen -W '$(command ps -efo pid | command sed 1d)' -- "$cur")) + } + + _pgids() + { + COMPREPLY=($(compgen -W '$(command ps -efo pgid | command sed 1d)' -- "$cur")) + } + _pnames() + { + COMPREPLY=($(compgen -X '<defunct>' -W '$(command ps -efo comm | \ + command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u)' -- "$cur")) + } +else + _pids() + { + COMPREPLY=($(compgen -W '$(command ps axo pid=)' -- "$cur")) + } + _pgids() + { + COMPREPLY=($(compgen -W '$(command ps axo pgid=)' -- "$cur")) + } + # @param $1 if -s, don't try to avoid truncated command names + _pnames() + { + local -a procs + if [[ ${1-} == -s ]]; then + procs=($(command ps axo comm | command sed -e 1d)) + else + local line i=-1 ifs=$IFS + IFS=$'\n' + local -a psout=($(command ps axo command=)) + IFS=$ifs + for line in "${psout[@]}"; do + if ((i == -1)); then + # First line, see if it has COMMAND column header. For example + # the busybox ps does that, i.e. doesn't respect axo command= + if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then + # It does; store its index. + i=${#BASH_REMATCH[1]} + else + # Nope, fall through to "regular axo command=" parsing. + break + fi + else + # + line=${line:i} # take command starting from found index + line=${line%% *} # trim arguments + procs+=($line) + fi + done + if ((i == -1)); then + # Regular axo command= parsing + for line in "${psout[@]}"; do + if [[ $line =~ ^[[(](.+)[])]$ ]]; then + procs+=(${BASH_REMATCH[1]}) + else + line=${line%% *} # trim arguments + line=${line##@(*/|-)} # trim leading path and - + procs+=($line) + fi + done + fi + fi + COMPREPLY=($(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur")) + } +fi + +# This function completes on user IDs +# +_uids() +{ + if type getent &>/dev/null; then + COMPREPLY=($(compgen -W '$(getent passwd | cut -d: -f3)' -- "$cur")) + elif type perl &>/dev/null; then + COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"')' -- "$cur")) + else + # make do with /etc/passwd + COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/passwd)' -- "$cur")) + fi +} + +# This function completes on group IDs +# +_gids() +{ + if type getent &>/dev/null; then + COMPREPLY=($(compgen -W '$(getent group | cut -d: -f3)' -- "$cur")) + elif type perl &>/dev/null; then + COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"')' -- "$cur")) + else + # make do with /etc/group + COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/group)' -- "$cur")) + fi +} + +# Glob for matching various backup files. +# +_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))' + +# Complete on xinetd services +# +_xinetd_services() +{ + local xinetddir=${BASHCOMP_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))) + $reset + ((!${#svcs[@]})) || + COMPREPLY+=($(compgen -W '${svcs[@]#$xinetddir/}' -- "${cur-}")) + fi +} + +# This function completes on services +# +_services() +{ + local sysvdirs + _sysvdirs + + local IFS=$' \t\n' reset=$(shopt -p nullglob) + shopt -s nullglob + COMPREPLY=( + $(printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README))) + $reset + + 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)) + fi + + COMPREPLY=($(compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur")) +} + +# This completes on a list of all available service scripts for the +# 'service' command and/or the SysV init.d directory, followed by +# that script's available commands +# +_service() +{ + local cur prev words cword + _init_completion || return + + # don't complete past 2nd token + ((cword > 2)) && return + + if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then + _services + [[ -e /etc/mandrake-release ]] && _xinetd_services + else + local sysvdirs + _sysvdirs + COMPREPLY=($(compgen -W '`command sed -e "y/|/ /" \ + -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ + ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur")) + fi +} && + complete -F _service service +_sysvdirs +for svcdir in "${sysvdirs[@]}"; do + for svc in $svcdir/!($_backup_glob); do + [[ -x $svc ]] && complete -F _service $svc + done +done +unset svc svcdir sysvdirs + +# This function completes on modules +# +_modules() +{ + local modpath + modpath=/lib/modules/$1 + COMPREPLY=($(compgen -W "$(command ls -RL $modpath 2>/dev/null | + command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p')" -- "$cur")) +} + +# This function completes on installed modules +# +_installed_modules() +{ + COMPREPLY=($(compgen -W "$(PATH="$PATH:/sbin" lsmod | + awk '{if (NR != 1) print $1}')" -- "$1")) +} + +# This function completes on user or user:group format; as for chown and cpio. +# +# The : must be added manually; it will only complete usernames initially. +# The legacy user.group format is not supported. +# +# @param $1 If -u, only return users/groups the user has access to in +# context of current completion. +_usergroup() +{ + if [[ $cur == *\\\\* || $cur == *:*:* ]]; then + # Give up early on if something seems horribly wrong. + return + elif [[ $cur == *\\:* ]]; then + # Completing group after 'user\:gr<TAB>'. + # Reply with a list of groups prefixed with 'user:', readline will + # escape to the colon. + local prefix + prefix=${cur%%*([^:])} + prefix=${prefix//\\/} + local mycur="${cur#*[:]}" + if [[ ${1-} == -u ]]; then + _allowed_groups "$mycur" + else + local IFS=$'\n' + COMPREPLY=($(compgen -g -- "$mycur")) + fi + COMPREPLY=($(compgen -P "$prefix" -W "${COMPREPLY[@]}")) + elif [[ $cur == *:* ]]; then + # Completing group after 'user:gr<TAB>'. + # Reply with a list of unprefixed groups since readline with split on : + # and only replace the 'gr' part + local mycur="${cur#*:}" + if [[ ${1-} == -u ]]; then + _allowed_groups "$mycur" + else + local IFS=$'\n' + COMPREPLY=($(compgen -g -- "$mycur")) + fi + else + # Completing a partial 'usernam<TAB>'. + # + # Don't suffix with a : because readline will escape it and add a + # slash. It's better to complete into 'chown username ' than 'chown + # username\:'. + if [[ ${1-} == -u ]]; then + _allowed_users "$cur" + else + local IFS=$'\n' + COMPREPLY=($(compgen -u -- "$cur")) + fi + fi +} + +_allowed_users() +{ + if _complete_as_root; then + local IFS=$'\n' + COMPREPLY=($(compgen -u -- "${1:-$cur}")) + else + local IFS=$'\n ' + COMPREPLY=($(compgen -W \ + "$(id -un 2>/dev/null || whoami 2>/dev/null)" -- "${1:-$cur}")) + fi +} + +_allowed_groups() +{ + if _complete_as_root; then + local IFS=$'\n' + COMPREPLY=($(compgen -g -- "$1")) + else + local IFS=$'\n ' + COMPREPLY=($(compgen -W \ + "$(id -Gn 2>/dev/null || groups 2>/dev/null)" -- "$1")) + fi +} + +# This function completes on valid shells +# +_shells() +{ + local shell rest + while read -r shell rest; do + [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=($shell) + done 2>/dev/null </etc/shells +} + +# This function completes on valid filesystem types +# +_fstypes() +{ + local fss + + if [[ -e /proc/filesystems ]]; then + # Linux + fss="$(cut -d$'\t' -f2 /proc/filesystems) + $(awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null)" + else + # Generic + fss="$(awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null) + $(awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null) + $(awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null) + $(awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null) + $([[ -d /etc/fs ]] && command ls /etc/fs)" + fi + + [[ -n $fss ]] && COMPREPLY+=($(compgen -W "$fss" -- "$cur")) +} + +# Get real command. +# - arg: $1 Command +# - stdout: Filename of command in PATH with possible symbolic links resolved. +# Empty string if command not found. +# - return: True (0) if command found, False (> 0) if not. +_realcommand() +{ + type -P "$1" >/dev/null && { + if type -p realpath >/dev/null; then + realpath "$(type -P "$1")" + elif type -p greadlink >/dev/null; then + greadlink -f "$(type -P "$1")" + elif type -p readlink >/dev/null; then + readlink -f "$(type -P "$1")" + else + type -P "$1" + fi + } +} + +# This function returns the first argument, excluding options +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. See __reassemble_comp_words_by_ref. +_get_first_arg() +{ + local i + + arg= + for ((i = 1; i < COMP_CWORD; i++)); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + arg=${COMP_WORDS[i]} + break + fi + done +} + +# This function counts the number of args, excluding options +# @param $1 chars Characters out of $COMP_WORDBREAKS which should +# NOT be considered word breaks. See __reassemble_comp_words_by_ref. +# @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 = 1; i < cword; i++)); do + # shellcheck disable=SC2053 + if [[ ${words[i]} != -* && ${words[i - 1]} != ${2-} || \ + ${words[i]} == ${3-} ]]; then + ((args++)) + fi + done +} + +# This function completes on PCI IDs +# +_pci_ids() +{ + COMPREPLY+=($(compgen -W \ + "$(PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur")) +} + +# This function completes on USB IDs +# +_usb_ids() +{ + COMPREPLY+=($(compgen -W \ + "$(PATH="$PATH:/sbin" lsusb | awk '{print $6}')" -- "$cur")) +} + +# CD device names +_cd_devices() +{ + COMPREPLY+=($(compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}")) +} + +# DVD device names +_dvd_devices() +{ + COMPREPLY+=($(compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}")) +} + +# TERM environment variable values +_terms() +{ + COMPREPLY+=($(compgen -W "$({ + command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap + { + toe -a || toe + } | awk '{ print $1 }' + find /{etc,lib,usr/lib,usr/share}/terminfo/? -type f -maxdepth 1 | + awk -F/ '{ print $NF }' + } 2>/dev/null)" -- "$cur")) +} + +_bashcomp_try_faketty() +{ + if type unbuffer &>/dev/null; then + unbuffer -p "$@" + elif script --version 2>&1 | command grep -qF util-linux; then + # BSD and Solaris "script" do not seem to have required features + script -qaefc "$*" /dev/null + else + "$@" # no can do, fallback + fi +} + +# a little help for FreeBSD ports users +[[ $OSTYPE == *freebsd* ]] && complete -W 'index search fetch fetch-list + extract patch configure build install reinstall deinstall clean + clean-depends kernel buildworld' make + +# This function provides simple user@host completion +# +_user_at_host() +{ + local cur prev words cword + _init_completion -n : || return + + if [[ $cur == *@* ]]; then + _known_hosts_real "$cur" + else + COMPREPLY=($(compgen -u -S @ -- "$cur")) + compopt -o nospace + fi +} +shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger + +# NOTE: Using this function as a helper function is deprecated. Use +# `_known_hosts_real' instead. +_known_hosts() +{ + local cur prev words cword + _init_completion -n : || return + + # NOTE: Using `_known_hosts' as a helper function and passing options + # to `_known_hosts' is deprecated: Use `_known_hosts_real' instead. + local options + [[ ${1-} == -a || ${2-} == -a ]] && options=-a + [[ ${1-} == -c || ${2-} == -c ]] && options+=" -c" + _known_hosts_real ${options-} -- "$cur" +} # _known_hosts() + +# Helper function to locate ssh included files in configs +# This function looks for the "Include" keyword in ssh config files and +# includes them recursively, adding each result to the config variable. +_included_ssh_config_files() +{ + (($# < 1)) && + echo "bash_completion: $FUNCNAME: missing mandatory argument CONFIG" >&2 + local configfile i f + configfile=$1 + + local reset=$(shopt -po noglob) + set -o noglob + local included=($(command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' "${configfile}")) + $reset + + [[ ${included-} ]] || return + for i in "${included[@]}"; do + # Check the origin of $configfile to complete relative included paths on included + # files according to ssh_config(5): + # "[...] Files without absolute paths are assumed to be in ~/.ssh if included in a user + # configuration file or /etc/ssh if included from the system configuration file.[...]" + if ! [[ $i =~ ^\~.*|^\/.* ]]; then + if [[ $configfile =~ ^\/etc\/ssh.* ]]; then + i="/etc/ssh/$i" + else + i="$HOME/.ssh/$i" + fi + fi + __expand_tilde_by_ref i + # In case the expanded variable contains multiple paths + set +o noglob + for f in $i; do + if [[ -r $f ]]; then + config+=("$f") + # The Included file is processed to look for Included files in itself + _included_ssh_config_files $f + fi + done + $reset + done +} # _included_ssh_config_files() + +# Helper function for completing _known_hosts. +# This function performs host completion based on ssh's config and known_hosts +# files, as well as hostnames reported by avahi-browse if +# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from +# HOSTFILE (compgen -A hostname) are added, unless +# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value. +# Usage: _known_hosts_real [OPTIONS] CWORD +# Options: -a Use aliases from ssh config files +# -c Use `:' suffix +# -F configfile Use `configfile' for configuration settings +# -p PREFIX Use PREFIX +# -4 Filter IPv6 addresses from results +# -6 Filter IPv4 addresses from results +# Return: Completions, starting with CWORD, are added to COMPREPLY[] +_known_hosts_real() +{ + local configfile flag prefix="" ifs=$IFS + local cur suffix="" aliases i host ipv4 ipv6 + local -a kh tmpkh=() khd=() config=() + + # TODO remove trailing %foo from entries + + local OPTIND=1 + while getopts "ac46F:p:" flag "$@"; do + case $flag in + a) aliases='yes' ;; + c) suffix=':' ;; + F) configfile=$OPTARG ;; + p) prefix=$OPTARG ;; + 4) ipv4=1 ;; + 6) ipv6=1 ;; + *) + echo "bash_completion: $FUNCNAME: usage error" >&2 + return 1 + ;; + esac + done + if (($# < OPTIND)); then + echo "bash_completion: $FUNCNAME: missing mandatory argument CWORD" >&2 + return 1 + fi + cur=${!OPTIND} + ((OPTIND += 1)) + if (($# >= OPTIND)); then + echo "bash_completion: $FUNCNAME($*): unprocessed arguments:" \ + "$(while (($# >= OPTIND)); do + printf '%s ' ${!OPTIND} + shift + done)" >&2 + return 1 + fi + + [[ $cur == *@* ]] && prefix=$prefix${cur%@*}@ && cur=${cur#*@} + kh=() + + # ssh config files + if [[ -v configfile ]]; then + [[ -r $configfile ]] && config+=("$configfile") + else + for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; do + [[ -r $i ]] && config+=("$i") + done + fi + + local reset=$(shopt -po noglob) + set -o noglob + + # "Include" keyword in ssh config files + if ((${#config[@]} > 0)); then + for i in "${config[@]}"; do + _included_ssh_config_files "$i" + done + fi + + # Known hosts files from configs + if ((${#config[@]} > 0)); then + local IFS=$'\n' + # expand paths (if present) to global and user known hosts files + # TODO(?): try to make known hosts files with more than one consecutive + # spaces in their name work (watch out for ~ expansion + # breakage! Alioth#311595) + tmpkh=($(awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u)) + IFS=$ifs + fi + if ((${#tmpkh[@]} != 0)); then + local j + for i in "${tmpkh[@]}"; do + # First deal with quoted entries... + while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do + i=${BASH_REMATCH[1]}${BASH_REMATCH[3]} + j=${BASH_REMATCH[2]} + __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' + [[ -r $j ]] && kh+=("$j") + done + # ...and then the rest. + for j in $i; do + __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' + [[ -r $j ]] && kh+=("$j") + done + done + fi + + if [[ ! -v configfile ]]; then + # Global and user known_hosts files + for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \ + /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \ + ~/.ssh/known_hosts2; do + [[ -r $i ]] && kh+=("$i") + done + for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do + [[ -d $i ]] && khd+=("$i"/*pub) + done + fi + + # If we have known_hosts files to use + if ((${#kh[@]} + ${#khd[@]} > 0)); then + if ((${#kh[@]} > 0)); then + # https://man.openbsd.org/sshd.8#SSH_KNOWN_HOSTS_FILE_FORMAT + for i in "${kh[@]}"; do + while read -ra tmpkh; do + ((${#tmpkh[@]} == 0)) && continue + 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=$ifs + done <"$i" + done + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + fi + if ((${#khd[@]} > 0)); then + # Needs to look for files called + # .../.ssh2/key_22_<hostname>.pub + # dont fork any processes, because in a cluster environment, + # there can be hundreds of hostkeys + for i in "${khd[@]}"; do + if [[ $i == *key_22_$cur*.pub && -r $i ]]; then + |