Allow to use a subcommand after a positional argument
Author: iTroozCreated Mar 2, 2025Updated Apr 13, 2026
Labelskind/featurearea/v3
Hey ! I'd like to create a urfave command to manage nested resources, and would like a CLI interface like this:
$ manage author <authorID> book <bookID> delete(Books aren't identifiable in a unique way)
AFAIK, there is currently no way to have a command structure like this in urfave, because we cannot set a subcommand that takes places after a positional argument.
Implementation ideas:
- a
cli.Commandimplementation that would eat any argument instead of specifically theNameargument, and store it in the command context (this cannot work because cli.Command is a struct, not an interface) - a
StoreValuefield incli.Commandthat, if set to true, would eat the next argument and store it in the command context - A way to use
Beforein acli.Commandto eat the next parameter and store it in the context
What do you think about this feature ?
Source: urfave/cli