Class: RGitHook::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/rgithook/command_line.rb

Class Method Summary collapse

Class Method Details

.execute(args) ⇒ Object

Parse command line options and execute



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rgithook/command_line.rb', line 9

def self.execute(args)
   options = parse_options(args)

   case options.command
   when :install,:fetch,:edit
      ret_val = RGitHook.new(options.path).send(options.command)
      exit 0
   when :version
      puts 'Version 3.0.0'
      exit 0
   end

rescue Grit::InvalidGitRepositoryError
   puts "Invalid Git repository:\n#{@options.path}"
   exit 1
end