-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
I am trying to work on the auto-completion part using this framework, and it does not work with the flags option. Here is my piece of code:
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = "greet"
app.Usage = "sample command-line app by greet"
app.Author = "abc"
app.Email = "[email protected]"
app.EnableBashCompletion = true
app.Commands = []cli.Command{
{
Name: "read",
ShortName: "r",
Usage: "read something",
Subcommands: []cli.Command{
{
Name: "articles",
Usage: "read articles",
Action: readArticles,
},
{
Name: "tweets",
Usage: "read Tweets",
Flags: []cli.Flag{
cli.StringFlag{
Name: "account",
Value: "SomeThing",
Usage: "name of Twitter account",
},
},
Action: readTwitter,
},
},
},
}
app.Run(os.Args)
}
func readArticles(ctx *cli.Context) {
fmt.Println("Go to http://www.google.com to read articles!")
}
func readTwitter(ctx *cli.Context) {
fmt.Printf("Go to https://twitter.com/%s to read tweets!", ctx.String("account"))
}
When i try to do an autocomplete on the flags, it does not work. Could anybody let me know if this is supported by the framework?
Example:
./greet read tweets --a [TAB][TAB] does not work.