Module: Greenroom::CLI

Defined in:
lib/greenroom/cli.rb,
lib/greenroom/cli/check.rb,
lib/greenroom/cli/judge.rb

Defined Under Namespace

Modules: Check, Judge

Class Method Summary collapse

Class Method Details

.run(arguments, stdout: $stdout, stderr: $stderr) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/greenroom/cli.rb', line 8

def run(arguments, stdout: $stdout, stderr: $stderr)
  command = arguments.first
  return usage(stderr, "A command is required.") unless command
  if command == "judge"
    require_relative "cli/judge"
    return Judge.run(arguments.drop(1), stdout:, stderr:)
  end
  return usage(stderr, "Unknown command: #{command}.") unless command == "check"

  require_relative "cli/check"
  Check.run(arguments.drop(1), stdout:, stderr:)
end