Class: Command::RevList

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

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



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/command/rev_list.rb', line 7

def define_options
  @parser.on("--all")      { @options[:all]      = true }
  @parser.on("--branches") { @options[:branches] = true }
  @parser.on("--remotes")  { @options[:remotes]  = true }

  @parser.on("--ignore-missing") { @options[:missing] = true }
  @parser.on("--objects")        { @options[:objects] = true }
  @parser.on("--reverse")        { @options[:reverse] = true }

  @options[:walk] = true
  @parser.on("--do-walk") { @options[:walk] = true  }
  @parser.on("--no-walk") { @options[:walk] = false }
end

#runObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/command/rev_list.rb', line 21

def run
  rev_list = ::RevList.new(repo, @args, @options)
  iterator = @options[:reverse] ? :reverse_each : :each

  rev_list.__send__(iterator) do |object, path|
    puts "#{ object.oid } #{ path }".strip
  end

  exit 0
end