Class: Moku6::CLI

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

Constant Summary collapse

<<~TEXT
  Usage: moku6 COMMAND [options]

  Commands:
    version            Show the version
    init               Generate a catalog scaffold
    lint               Lint audit event definitions
    diff OLD NEW       Detect breaking changes between two catalog directories
    generate SUB       Generate output artifacts (see: moku6 generate --help)

  Global options:
    --catalog DIR      Catalog directory (default: catalog)
    --config FILE      Config file (default: .moku6.yml)
TEXT

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(argv) ⇒ Object



22
# File 'lib/moku6/cli.rb', line 22

def self.start(argv) = new.start(argv)

Instance Method Details

#start(argv) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/moku6/cli.rb', line 24

def start(argv)
  argv = Array(argv).dup
  command = argv.shift
  case command
  when "version" then cmd_version
  when "init" then cmd_init(argv)
  when "lint" then cmd_lint(argv)
  when "diff" then cmd_diff(argv)
  when "generate" then Generate.new.start(argv)
  when nil, "help", "-h", "--help" then puts BANNER
  else
    warn "Unknown command: #{command}"
    warn BANNER
    exit 2
  end
end