Class: Gerrit::CLI

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

Overview

Command line application interface.

Defined Under Namespace

Modules: ExitCodes

Instance Method Summary collapse

Constructor Details

#initialize(input:, output:) ⇒ CLI

Create a CLI that outputs to the given output destination.

Parameters:



21
22
23
# File 'lib/gerrit/cli.rb', line 21

def initialize(input:, output:)
  @ui = UI.new(input, output)
end

Instance Method Details

#run(arguments) ⇒ Integer

Parses the given command-line arguments and executes appropriate logic based on those arguments.

Parameters:

  • arguments (Array<String>)

Returns:

  • (Integer)

    exit status code



30
31
32
33
34
35
36
37
# File 'lib/gerrit/cli.rb', line 30

def run(arguments)
  config = Configuration.load_applicable
  run_command(config, arguments)

  ExitCodes::OK
rescue => ex
  ErrorHandler.new(@ui).handle(ex)
end