Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix #205: Handle optparse errors gracefully #211

Merged
merged 2 commits into from
Aug 20, 2018

Conversation

avdv
Copy link
Collaborator

@avdv avdv commented Aug 17, 2018

Description

Don't bail out with a stacktrace for invalid options.

before:

ls -2
Traceback (most recent call last):
	5: from /home/claudio/.gem/ruby/2.5.0/bin/colorls:23:in `<main>'
	4: from /home/claudio/.gem/ruby/2.5.0/bin/colorls:23:in `load'
	3: from /home/claudio/.gem/ruby/2.5.0/gems/colorls-1.1.2/exe/colorls:5:in `<top (required)>'
	2: from /home/claudio/.gem/ruby/2.5.0/gems/colorls-1.1.2/exe/colorls:5:in `new'
	1: from /home/claudio/.gem/ruby/2.5.0/gems/colorls-1.1.2/lib/colorls/flags.rb:24:in `initialize'
/home/claudio/.gem/ruby/2.5.0/gems/colorls-1.1.2/lib/colorls/flags.rb:161:in `parse_options': invalid option: -2 (OptionParser::InvalidOption)

after:

$ colorls -2
colorls: invalid option: -2
See 'colorls --help'.
  • Relevant Issues : Nicer output when passing invalid options #205
  • Relevant PRs : (none)
  • Type of change :
    • New feature
    • Bug fix for existing feature
    • Code quality improvement
    • Addition or Improvement of tests
    • Addition or Improvement of documentation

@ghost ghost assigned avdv Aug 17, 2018
@ghost ghost added the review label Aug 17, 2018
@avdv avdv force-pushed the fix-205-handle-optparse-errors branch from cd2ed72 to b2bbdbb Compare August 20, 2018 06:02
@avdv avdv merged commit 6066ac6 into athityakumar:master Aug 20, 2018
@avdv avdv deleted the fix-205-handle-optparse-errors branch August 20, 2018 06:04
@ghost ghost removed the review label Aug 20, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant