I write scripts... in various languages... perl and tcl to name the major ones.
Those scripts usually have command line interfaces.
I often find myself wishing I could check if that value of an option post-parsing came from the user providing it on the command line, or was just the default.
Seems odd. But it's true.
here is one such general case.
I have an option, it has a default that "might work" for the user. The users of course can also give a value, and that should always be used. But I could also derive a value from the env that if it comes up with a value at all (doesn't always) would be better than the default, yet should still lose to a user given value.
So basically the order of preference is, user given, derived, default.
Most parsers will handle user given, and default, but don't provide a good way to know which was used for any specific option.
I can (and have on occasion) written my own command line parser, but such a simple thing as if an option was actually on the command line seems like it would be in the normal parsers, yet I don't see it, making me think it isn't normal to need it. And thus I might be off, or my need it just uncommon.
thoughts?
In reply to Command line options by rpelak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |