This library is fully go gettable.
compgen is a Go package to write bash completion to command. like
$ git comm<TAB>
$ git commit
Even though it can be any command, it makes more sense if both program share a bit of code. It is even possible to integrate both programs into a single one: the completion program and the execution program are just the same.
If you use any CLI framework there are chances that you can "introspect" the CLI struct (options, sub commands etc.) and use it to build the completion program.
To register a program that is self completing you just need to:
complete -C cmd cmd
Or copy the above statement in a file into /etc/bash_completion.d/
help is available under the Apache License, Version 2.0.
- 1.2
- 1.3
- tip
- 1.2
- 1.3
- tip

