From 4f640b74acbdb1a134bb1a26ea3154924f8af5b2 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sun, 15 Oct 2017 22:33:26 +0200 Subject: [PATCH 1/5] Aborting prints all of usage --- lib/github_changelog_generator/parser.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 48b97c6..707129e 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -20,7 +20,7 @@ module GitHubChangelogGenerator abort [e, parser].join("\n") end - abort(parser.banner) unless options[:user] && options[:project] + abort(parser.to_s) unless options[:user] && options[:project] options.print_options @@ -33,17 +33,17 @@ module GitHubChangelogGenerator # @return [OptionParser] def self.setup_parser(options) OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength - opts.banner = "Usage: github_changelog_generator [options]" - opts.on("-u", "--user [USER]", "Username of the owner of target GitHub repo") do |last| + opts.banner = "Usage: github_changelog_generator --user USER --project PROJECT [options]" + opts.on("-u", "--user USER", "Username of the owner of target GitHub repo") do |last| options[:user] = last end - opts.on("-p", "--project [PROJECT]", "Name of project on GitHub") do |last| + opts.on("-p", "--project PROJECT", "Name of project on GitHub") do |last| options[:project] = last end opts.on("-t", "--token [TOKEN]", "To make more than 50 requests per hour your GitHub token is required. You can generate it at: https://github.com/settings/tokens/new") do |last| options[:token] = last end - opts.on("-f", "--date-format [FORMAT]", "Date format. Default is %Y-%m-%d") do |last| + opts.on("-f", "--date-format FORMAT", "Date format. Default is %Y-%m-%d") do |last| options[:date_format] = last end opts.on("-o", "--output [NAME]", "Output file. Default is CHANGELOG.md") do |last| From 91ac00c1d3036911c940e85c659c4eec01651ce5 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 19 Oct 2017 09:00:40 +0200 Subject: [PATCH 2/5] Abort with friendly message on no user or project --- 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 707129e..b2c0062 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -20,7 +20,10 @@ module GitHubChangelogGenerator abort [e, parser].join("\n") end - abort(parser.to_s) unless options[:user] && options[:project] + unless options[:user] && options[:project] + warn "Tell us which user and project to work on. Options --user and --project, or settings to that effect." + abort(parser.to_s) + end options.print_options From b486425af14f9e160e9aad4625ff36ac905be399 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 19 Oct 2017 09:01:37 +0200 Subject: [PATCH 3/5] Parser: less wordy output --- lib/github_changelog_generator/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index b2c0062..33427d2 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -22,7 +22,7 @@ module GitHubChangelogGenerator unless options[:user] && options[:project] warn "Tell us which user and project to work on. Options --user and --project, or settings to that effect." - abort(parser.to_s) + abort(parser.banner) end options.print_options From 5834fd376686c7b30491c2532f60721f540fe4b9 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 26 Oct 2017 14:46:20 +0200 Subject: [PATCH 4/5] Update parser.rb --- lib/github_changelog_generator/parser.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 33427d2..dd8aa9c 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -21,7 +21,8 @@ module GitHubChangelogGenerator end unless options[:user] && options[:project] - warn "Tell us which user and project to work on. Options --user and --project, or settings to that effect." + warn "Configure which user and project to work on." + warn "Options --user and --project, or settings to that effect. See --help for more." abort(parser.banner) end From 4465adf943eb3f9e6598b46c2a8dcf5e4424a05d Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Fri, 27 Oct 2017 09:29:17 +0200 Subject: [PATCH 5/5] Linting --- lib/github_changelog_generator/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index dd8aa9c..f2c8949 100755 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -23,7 +23,7 @@ module GitHubChangelogGenerator unless options[:user] && options[:project] warn "Configure which user and project to work on." warn "Options --user and --project, or settings to that effect. See --help for more." - abort(parser.banner) + abort(parser.banner) end options.print_options