You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Lars George <la...@gmail.com> on 2011/05/26 09:49:46 UTC

HBase Shell CLI Help

Hi,

In the hirb.rb source we have

# so they don't go through to irb.  Output shell 'usage' if user types '--help'
cmdline_help = <<HERE # HERE document output as shell usage
HBase Shell command-line options:
 format        Formatter for outputting results: console | html.
Default: console
 -d | --debug  Set DEBUG log levels.
HERE
found = []
format = 'console'
script2run = nil
log_level = org.apache.log4j.Level::ERROR
for arg in ARGV
  if arg =~ /^--format=(.+)/i
    format = $1
    if format =~ /^html$/i
      raise NoMethodError.new("Not yet implemented")
    elsif format =~ /^console$/i
      # This is default
    else
      raise ArgumentError.new("Unsupported format " + arg)
    end
    found.push(arg)
  elsif arg == '-h' || arg == '--help'
    puts cmdline_help
    exit
  elsif arg == '-d' || arg == '--debug'
    log_level = org.apache.log4j.Level::DEBUG
    $fullBackTrace = true
    puts "Setting DEBUG log level..."
  else
    # Presume it a script. Save it off for running later below
    # after we've set up some environment.
    script2run = arg
    found.push(arg)
    # Presume that any other args are meant for the script.
    break
  end
end

We should enhance the help printed when using -h/--help to look like this?

cmdline_help = <<HERE # HERE document output as shell usage
HBase Shell command-line options:
 --format={console|html}        Formatter for outputting results.
Default: console
 -d | --debug  Set DEBUG log levels.
 -h | --help   This help.
 <script-filename> [<script-options>]
HERE

Do we have an accord? Arrrr....

Lars

Re: HBase Shell CLI Help

Posted by Lars George <la...@gmail.com>.
Meh, creating issue...

On Thu, May 26, 2011 at 9:49 AM, Lars George <la...@gmail.com> wrote:
> Hi,
>
> In the hirb.rb source we have
>
> # so they don't go through to irb.  Output shell 'usage' if user types '--help'
> cmdline_help = <<HERE # HERE document output as shell usage
> HBase Shell command-line options:
>  format        Formatter for outputting results: console | html.
> Default: console
>  -d | --debug  Set DEBUG log levels.
> HERE
> found = []
> format = 'console'
> script2run = nil
> log_level = org.apache.log4j.Level::ERROR
> for arg in ARGV
>  if arg =~ /^--format=(.+)/i
>    format = $1
>    if format =~ /^html$/i
>      raise NoMethodError.new("Not yet implemented")
>    elsif format =~ /^console$/i
>      # This is default
>    else
>      raise ArgumentError.new("Unsupported format " + arg)
>    end
>    found.push(arg)
>  elsif arg == '-h' || arg == '--help'
>    puts cmdline_help
>    exit
>  elsif arg == '-d' || arg == '--debug'
>    log_level = org.apache.log4j.Level::DEBUG
>    $fullBackTrace = true
>    puts "Setting DEBUG log level..."
>  else
>    # Presume it a script. Save it off for running later below
>    # after we've set up some environment.
>    script2run = arg
>    found.push(arg)
>    # Presume that any other args are meant for the script.
>    break
>  end
> end
>
> We should enhance the help printed when using -h/--help to look like this?
>
> cmdline_help = <<HERE # HERE document output as shell usage
> HBase Shell command-line options:
>  --format={console|html}        Formatter for outputting results.
> Default: console
>  -d | --debug  Set DEBUG log levels.
>  -h | --help   This help.
>  <script-filename> [<script-options>]
> HERE
>
> Do we have an accord? Arrrr....
>
> Lars
>