Merge pull request #274 from klueska/bash-completion-default-prog

Set default PROG in bash_autocomplete
This commit is contained in:
Jesse Szwedko 2015-09-05 14:07:14 -07:00
commit eaad6fe6bc
2 changed files with 15 additions and 6 deletions

View File

@ -293,12 +293,19 @@ setting the `PROG` variable to the name of your program:
#### To Distribute #### To Distribute
Copy and modify `autocomplete/bash_autocomplete` to use your program name Copy `autocomplete/bash_autocomplete` into `/etc/bash_completion.d/` and rename
rather than `$PROG` and have the user copy the file into it to the name of the program you wish to add autocomplete support for (or
`/etc/bash_completion.d/` (or automatically install it there if you are automatically install it there if you are distributing a package). Don't forget
distributing a package). Alternatively you can just document that users should to source the file to make it active in the current shell.
source the generic `autocomplete/bash_autocomplete` with `$PROG` set to your
program name in their bash configuration. ```
sudo cp src/bash_autocomplete /etc/bash_completion.d/<myprogram>
source /etc/bash_completion.d/<myprogram>
```
Alternatively, you can just document that users should source the generic
`autocomplete/bash_autocomplete` in their bash configuration with `$PROG` set
to the name of their program (as above).
## Contribution Guidelines ## Contribution Guidelines
Feel free to put up a pull request to fix a bug or maybe add a feature. I will give it a code review and make sure that it does not break backwards compatibility. If I or any other collaborators agree that it is in line with the vision of the project, we will work with you to get the code into a mergeable state and merge it into the master branch. Feel free to put up a pull request to fix a bug or maybe add a feature. I will give it a code review and make sure that it does not break backwards compatibility. If I or any other collaborators agree that it is in line with the vision of the project, we will work with you to get the code into a mergeable state and merge it into the master branch.

View File

@ -1,5 +1,7 @@
#! /bin/bash #! /bin/bash
: ${PROG:=$(basename ${BASH_SOURCE})}
_cli_bash_autocomplete() { _cli_bash_autocomplete() {
local cur prev opts base local cur prev opts base
COMPREPLY=() COMPREPLY=()