Add bash command completion
This commit is contained in:
@@ -40,3 +40,7 @@ GLOBAL OPTIONS:
|
||||
## Contribute
|
||||
|
||||
[Contribute to mc](./CONTRIBUTING.md)
|
||||
|
||||
### Bash Completion
|
||||
|
||||
[Enable bash completion](./command-completion/README.md)
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user