Merge pull request #106 from posener/goreadme

readme: Update according to go doc
This commit is contained in:
Eyal Posener 2019-11-18 07:30:20 +02:00 committed by GitHub
commit ca6cedb614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 55 additions and 59 deletions

View File

@ -67,14 +67,12 @@ import (
"github.com/posener/complete/v2"
"github.com/posener/complete/v2/predict"
)
var (
// Add variables to the program.
name = flag.String("name", "", "")
something = flag.String("something", "", "")
nothing = flag.String("nothing", "", "")
)
func main() {
// Create the complete command.
// Here we define completion values for each flag.
@ -105,7 +103,6 @@ To use this feature, simply call `complete.CommandLine` before `flag.Parse`. (Se
// Define flags here...
foo = flag.Bool("foo", false, "")
)
func main() {
// Call command line completion before parsing the flags - provide it with the binary name.
+ complete.CommandLine("my-program")
@ -129,7 +126,6 @@ flag with values, it is possible to use the `github.com/posener/complete/compfla
- foo = flag.Bool("foo", false, "")
+ foo = compflag.Bool("foo", false, "")
)
func main() {
// Call command line completion before parsing the flags.
+ complete.CommandLine("my-program")