diff options
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -36,7 +36,14 @@ Uninstall by `gocomplete -uninstall` - Complete packages names or `.go` files when necessary. - Complete test names after `-run` flag. -## Usage +## complete package + +Supported shells: + +- [x] bash +- [x] zsh + +### Usage Assuming you have program called `run` and you want to have bash completion for it, meaning, if you type `run` then space, then press the `Tab` key, @@ -68,9 +75,10 @@ func main() { // define flags of the build sub command Flags: complete.Flags{ - // build sub command has a flag '-fast', which - // does not expects anything after it. - "-fast": complete.PredictNothing, + // build sub command has a flag '-cpus', which + // expects number of cpus after it. in that case + // anything could complete this flag. + "-cpus": complete.Anything, }, }, }, @@ -95,7 +103,9 @@ func main() { } ``` -## Self completing program +### Self completing program In case that the program that we want to complete is written in go we -can make it self completing. Here is an [example](./example/self/main.go) +can make it self completing. + +Here is an [example](./example/self/main.go) |
