Class: Charming::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout, err: $stderr, pwd: Dir.pwd) ⇒ CLI

Returns a new instance of CLI.



5
6
7
8
9
# File 'lib/charming/cli.rb', line 5

def initialize(out: $stdout, err: $stderr, pwd: Dir.pwd)
  @out = out
  @err = err
  @pwd = pwd
end

Instance Method Details

#call(argv) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/charming/cli.rb', line 11

def call(argv)
  command, *args = argv
  case command
  when "new" then new_app(args)
  when "generate", "g" then generate(args)
  else usage(1)
  end
rescue Generators::Error => e
  err.puts e.message
  1
end