Package: bash-completion Version: 1:2.1-4 Severity: minor Tags: upstream patch
Figuring out how to customize the pre-installed Debian bash completions is not easy. This is probably what happens to your average CLI user when they get fed up with some of bash completion's defaults and decide to try to change them: $ make li<TAB> $ # .oO(grr I hate bash completions sometimes) $ <TAB><TAB> $ man -k completion dh_bash-completion (1) - install bash completions for package systemd-notify (1) - Notify service manager about start-up completion and o.. $ # .oO(grumble) $ less /etc/bash_completion $ # .oO(I bet that file is really long) $ less /etc/bash_completions.d/<TAB><TAB> $ .oO(#pick one, I guess) $ less /etc/bash_completions.d/debconf $ complete -h bash: complete: -h: invalid option complete: usage: complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...] $ # .oO(grumble, google, google) $ help complete complete: complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...] Specify how arguments are to be completed by Readline. For each NAME, specify how arguments are to be completed. If no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. Options: -p print existing completion specifications in a reusable format -r remove a completion specification for each NAME, or, if no NAMEs are supplied, all completion specifications -D apply the completions and actions as the default for commands without any specific completion defined -E apply the completions and actions to "empty" commands -- completion attempted on a blank line When completion is attempted, the actions are applied in the order the uppercase-letter options are listed above. The -D option takes precedence over -E. Exit Status: Returns success unless an invalid option is supplied or an error occurs. $ complete -p make complete -F _make make $ complete -r make $ complete -p make bash: complete: make: no completion specification $ make li<TAB> $ # .oO(wth?!?) $ <TAB><TAB> $ complete -p make complete -F _make make $ ls /etc/*complet* /etc/bash_completion /etc/bash_completion.d: debconf initramfs-tools libreoffice.sh unar desktop-file-validate inkscape pon whiptail git-prompt insserv pulseaudio-bash-completion.sh grub jackd pygmentize $ less /etc/bash_completion $ less /usr/share/bash-completion/bash_completion $ # .oO(holy crap I'm not reading all that) $ zless /usr/share/doc/bash-completion/README.gz $ # .oO(no screw that I don't want to use M-/ I just want TAB to work here.) $ less /usr/share/bash-completion/bash_completion $ # .oO(Oh, it autoloads, THAT's why I can't just remove it.) $ man builtins $ # .oO(Ah good the rest of the options were documented there) $ complete -o default -F _make make $ make li<TAB>b/fo<TAB>bar.c^Ho $ # .oO( Finally! ) Attached is a patch for the README. Some comments in /etc/bash_completion directing users to the README might also help, or a stub documentation page for /etc/bash_completion which does so. Additionally, the source tree has doc files that do not appear to be installed, such as doc/bash_completion.txt: $ rgrep COMP_FILEDIR_FALLBACK /usr/share /usr/share/bash-completion/bash_completion: [[ -n ${COMP_FILEDIR_FALLBACK:-} && \ $ zgrep COMP_FILEDIR_FALLBACK /usr/share/* $ zgrep COMP_FILEDIR_FALLBACK /usr/share/*/* /usr/share/bash-completion/bash_completion: [[ -n ${COMP_FILEDIR_FALLBACK:-} && \ $ zgrep COMP_FILEDIR_FALLBACK /usr/share/*/*/*
diff --git a/README b/README index 78cde72..9ce99b6 100644 --- a/README +++ b/README @@ -104,6 +104,33 @@ A. No. Use M-/ to (in the words of the bash man page) attempt file circumvent any file type restrictions put in place by the bash completion code. + Alternatively you may add a "default" option to the completion so + that normal completion happens if no special completions are found. + To do so, first attempt a completion to force an autoload. Then: + + complete -p <name of the command you just used> + + This will print the completion options for that command, which will + look similar to this: + + complete -F _filedir_xspec gunzip + + Simply execute the above text with an added "-o default" option: + + complete -o default -F _filedir_xspec gunzip + + If you wish to disable all special processing for the command, + just do: + + complete -o default gunzip + + To see more options for tweaking behavior, "man builtins" and look for + the "complete" bash builtin command. + + This may be added to user or system-local bash initialization files + to make the change persist. However, too many such additions may + make completion slow. + Q. How can I insert my own local completions without having to reinsert them every time you issue a new release?
_______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel