These are cases which could be detected by clap, and potentially warn at compile time. Maybe even with a nice web URL to more info.
First, a little about the syntax to understand the setup of rule. This syntax will make each rule more concise so we don't have to write an entire clap definition.
--optis an option--flagis a flag#(i.e.1or2) is a positional argumentvalis an option value
Can be used on val or Arg types
*: zero or more+: one or more?: zero or one{#,#}: # to # times (i.e.{1,4}is one to four times)<>: required=: requires equals- Ends in
,: requires delimiter (foo,bar): values can only befooorbar
$ prog --opt foo
# is foo option val or positional?
$ prog 1 --opt
$ prog --opt -- 1
$ prog --opt foo
# foo is positional
$ prog --opt=val foo
$ prog --opt foo bar
# is bar option val or positional?
$ prog 1 --opt val
$ prog --opt val -- 1
$ prog --opt foo bar
# bar is positional
$ prog --opt val bar --opt foo
# bar is positional