Class: Abak::Flow::Commands::Compare

Inherits:
Object
  • Object
show all
Includes:
ANSI::Code
Defined in:
lib/abak-flow/commands/compare.rb

Instance Method Summary collapse

Instance Method Details

#run(args, options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/abak-flow/commands/compare.rb', line 9

def run(args, options)
  Checkup.new.process(Array.new, ::Commander::Command::Options.new)

  current = Manager.git.current_branch
  head = Branch.new(options.head || current)
  base = Branch.new(options.base || head.extract_base_name)

  if head.current?
    say white {
      Manager.locale.word(self, 'updating',
        branch: bold { head },
        upstream: bold { "#{Manager.repository.origin}" })
    }

    head.update
  else
    say yellow {
      Manager.locale.word(self, 'diverging', branch: bold { head })
    }
  end

  say green { head.compare_link(base) }
end