class Bicho::CLI::Commands::History

command that shows the history colored as a changelog

Public Instance Methods

do(global_opts, _opts, args) click to toggle source
# File lib/bicho/cli/commands/history.rb, line 36
def do(global_opts, _opts, args)
  client = ::Bicho::Client.new(global_opts[:bugzilla])
  client.get_history(*args).each do |history|
    t.say("#{t.color(history.bug_id.to_s, :headline)} #{history.bug.summary}")
    history.changesets.each do |cs|
      text = "  #{cs.date} - #{cs.who}"
      t.say(t.color(text, :changeset))
      cs.changes.each do |change|
        text = "    - #{change.field_name} = #{change.removed}"
        t.say(t.color(text, :remove))
        text = "    + #{change.field_name} = #{change.added}"
        t.say(t.color(text, :add))
      end
    end
  end
  0
end