This commit is contained in:
Eyal Posener 2019-03-07 23:39:51 +02:00
parent a9ccd7c514
commit 82e658e4f3
1 changed files with 7 additions and 7 deletions

14
doc.go
View File

@ -5,14 +5,14 @@ Writing bash completion scripts is a hard work. This package provides an easy wa
to create bash completion scripts for any command, and also an easy way to install/uninstall to create bash completion scripts for any command, and also an easy way to install/uninstall
the completion of the command. the completion of the command.
## go command bash completion go command bash completion
In [gocomplete](./cmd/gocomplete) there is an example for bash completion for the `go` command line. In [gocomplete](./cmd/gocomplete) there is an example for bash completion for the `go` command line.
This is an example that uses the `complete` package on the `go` command - the `complete` package This is an example that uses the `complete` package on the `go` command - the `complete` package
can also be used to implement any completions, see [Usage](#usage). can also be used to implement any completions, see [Usage](#usage).
### Install Install
1. Type in your shell: 1. Type in your shell:
@ -23,13 +23,14 @@ can also be used to implement any completions, see [Usage](#usage).
Uninstall by `gocomplete -uninstall` Uninstall by `gocomplete -uninstall`
### Features
Features
- Complete `go` command, including sub commands and all flags. - Complete `go` command, including sub commands and all flags.
- Complete packages names or `.go` files when necessary. - Complete packages names or `.go` files when necessary.
- Complete test names after `-run` flag. - Complete test names after `-run` flag.
## complete package complete package
Supported shells: Supported shells:
@ -37,7 +38,7 @@ Supported shells:
- [x] zsh - [x] zsh
- [x] fish - [x] fish
### Usage Usage
Assuming you have program called `run` and you want to have bash completion 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, for it, meaning, if you type `run` then space, then press the `Tab` key,
@ -100,11 +101,10 @@ So here it is:
complete.New("run", run).Run() complete.New("run", run).Run()
} }
### Self completing program Self completing program
In case that the program that we want to complete is written in go we In case that the program that we want to complete is written in go we
can make it self completing. can make it self completing.
Here is an [example](./example/self/main.go) Here is an [example](./example/self/main.go)
*/ */