Module: Docscribe::CLI::ServerCmd

Defined in:
lib/docscribe/cli/server.rb

Overview

Handle the docscribe server subcommand.

Constant Summary collapse

<<~TEXT
  Usage: docscribe server <command> [options]

  Commands:
    start    Start the background daemon
    stop     Stop the background daemon
    status   Show daemon status

  Options:
    -C, --config <path>    Config file path (default: auto-detect)

  Once the server is running, use `--server` with other commands:
    docscribe --server check lib/
    docscribe --server --autocorrect lib/
TEXT

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Integer

Run the server subcommand.

Parameters:

  • argv (Array<String>)

    subcommand arguments

Returns:

  • (Integer)

    exit code



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/docscribe/cli/server.rb', line 30

def run(argv)
  config_path, cmd = parse_args(argv)
  return warn(BANNER) || 1 unless cmd

  case cmd
  when 'start' then start_server(config_path)
  when 'stop' then stop_server(config_path)
  when 'status' then show_status(config_path)
  else warn(usage) || 1
  end
end