Class: Bicho::CLI::Commands::Reopen

Inherits:
Bicho::CLI::Command show all
Defined in:
lib/bicho/cli/commands/reopen.rb

Overview

Command to reopen a bug.

Instance Attribute Summary

Attributes inherited from Bicho::CLI::Command

#t

Instance Method Summary collapse

Methods inherited from Bicho::CLI::Command

#initialize, opt, options, #parse_options, #parser

Methods included from Logging

#logger

Constructor Details

This class inherits a constructor from Bicho::CLI::Command

Instance Method Details

#do(global_opts, opts, args) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/bicho/cli/commands/reopen.rb', line 41

def do(global_opts, opts, args)
  unless opts[:comment]
    t.say('Reopen must have a comment')
    return 1
  end
  client = ::Bicho::Client.new(global_opts[:bugzilla])
  client.get_bugs(*args).each do |bug|
    id = bug.reopen!(opts[:comment], opts[:private])
    if id == bug.id
      t.say("Bug #{id} reopened")
    else
      t.say("#{t.color('ERROR:', :error)} Failed to reopen bug #{id}")
    end
  end
  0
end