Class: Ace::Git::CLI::Commands::Branch

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/git/cli/commands/branch.rb

Overview

ace-support-cli command for showing branch information

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ace/git/cli/commands/branch.rb', line 24

def call(**options)
  # Get branch info
  branch_info = Molecules::BranchReader.full_info

  if branch_info[:error]
    raise Ace::Support::Cli::Error.new(branch_info[:error])
  end

  # Output based on format
  case options[:format]
  when "json"
    puts JSON.pretty_generate(branch_info)
  else
    output_text(branch_info)
  end
rescue Ace::Git::Error => e
  raise Ace::Support::Cli::Error.new(e.message)
end