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

generated binaries show usage when given -h/--help #8

Closed
wants to merge 1 commit into from

Conversation

badmutex
Copy link
Contributor

@badmutex badmutex commented Jun 4, 2017

This is for #6

This change allows generated binaries to show usage info upon consumption of -h, --help (and -? incidentally).

Tested

  • on Ubuntu 16.04 with make test

Example

$ ./bin/trck -c test/tr/test_field_name.tr
$ ./matcher-traildb --help
Usage: ./matcher-traildb [OPTIONS] TRAILDB [TRAILDB...]

OPTIONS:
  -p  --params        PARAMS
  -o  --output-format FORMAT
  -f  --filter        FILTER
  -w  --window-file   FILE

@CLAassistant
Copy link

CLAassistant commented Jun 4, 2017

CLA assistant check
All committers have signed the CLA.

@badmutex badmutex mentioned this pull request Jun 4, 2017
case '?':
case 'h':
print_usage(stderr, argv[0]);
exit(EX_USAGE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be nitpicking, but I thought EX_USAGE is intended for the case when the binary received incorrect arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. The case '?' clause for unhandled arguments will fall through to the case 'h'.
My thought is that invocations that result in the usage printed indicate bad arguments and explicitly asking for the usage is a special case.

@badmutex badmutex closed this Dec 3, 2017
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

Successfully merging this pull request may close these issues.

3 participants