From 0c9ea1ed478a656bb01f41b05d199d44f94285f7 Mon Sep 17 00:00:00 2001 From: Daniel Paul Searles <dsearles@gitlab.com> Date: Thu, 12 Mar 2020 21:42:30 -0700 Subject: [PATCH] Update secpick to be more specific with errors Why: * When using secpick and missing an option it's hard to know which error is missing. This change addresses the need by: * Update secpick to output which options are missing. --- bin/secpick | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/secpick b/bin/secpick index fd3de2756ec1e..603c6d2c05d1b 100755 --- a/bin/secpick +++ b/bin/secpick @@ -159,7 +159,11 @@ module Secpick options[:branch] ||= `git rev-parse --abbrev-ref HEAD` options[:remote] ||= DEFAULT_REMOTE - abort("Missing options. Use #{$0} --help to see the list of options available".red) if options.value?(nil) + nil_options = options.select {|_, v| v.nil? } + unless nil_options.empty? + abort("Missing: #{nil_options.keys.join(', ')}. Use #{$0} --help to see the list of options available".red) + end + abort("Wrong version format #{options[:version].bold}".red) unless options[:version] =~ /\A\d*\-\d*\Z/ end end -- GitLab