Sha256: 8cdd788843d3cef84b77216bbcc2e83772458769b07095e00b585bfb5c28c7b8

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

# coding: utf-8
# 101 exit code available

module Abak::Flow
  module Commands
    class Compare
      include ANSI::Code

      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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abak-flow-1.1.1 lib/abak-flow/commands/compare.rb
abak-flow-1.1.0 lib/abak-flow/commands/compare.rb