-
Couldn't load subscription status.
- Fork 288
Grammar Details
If you're not familiar with *nix command line environment, you should know that this library was inspired by C function getopt.
You may want read also this Wikipedia article.
These conventions allow two kind of arguments, options and values:
- values can be or not be bound to options.
- options can be defined with short name, long name or both.
A short name is defined with a single character (in .NET context a System.Char) and is invoked using single dash or hyphen:
$ coolapp -f my.file
But this is not the only valid syntax. When a short name is mapped to a System.Boolean, you have just invoke or omit it.
$ coolapp -v
With the previous example I say to coolapp to activate the option named v. To deactivate it, I simply omit its invocation from the command line:
$ coolapp
Short options can be group, so that:
;; this is valid (omitting space between short options)
$ coolapp -vf my.file
;; and also this (omitting space between short option an its value)
$ coolapp -vfmy.file
And what is not allowed?
$ coolapp -fv my.file
or any similar combination. Values are supplied by proximity and since v doesn't accept values, because is a boolean, in this case:
- you're telling
coolappthat the file is calledvas the option - and
my.fileis left unbound