Class: Overcommit::CLI

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

Overview

Responsible for parsing command-line options and executing appropriate application logic based on those options.

Instance Method Summary collapse

Constructor Details

#initialize(arguments, logger) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
11
# File 'lib/overcommit/cli.rb', line 7

def initialize(arguments, logger)
  @arguments = arguments
  @log       = logger
  @options   = {}
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/overcommit/cli.rb', line 13

def run
  parse_arguments

  case @options[:action]
  when :install, :uninstall
    install_or_uninstall
  when :template_dir
    print_template_directory_path
  end
end