Sha256: fd4a024422a9bba42efb0a8dc504c98576a464e0271df0516b0e629ff5a822de
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
# Author:: Nicolas Despres <nicolas.despres@epita.fr>. # Copyright:: Copyright (c) 2004 TTK team. All rights reserved. # License:: LGPL # $Id: ttkm.rb 567 2005-04-13 08:00:06Z polrop $ require 'optparse' require 'logger' require 'uri/druby' require 'socket' module TTK module Getopts class TTKm DEFAULT_OPTIONS = { :uri => URI::DRuby.build([Socket.gethostname, 42004]), } def self.parse(argv) opts = DEFAULT_OPTIONS.dup optparser = OptionParser.new do |optparser| optparser.banner = "usage: #{ME} [options...]" optparser.summary_indent = ' ' optparser.summary_width = 25 # # Monitor options # optparser.separator('') optparser.separator('Monitor options:') optparser.on('-u', '--uri URI', 'Monitor server uri') do |uri| opts[:uri] = URI.parse(uri) end optparser.on('-v', '--verbose', 'Turn on verbose mode') do |uri| $VERBOSE = true end # # Miscellaneous options # optparser.separator('') optparser.separator('Miscellaneous options:') optparser.on_tail('-h', '--help', 'Show this message') do puts(optparser) exit end optparser.on_tail('--version', 'Show version') do puts("#{ME} version #{TTKM_VERSION} [#{SVN_REPOSITORY_DATE}]") exit end end optparser.parse!(argv) opts end end # class TTKm end # module Getopts end # module TTK
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ttk-0.1.576 | bin/getopts/ttkm.rb |
ttk-0.2.1 | bin/getopts/ttkm.rb |
ttk-0.2.0 | bin/getopts/ttkm.rb |
ttk-0.1.579 | bin/getopts/ttkm.rb |
ttk-0.1.580 | bin/getopts/ttkm.rb |