Class: SlimLint::CLI

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

Overview

Command line application interface.

Constant Summary collapse

EX_OK =

Exit codes

0
EX_USAGE =
64
EX_DATAERR =
65
EX_NOINPUT =
67
EX_SOFTWARE =
70
EX_CONFIG =
78

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ CLI

Create a CLI that outputs to the specified logger.

Parameters:



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

def initialize(logger)
  @log = logger
end

Instance Method Details

#run(args) ⇒ Integer

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

Parameters:

  • args (Array<String>)

    command line arguments

Returns:

  • (Integer)

    exit status code



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

def run(args)
  options = SlimLint::Options.new.parse(args)
  act_on_options(options)
rescue StandardError => e
  handle_exception(e)
end