You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
h908714124 edited this page Apr 30, 2023
·
18 revisions
The SuperCommand annotation can be used to create a command/subcommand structure.
A @SuperCommand parser is similar to a @Command parser, but it stops parsing after the last positional parameter was read,
and simply returns the remaining tokens:
@SuperCommand(
name = "git",
description = "Git is software for tracking changes in any set of files.")
interfaceGitCommand {
@Parameter(index = 0)
Stringcommand();
@VarargsParameterList<String> remainingTokens();
}
The generated GitCommandParser can be used as follows:
We can define a "subcommand" to parse the remaining tokens. The subcommand is just a regular @Command.
@Command(
name = "git-add",
description = "Add file contents to the index")
interfaceAddCommand {
@VarargsParameterList<String> pathspec();
// more parameters and options...
}