alecthomas / kingpin

CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not execute a parent command's action

balupton opened this issue · comments

It seems that kingpin only executes actions for leafs, rather than parents.

For instance, with the code from https://github.com/textileio/go-textile/blob/a07d47f5e1e9925069b968c68786a6629ae4fdf6/cmd/main.go#L695-L715 this results in:

> textile profile set --name="something"
textile: error: must select a subcommand of 'profile set', try --help

I would expect this not to be the case, with both textile profile set --name="something" and textile profile set name "something" working, as they both have actions defined.

This won't change for v2, but v3-unstable has OptionalSubcommands().

Subcommands can't be optional, though there can be a default subcommand.