diff --git a/README.md b/README.md index dc64d7c..71e9aad 100644 --- a/README.md +++ b/README.md @@ -121,31 +121,6 @@ A. No. Use `M-/` to (in the words of the bash man page) attempt file A. Put them in `~/.bash_completion`, which is parsed at the end of the main completion script. See also the next question. -**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 - completions shipped by us. - - If you want to use bash's default completion instead of one of ours, - something like this should work (where `$cmd` is the command to override - completion for): `complete -o default -o bashdefault $cmd` - -**Q. Where should I install my own local completions?** - -A. Put them in the `completions` subdir of `$BASH_COMPLETION_USER_DIR` - (defaults to `$XDG_DATA_HOME/bash-completion` or - `~/.local/share/bash-completion` - if `$XDG_DATA_HOME` is not set) to have them loaded on demand. - See also the next question's answer for considerations for these - files' names, they apply here as well. Alternatively, you can write - them directly in `~/.bash_completion` which is loaded eagerly by - our main script. - **Q. I author/maintain package X and would like to maintain my own completion code for this package. Where should I put it to be sure that interactive bash shells will find it and source it?** diff --git a/bash_completion b/bash_completion index d3d3182..d16b10a 100644 --- a/bash_completion +++ b/bash_completion @@ -39,7 +39,7 @@ fi # Blacklisted completions, causing problems with our code. # -_blacklist_glob='@()' +_blacklist_glob='@(acroread.sh)' # Turn on extended globbing and programmable completion shopt -s extglob progcomp diff --git a/completions/Makefile.am b/completions/Makefile.am index 6bb21b6..f04d7c3 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -315,7 +315,7 @@ bashcomp_DATA = 2to3 \ reportbug \ _reptyr \ resolvconf \ - _rfkill \ + rfkill \ ri \ rmlist \ rmmod \ diff --git a/completions/_rfkill b/completions/_rfkill deleted file mode 100644 index e807d97..0000000 --- a/completions/_rfkill +++ /dev/null @@ -1,31 +0,0 @@ -# bash completion for rfkill -*- shell-script -*- - -# Use of this file is deprecated on systems with util-linux >= 2.31, which -# ships completion for the rfkill included with it. - -_rfkill() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) - else - case $cword in - 1) - COMPREPLY=( $( compgen -W "help event list block unblock" \ - -- "$cur" ) ) - ;; - 2) - if [[ $prev == block || $prev == unblock ]]; then - COMPREPLY=( $( compgen -W "$($1 list | awk -F: \ - '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ - wwan gps" -- "$cur" ) ) - fi - ;; - esac - fi -} && -complete -F _rfkill rfkill - -# ex: filetype=sh diff --git a/completions/man b/completions/man index 3b8d56a..a00ac7a 100644 --- a/completions/man +++ b/completions/man @@ -53,7 +53,9 @@ _man() return fi - local manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) + local manpath="$MANPATH" + [[ -z $manpath ]] && \ + manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" # determine manual section to search diff --git a/completions/rfkill b/completions/rfkill new file mode 100644 index 0000000..a3741d2 --- /dev/null +++ b/completions/rfkill @@ -0,0 +1,28 @@ +# bash completion for rfkill -*- shell-script -*- + +_rfkill() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + else + case $cword in + 1) + COMPREPLY=( $( compgen -W "help event list block unblock" \ + -- "$cur" ) ) + ;; + 2) + if [[ $prev == block || $prev == unblock ]]; then + COMPREPLY=( $( compgen -W "$($1 list | awk -F: \ + '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ + wwan gps" -- "$cur" ) ) + fi + ;; + esac + fi +} && +complete -F _rfkill rfkill + +# ex: filetype=sh