Module: Skap::CLI

Defined in:
lib/skap/cli.rb

Overview

Dispatcher for CLI commands.

Defined Under Namespace

Modules: Help, Init, Sources, Version, Works

Class Method Summary collapse

Class Method Details

.start(argv = ARGV) ⇒ void

This method returns an undefined value.

Parameters:

  • argv (Array<String>) (defaults to: ARGV)


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/skap/cli.rb', line 20

def self.start(argv = ARGV)
  section, command, *rest = argv

  case section
  when "help", "--help", "-h", nil then Skap::CLI::Help.start
  when "init" then Skap::CLI::Init.start(command, rest)
  when "sources" then Skap::CLI::Sources.start(command, rest)
  when "version", "--version", "-v" then Skap::CLI::Version.start
  when "works" then Skap::CLI::Works.start(command, rest)
  else
    raise ArgumentError, "Unknown section: #{section}"
  end
end