I have a Perl script that can be called as
perl mysrc.pl -a=3 -b=4 -c=6
or as
perl mysrc.pl -t=15
Basically, (either provide value for t) OR (provide values for all of a, b and c). Atleast one of the groups of values has to be specified.
How do I say the above in syntax?
perl mysrc.pl
[-a=<value of a>]
[-b=<value of b>]
[-c=<value of c>]
[-t=<value of t>]
would mean that all the parameters are optional, which is not exactly the case. What is the correct way to write the syntax for mysrc.pl?
Two options: either use “|” as an “OR” symbol and non-square brackets for grouping to avoid the “optional” context, or list competing usages on multiple lines
For REALLY complicated sets of options (think CVS), do what CVS does (no xterm at the moment, so below is a crude approximation from memory) – that is, the generic “help” message only lists all possible use cases, and to get help about option sets for each use case, you issue a per-use-case help command.