Class: Command::Status

Inherits:
Base
  • Object
show all
Defined in:
lib/command/status.rb

Constant Summary collapse

LABEL_WIDTH =
12
LONG_STATUS =
{
  :added    => "new file:",
  :deleted  => "deleted:",
  :modified => "modified:"
}
SHORT_STATUS =
{
  :added    => "A",
  :deleted  => "D",
  :modified => "M"
}
CONFLICT_LABEL_WIDTH =
17
CONFLICT_LONG_STATUS =
{
  [1, 2, 3] => "both modified:",
  [1, 2]    => "deleted by them:",
  [1, 3]    => "deleted by us:",
  [2, 3]    => "both added:",
  [2]       => "added by us:",
  [3]       => "added by them:"
}
CONFLICT_SHORT_STATUS =
{
  [1, 2, 3] => "UU",
  [1, 2]    => "UD",
  [1, 3]    => "DU",
  [2, 3]    => "AA",
  [2]       => "AU",
  [3]       => "UA"
}
UI_LABELS =
{ :normal => LONG_STATUS, :conflict => CONFLICT_LONG_STATUS }
UI_WIDTHS =
{ :normal => LABEL_WIDTH, :conflict => CONFLICT_LABEL_WIDTH }

Instance Attribute Summary

Attributes inherited from Base

#status

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize

Constructor Details

This class inherits a constructor from Command::Base

Instance Method Details

#define_optionsObject



43
44
45
46
# File 'lib/command/status.rb', line 43

def define_options
  @options[:format] = "long"
  @parser.on("--porcelain") { @options[:format] = "porcelain" }
end

#runObject



48
49
50
51
52
53
54
55
# File 'lib/command/status.rb', line 48

def run
  repo.index.load_for_update
  @status = repo.status
  repo.index.write_updates

  print_results
  exit 0
end