Method: Update.parse_options

Defined in:
lib/update/options.rb

.parse_optionsObject



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
# File 'lib/update/options.rb', line 2

def self.parse_options
  options = Slop.parse(help: true, 
                       banner: "Usage: update [options]") do
    on :v, :version, "Print version information" do
      puts "Version #{Update::VERSION} on Ruby #{RUBY_VERSION}."
      puts "<[email protected]>"
      exit
    end
    
    on :l, :list, "Print list of commands" do
      ap Update::COMMAND_GROUPS
      exit
    end

    on :e, :edit, "Edit list of commands" do
      puts "Edit the list of commands and descriptions. Usage:"
      puts
      puts "cd #{File.expand_path('../../update',__FILE__)}"
      puts
      puts "Then open 'commands.rb' with a text editor... and add your command and description to the list."
      puts "TODO: Better (read 'sane') way of doing this..."
      exit
    end
  end
end