From 9bbfa3add5890f6cadc7bc02a33400c1446c7f41 Mon Sep 17 00:00:00 2001 From: Lucas Huang Date: Sun, 14 May 2017 12:30:43 -0700 Subject: [PATCH] Rescue invalid commands and present the valid options list (#498) * rescue invalid commands * recuse invalid command --- lib/github_changelog_generator/parser.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 4c836cf..e3a1ab5 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -13,7 +13,10 @@ module GitHubChangelogGenerator ParserFile.new(options).parse! parser = setup_parser(options) - parser.parse! + begin parser.parse! + rescue OptionParser::InvalidOption => e + abort [e, parser].join("\n") + end fetch_user_and_project(options)