Closed suntong closed 4 years ago
Same question when-using/for child-command: https://github.com/mkideal/cli#example-8-child-command
You can print help message directly:
if argv.Port < 1024 {
ctx.String("Print yourself help information\n")
}
yeah, but I want to print a self help,
"where the self help is the output of running the program with -h
"
not construction it again myself.
You can print help message as below:
if argv.Port < 1024 {
ctx.WriteUsage()
}
Oh,
Thought it was https://godoc.org/github.com/mkideal/cli#Context.Usage, but it's actually https://godoc.org/github.com/mkideal/cli#Context.WriteUsage
Thanks
Hi @mkideal,
Given a program, say https://github.com/mkideal/cli/blob/master/_examples/002-flag/main.go, if I want to do further logical process of the parameters, how do I print a self help if the given parameter is invalid.
Again, using https://github.com/mkideal/cli/blob/master/_examples/002-flag/main.go as the example, how to do:
where the self help is the output running the program with
-h
:thx!