Class: Command::Diff
- Includes:
- PrintDiff
- Defined in:
- lib/command/diff.rb
Constant Summary
Constants included from PrintDiff
PrintDiff::DIFF_FORMATS, PrintDiff::NULL_OID, PrintDiff::NULL_PATH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from PrintDiff
Methods inherited from Base
Constructor Details
This class inherits a constructor from Command::Base
Instance Method Details
#define_options ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/command/diff.rb', line 9 def @options[:patch] = true @parser.on "--cached", "--staged" do @options[:cached] = true end @parser.on("-1", "--base") { @options[:stage] = 1 } @parser.on("-2", "--ours") { @options[:stage] = 2 } @parser.on("-3", "--theirs") { @options[:stage] = 3 } end |
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/command/diff.rb', line 22 def run repo.index.load @status = repo.status setup_pager if @options[:cached] diff_head_index else diff_index_workspace end exit 0 end |