Module: Docscribe::CLI

Defined in:
lib/docscribe/cli.rb,
lib/docscribe/cli/run.rb,
lib/docscribe/cli/init.rb,
lib/docscribe/cli/options.rb,
lib/docscribe/cli/generate.rb,
lib/docscribe/cli/config_builder.rb

Defined Under Namespace

Modules: ConfigBuilder, Generate, Init, Options, Run

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Integer

Main CLI entry point.

Dispatches:

  • ‘docscribe init …` to the config-template generator

  • ‘docscribe generate …` to the plugin skeleton generator

  • all other commands to the main option parser and runner

Parameters:

  • argv (Array<String>)

    raw command-line arguments

Returns:

  • (Integer)

    process exit code



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

def run(argv)
  argv = argv.dup

  case argv.first
  when 'init'
    argv.shift
    return Docscribe::CLI::Init.run(argv)
  when 'generate'
    argv.shift
    return Docscribe::CLI::Generate.run(argv)
  end

  options = Docscribe::CLI::Options.parse!(argv)
  Docscribe::CLI::Run.run(options: options, argv: argv)
end