class FLACsmith::CLI::Shell

The main Command Line Interface (CLI) object.

Attributes

parser[R]

Public Class Methods

new(parser: Parser.new, **dependencies) click to toggle source
Calls superclass method
# File lib/flacsmith/cli/shell.rb, line 9
def initialize parser: Parser.new, **dependencies
  super(**dependencies)
  @parser = parser
end

Public Instance Methods

call(arguments = []) click to toggle source
# File lib/flacsmith/cli/shell.rb, line 14
def call arguments = []
  perform parser.call(arguments)
rescue OptionParser::ParseError => error
  logger.error { error.message }
end

Private Instance Methods

perform(configuration) click to toggle source
# File lib/flacsmith/cli/shell.rb, line 24
def perform configuration
  case configuration
    in action_encode: true, source_dir:, target_dir:, image_path:
      encode.call source_dir, target_dir, image_path:
    in action_list: true, source_dir: then list.call source_dir
    in action_rebuild: true, source_dir: then rebuild.call source_dir
    in action_version: true then logger.info { specification.labeled_version }
    else logger.any { parser.to_s }
  end
end