Flag: `Head -1` style
Head like flag
Head -1 Style
GNU head utility has a special way to input a line number: head -n.
Here the n can be a positive number.
For example, head -3 means the the top 3 lines from standard input or a file.
cmdr allows you define a flag has the same behavior.
Generally the default value of a head-like flag must be a positive number. Then the end user typing -number can be converted to --flag number semantic meaning.
In a single app, only one head-like flag can be declared.
Define
.HeadLike(true) can enable head-like style for a flag.
Run
The result of running the above example app is:
额外的话题
How is this guide?
Edit on GitHub
Last updated on