bin/pivotal in pivotal-integration-1.6.0.1 vs bin/pivotal in pivotal-integration-1.6.0.2

- old
+ new

@@ -31,11 +31,11 @@ puts " %-#{MAX_COMMAND_LEN}s %s" % [command.name.demodulize.downcase, command.description] end end def show_help - puts "Usage: git pivotal [--help] <command> [<args>]" + puts "Usage: pivotal [--help] <command> [<args>]" puts main_commands = COMMANDS.select{ |c| %w(start finish new).include? c.name.demodulize.downcase } secondary_commands = COMMANDS - main_commands @@ -46,24 +46,49 @@ puts "Secondary Commands:" print_command_help(secondary_commands.sort_by(&:name)) end begin - options = {} - optparse = OptionParser.new do |opts| - opts.on('-h', '--help') do - show_help - exit - end + if COMMAND_NAMES.include?(ARGV.first.try(:downcase)) + command = ARGV.shift.downcase - opts.on('-S', '--story ID') do |id| - options[:story_id] = id + options = {} + optparse = OptionParser.new do |opts| + opts.on('-h', '--help') do + show_help + exit + end + + opts.on('-S', '--story ID') do |id| + options[:story_id] = id + end + + if command == 'start' + opts.on('--use-current') do + options[:use_current] = true + end + end + + if command == 'finish' + opts.on('--pull-request') do + options[:pull_request] = true + end + + opts.on('--no-complete') do + options[:no_complete] = true + end + + opts.on('--no-delete') do + options[:no_delete] = true + end + + opts.on('--no-merge') do + options[:no_merge] = true + end + end end - end - optparse.parse! + optparse.parse! - if COMMAND_NAMES.include?(ARGV.first.try(:downcase)) - command = ARGV.shift command_class = PivotalIntegration::Command.const_get(command.classify) command_class.new(options).run(*ARGV) elsif ARGV.empty? show_help