diff --git a/hbase-shell/src/main/ruby/jar-bootstrap.rb b/hbase-shell/src/main/ruby/jar-bootstrap.rb index ef3727d3ba3f..d8c97ccf7af1 100644 --- a/hbase-shell/src/main/ruby/jar-bootstrap.rb +++ b/hbase-shell/src/main/ruby/jar-bootstrap.rb @@ -40,6 +40,7 @@ # Some goodies for hirb. Should these be left up to the user's discretion? require 'irb/completion' require 'pathname' +require 'getoptlong' # Add the directory names in hbase.jruby.sources commandline option # to the ruby load path so I can load up my HBase ruby modules @@ -50,20 +51,22 @@ $LOAD_PATH.unshift Pathname.new(sources) end -# -# FIXME: Switch args processing to getopt -# -# See if there are args for this shell. If any, read and then strip from ARGV -# so they don't go through to irb. Output shell 'usage' if user types '--help' +opts = GetoptLong.new( + [ '--help', '-h', GetoptLong::NO_ARGUMENT ], + [ '--debug', '-d', GetoptLong::OPTIONAL_ARGUMENT ], + [ '--noninteractive', '-n', GetoptLong::OPTIONAL_ARGUMENT ], + [ '--top-level-defs', GetoptLong::OPTIONAL_ARGUMENT ], + [ '-Dkey=value', GetoptLong::OPTIONAL_ARGUMENT ] +) + cmdline_help = <