Class: Brigit::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



15
16
17
# File 'lib/brigit/cli.rb', line 15

def self.banner
  %{Brigit (v#{Version::STRING}) Submodule utilities for Git}
end

.usageObject



19
20
21
22
23
24
25
26
# File 'lib/brigit/cli.rb', line 19

def self.usage
  lines = [
    banner,
    %{COMMANDS: (`COMMAND --help' for documentation)},
    *Command.list.map { |cmd| "  #{cmd.name}" }.sort
  ]
  lines.join "\n"
end

Instance Method Details

#parse(*args) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/brigit/cli.rb', line 7

def parse(*args)
  if !args.empty? && (command = Command[args.shift])
    command.new(*args)
  else
    abort "No command given.\n\n#{self.class.usage}"
  end
end