Class: SvgIcon::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_icon/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



11
12
13
# File 'lib/svg_icon/cli.rb', line 11

def initialize(argv)
  @argv = argv
end

Class Method Details

.run(argv) ⇒ Object



7
8
9
# File 'lib/svg_icon/cli.rb', line 7

def self.run(argv)
  new(argv).run
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/svg_icon/cli.rb', line 15

def run
  command = @argv.shift
  case command
  when "fetch"
    fetch
  when nil, "help", "--help", "-h"
    puts usage
  else
    warn "Unknown command: #{command}"
    warn usage
    exit 1
  end
end