Class: Arcanus::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/arcanus/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/arcanus/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
# File 'lib/arcanus/cli.rb', line 30

def run(arguments)
  run_command(arguments)

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