Skip to content

Commit

Permalink
Fix help duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
bibendi committed Mar 22, 2017
1 parent abdfc8d commit cd764ac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/apress-gem
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ opt_parser = OptionParser.new do |opt|
opt.separator 'Options'

opt.on('-h', '--help', 'help') do
puts opt_parser
options[:show_help] = true
end

opt.on('-v', '--version VERSION', 'new version, ex: -v 1.0.0') do |value|
Expand Down Expand Up @@ -65,10 +65,14 @@ end

opt_parser.parse!

cli = Apress::Gems::Cli.new(options)
if options[:show_help]
puts opt_parser
exit
end

if %w(release changelog build upload tag current bump exist).include?(ARGV[0])
cli.public_send(ARGV[0])
subcmd = ARGV[0]
if %w(release changelog build upload tag current bump exist).include?(subcmd)
Apress::Gems::Cli.new(options).public_send(subcmd)
else
puts opt_parser
end

0 comments on commit cd764ac

Please sign in to comment.