public
Description: Git utilities for multiple repositories & submodules
Homepage: http://fiveruns.org
Clone URL: git://github.com/fiveruns/brigit.git
brigit / lib / brigit / cli.rb
100644 30 lines (23 sloc) 0.574 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'ostruct'
 
module Brigit
  
  class CLI
    
    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
    
    def self.banner
      %{Brigit (v#{Version::STRING}) Submodule utilities for Git}
    end
        
    def self.usage
      lines = [
        banner,
        %{COMMANDS: (`COMMAND --help' for documentation)},
        *Command.list.map { |cmd| " #{cmd.name}" }.sort
      ]
      lines.join "\n"
    end
    
  end
  
end