Class: Overcommit::CLI
- Inherits:
-
Object
- Object
- Overcommit::CLI
- 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
-
#initialize(arguments, input, logger) ⇒ CLI
constructor
rubocop:disable Metrics/ClassLength.
- #run ⇒ Object
Constructor Details
#initialize(arguments, input, logger) ⇒ CLI
rubocop:disable Metrics/ClassLength
10 11 12 13 14 15 16 17 |
# File 'lib/overcommit/cli.rb', line 10 def initialize(arguments, input, logger) @arguments = arguments @input = input @log = logger @options = {} Overcommit::Utils.log = logger end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/overcommit/cli.rb', line 19 def run parse_arguments case @options[:action] when :install, :uninstall install_or_uninstall when :template_dir print_template_directory_path when :sign sign when :run_all run_all end rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e puts e exit 78 # EX_CONFIG rescue Overcommit::Exceptions::HookContextLoadError => e puts e exit 64 # EX_USAGE end |