class RRSE::Main
Constants
- DEFAULT_DIR
- SUBCOMMANDS
Public Class Methods
new()
click to toggle source
# File lib/rrse/main.rb, line 26 def initialize @rrse_dir = DEFAULT_DIR end
show_help()
click to toggle source
# File lib/rrse/main.rb, line 22 def self.show_help print(self.new.options.help) end
Public Instance Methods
list_subcommand()
click to toggle source
# File lib/rrse/main.rb, line 56 def list_subcommand SUBCOMMANDS.map{|key, command_class| " #{key.ljust(20)}#{command_class.short_description}" }.join("\n") end
options()
click to toggle source
# File lib/rrse/main.rb, line 30 def options opts = OptionParser.new opts.program_name = "RRSE" opts.version = RRSE::VERSION opts.banner = <<EOS Usage: rrse [global-options] subcommand ... Subcommands: #{list_subcommand} Global Options: EOS opts.on("-d DIR", "rrse directory (default: #{DEFAULT_DIR})") do|dir| @rrse_dir = Pathname(dir) end opts end
run(argv)
click to toggle source
# File lib/rrse/main.rb, line 48 def run(argv) self.options.order!(argv) subcommand = argv.shift SUBCOMMANDS.fetch(subcommand, RRSE::Command::Unknown).new(@rrse_dir).run(argv) end