Add bash command completion

This commit is contained in:
Harshavardhana
2015-03-05 01:45:03 -08:00
parent 7df60328c2
commit 28be1c55ac
5 changed files with 36 additions and 13 deletions
+4
View File
@@ -40,3 +40,7 @@ GLOBAL OPTIONS:
## Contribute
[Contribute to mc](./CONTRIBUTING.md)
### Bash Completion
[Enable bash completion](./command-completion/README.md)
-13
View File
@@ -1,13 +0,0 @@
#! /bin/bash
_cli_bash_autocomplete() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _cli_bash_autocomplete $PROG
+6
View File
@@ -0,0 +1,6 @@
install:
mkdir -p /etc/bash_completion.d
cp mc.bash /etc/bash_completion.d/mc
uninstall:
rm -f /etc/bash_completion.d/mc
+13
View File
@@ -0,0 +1,13 @@
This file is not moved to ``/etc/bash_completion.d/`` with the source installation.
Please execute following explicity from here to move this file to ``/etc/bash_completion.d``
```
$ sudo make install
```
Similarly, execute following to remove it from /etc/bash_completion.d
```
$ sudo make uninstall
```
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
_mc_completion() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _mc_completion mc