class Umarell::CLI

The class responsible of handling command line logic

Public Class Methods

new(tools = TOOLS, arguments = Arguments.new) click to toggle source
# File lib/umarell/cli.rb, line 21
def initialize(tools = TOOLS, arguments = Arguments.new)
  @tools = tools
  @arguments = arguments
end

Public Instance Methods

run() click to toggle source

Entry point to start the application

# File lib/umarell/cli.rb, line 27
def run
  @arguments.parse
  run_commands
end

Private Instance Methods

command_arguments(name, options) click to toggle source
# File lib/umarell/cli.rb, line 41
def command_arguments(name, options)
  command_arguments = command_options(name, options)
  return command_arguments unless @arguments.target

  command_arguments + [@arguments.target]
end
command_options(name, base_options) click to toggle source
# File lib/umarell/cli.rb, line 48
def command_options(name, base_options)
  return base_options unless AUTOFIX_SUPPORT.include?(name)

  base_options + ['-a']
end
run_commands() click to toggle source
# File lib/umarell/cli.rb, line 34
def run_commands
  @tools.each do |name, options|
    arguments = command_arguments(name, options)
    Command.new(name, arguments).run
  end
end