Re: Command line help options
- Posted by jeremy (admin) Nov 29, 2010
- 1470 views
1. Why do you not want to allow the user to see a list of options available to send to your program and why would you not want to use the standard/common help parameters of -h, -? or --help?
- Because the application might not be using the English language.
- Because the application does not have a console.
- Because standards are not laws
Everything in the help message (with the exception of the hard coded help) is user defined, so the help text could be in any language. If the application has no console, then help would be of no benefit but no problem either. Standards are not the law but a good idea. As said, if they do not want to adhere to the standard that cmd_parse() uses, they can create their own parser. I do not think that cmd_parse should become infinitely configurable to handle every case. It just adds complexity for almost no benefit.
With standards come instant usability. It shouldn't be removed w/o a very good reason, IMHO. Making your program different than every other program does not provide any benefit, only downfall. If you want your command line parsing to be non-standard, I would recommend implementing your own command line parser.
The Unix standard is not the only standard in use today. For example, in the Windows console environment, the standard is to use "/?" as the help switch.
Yes, that is true, but cmd_parse does handle / parameters. Maybe there should be an option on how the help process displays the help, i.e. HELP_SWITCH_PLATFORM, HELP_SWITCH_WINDOWS, HELP_SWITCH_UNIX. So, when set to PLATFORM, it would display / on Windows and - on everything else. Using WINDOWS would show / everywhere and _UNIX whould show - everywhere.
Also, the user can provide their own help option, or a -h that does it's own thing. The cmd_parse only adds -h if the help option was not found in the opts sent to cmd_parse(), so they have control of that already. They can also use the already existing NO_HELP constant to state that no help parameters should be automatically added.
Jeremy