Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why reserving '-h' for help option? #9

Open
Explorer09 opened this issue May 5, 2018 · 2 comments
Open

Why reserving '-h' for help option? #9

Explorer09 opened this issue May 5, 2018 · 2 comments

Comments

@Explorer09
Copy link

Explorer09 commented May 5, 2018

The template seems to deliberately reserve -h flag for the predefined --help option. While I appreciate that some shell scripts do use -h for help option (for user convenience), but what's the rationale of imposing it in the template? My concern is that -h could be used for other things depending on application (one use that came to my mind is --no-dereference in utilities such as touch and chown), and applications should be able to let help text be invoked only via the long --help option.

Another problem I observed is when COMMANDLINE_OPTION_DISPLAY_HELP_SHORT is set to empty, then an empty argument string '' might trigger the help text display. What I expected is that it would disable the short option for help text and accept only the long option for help.

@brlin-tw
Copy link
Owner

brlin-tw commented May 7, 2018

The predefined command-line options is merely a reference design and provided to be freely customized by the user (like print_help and process_commandline_arguments these definitions aren't in GBSST's support code at all, it is considered that if one doesn't use it one simply remove the relevant lines in print_help, process_commandline_arguments and COMMANDLINE_OPTION_*)

The reason that COMMANDLINE_OPTION_DISPLAY_HELP_* is separately defined is that it can be (re)used in print_help and process_commandline_arguments, which might be dropped in the future as copying it twice doesn't seem to be a large trade-off.

Hope that answers your question.

@Explorer09
Copy link
Author

I would suggest you drop COMMANDLINE_OPTION_DISPLAY_HELP_* fow two reasons:

  1. It gives a false sense that user can configure the variable values to anything they like, and the variable names are longer than the contents they hold, and
  2. --help is probably a fixed convention these days that does not need configurabilty any longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants