https://github.com/szaghi/FLAP
Revision e6f25ce04474a1770d0c911f54fc9981fa85b9b2 authored by Stefano Zaghi on 12 July 2019, 15:15:50 UTC, committed by Stefano Zaghi on 12 July 2019, 15:15:50 UTC
Add bash completition script output: given a CLI now it is possibile to
save a *bash auto completition script* that once *sourced* in a bash
shell provides the auto completition capabilities.

Note tha for CLI with multiple CLAs groups (like the `git` command) the
generated script is smart enough to distinguish the CLAs of each group,
e.g. the added test with 2 CLAs groups generates the following script:

```bash
_completion()
{
  cur=${COMP_WORDS[COMP_CWORD]}
  prev=${COMP_WORDS[COMP_CWORD - 1]}
  if [ "$prev" == "compile" ] ; then
    COMPREPLY=( $( compgen -W "  --compiler -c --flags -f --help -h --version -v" -- $cur ) )
  elif [ "$prev" == "clean" ] ; then
    COMPREPLY=( $( compgen -W " --clean -c --clean-all -ca --help -h --version -v" -- $cur ) )
  else
    COMPREPLY=( $( compgen -W " --help -h --version -v compile clean" -- $cur ) )
  fi
  return 0
}
complete -F _completion flap_test_save_bash_completition
```
1 parent bd4b342
History
Tip revision: e6f25ce04474a1770d0c911f54fc9981fa85b9b2 authored by Stefano Zaghi on 12 July 2019, 15:15:50 UTC
Add bash completition script output issue#86
Tip revision: e6f25ce
File Mode Size
CMake
doc
scripts
src
.gitignore -rw-r--r-- 298 bytes
.gitmodules -rw-r--r-- 397 bytes
.travis.yml -rw-r--r-- 1.6 KB
CMakeLists.txt -rw-r--r-- 8.4 KB
CONTRIBUTING.md -rw-r--r-- 3.6 KB
LICENSE.bsd-2.md -rw-r--r-- 1.5 KB
LICENSE.bsd-3.md -rw-r--r-- 1.5 KB
LICENSE.gpl3.md -rw-r--r-- 34.4 KB
LICENSE.mit.md -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 18.9 KB
codecov.yml -rw-r--r-- 43 bytes
fobos -rw-r--r-- 6.0 KB
makefile -rw-r--r-- 5.5 KB

README.md

back to top