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
I think it would be nice to be able to specify Usage text within positional argument definitions (in the same way we do with flags). Right now this seems like it could be possible with ArgumentBase.UsageText, but setting that doesn't seem to do what I want.
cmd:=&cli.Command{
Arguments: []cli.Argument{
&cli.StringArg{
Name: "target",
UsageText: "network address of host to ping",
},
&cli.StringArg{
Name: "endpoint",
UsageText: "url of endpoint to notify",
},
},
Flags: []cli.Flag{
&cli.IntFlag{
Name: "count",
Value: 1,
Usage: "`NUM` of pings to send",
},
},
Action: DoSomething,
}
With this code -h doesn't report the arguments at all. It would be nice if it printed something like:
NAME:
pingreporter - ping the target, report the results to the endpoint
USAGE:
pingreporter [global options] [arguments...]
GLOBAL ARGUMENTS:
target network address of host to ping
endpoint url of endpoint to notify
GLOBAL OPTIONS:
--count NUM NUM of ping probes to send (default: 1)
--help, -h show help
So, I'm wondering what's the intended purpose of ArgumentBase.UsageText, and would you be open to a PR that implements this kind of treatment of arguments?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think it would be nice to be able to specify Usage text within positional argument definitions (in the same way we do with flags). Right now this seems like it could be possible with
ArgumentBase.UsageText, but setting that doesn't seem to do what I want.With this code
-hdoesn't report the arguments at all. It would be nice if it printed something like:So, I'm wondering what's the intended purpose of
ArgumentBase.UsageText, and would you be open to a PR that implements this kind of treatment of arguments?Beta Was this translation helpful? Give feedback.
All reactions