File: tg.rb

bbs/tg.rb

# File: tg.rb

# Public Instance Methods

### getoptions (args)

Show source...

         # File bbs/tg.rb, line 108
    108: def getoptions(args)
    109:
    110:         options = {}
    111:
    112:         opts = OptionParser.new do |opts|
    113:         opts.banner = "OpenTelegard/2 :: Copyright (c) 2008-2010, Chris Tusa.\nDistributed by LeafScale Systems, All rights reserved.\nUsage: "
    114:         opts.separator ""
    115:
    116:         opts.on("-g", "--genconfig", "Build sample configuration.") do |g|
    117:                 options[:genconfig] = g
    118:         end
    119:
    120:     opts.on("-d", "--daemon", "Run Server Daemon.") do |d|
    121:         options[:daemon] = d
    122:     end
    123:
    124:         opts.on("-l", "--login", "Perform Local Login to system.") do |l|
    125:                 options[:login] = l
    126:     end
    127:         opts.on("-s", "--showuser", "Show user list") do |s|
    128:                 options[:showuser] = s
    129:         end
    130:         opts.on("-u", "--update", "Check for & Perform Update.") do |u|
    131:                 options[:update] = u
    132:         end
    133:     opts.on("-t", "--test", "Test.") do |t|
    134:         options[:test] = t
    135:     end
    136:
    137:         opts.on("-v", "--version", "Print version and exit.") do |v|
    138:                 options[:version] = v
    139:         end
    140:         opts.on("-w", "--who", "WFC Style Screen (who is online monitoring)") do |w|
    141:                 options[:who] = w
    142:         end
    143:    opts.on_tail("-h", "--help", "Show this help message.") do |h|
    144:          puts opts; return 0
    145:         end
    146:   end  # end opts do
    147:
    148:   begin opts.parse!
    149:    rescue OptionParser::InvalidOption => invalidcmd
    150:                 puts "Invalid command options specified: #{invalidcmd}"
    151:                 puts opts
    152:                 return 1
    153:         rescue OptionParser::ParseError => error
    154:                 puts error
    155:   end # end begin
    156:         if options.empty? == true
    157:                 puts opts
    158:         end
    159:   options
    160: end