Class: Bicho::CLI::Commands::History

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

Overview

command that shows the history colored as a changelog

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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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