Class: Octocounter::CommandBuilder

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/octocounter.rb

Instance Method Summary collapse

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/octocounter.rb', line 18

def run
  program :name, "Octocounter"
  program :version, Octocounter::VERSION
  program :description, DESCRIPTION

  default_command :run

  command :run do |c|
    c.syntax = "octocounter path/to/directory"
    c.description = DESCRIPTION
    c.action do |args|
      path = args.shift || abort(PATH_ARG)

      counter = Octocounter::Counter.new(path)

      counter.print_to_screen
    end
  end

  run!
end