Working with jessevdk/go-flags
, I would like to get the following usage command:
./main [OPTIONS] arg1 [arg2]
I am able to get the OPTIONS right but I cannot add commands. I see that I can use AddCommand but I have not been able to generate my mandatory and optional commands.
I have tried this:
type AddCommand struct {
Arg1 string `required:true`
Arg2 string `subcommand:"Arg1"`
}
p := flags.NewParser(&opts, flags.Default)
var arg AddCommand
p.AddCommand("arg1", "Arg1", "Arg1", &arg)
args, err := p.Parse()
What am I missing to get a command with its optional subcommand?