Take a look at hbase-shell/src/main/ruby/shell.rb, starting line 273
(master branch):

Shell.load_command_group(
  'dml',
  :full_name => 'DATA MANIPULATION COMMANDS',
  :commands => %w[
    count
    delete
    deleteall
    get

You can add your command following 'get'

Cheers

On Thu, Sep 25, 2014 at 3:49 PM, Shaun Elliott <[email protected]>
wrote:

> This is a potential answer to my question  here
> <
> http://apache-hbase.679495.n3.nabble.com/view-decoded-thrift-in-hbase-shell-td4064130.html
> >
> that I never got a response to. I assume it is the only way...
>
> Anyways... I would like to build my own hbase shell command. I have not
> found relevant documentation explaining this. (perhaps I've missed it). To
> do this, I have copied
>
> $HBASE_HOME/libexec/lib/ruby/shell/commands/get.rb
>
> To
>
> $HBASE_HOME/libexec/lib/ruby/shell/commands/foo.rb
>
> Additionally, I changed the class to: class Foo < Command as well as the
> methods:
>       def command(table, row, *args)
>         foo(table(table), row, *args)
>       end
>
>       def foo(table, row, *args)
>
> and the addition to the shell:
> #add get command to table
> ::Hbase::Table.add_shell_command('foo')
>
> From the getting started samples, I run this:
> 1.8.7-p357 :003 > get 'test','row1'
> COLUMN                         CELL
>  cf:a                          timestamp=1411441874803, value=value1
> 1 row(s) in 0.0210 seconds
>
> 1.8.7-p357 :004 > foo 'test','row1'
> NoMethodError: undefined method `foo' for #<Object:0x205eb650>
>
> What else do I need to do?
>
>
>
> --
> View this message in context:
> http://apache-hbase.679495.n3.nabble.com/custom-hbase-commands-tp4064391.html
> Sent from the HBase Developer mailing list archive at Nabble.com.
>

Reply via email to