HBASE-487 New hbase shell
Part 3: Avoid the help problem. Output banner that tells user instead to type 'hbase' for list of commands. Update jruby to 1.1.2 release. git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@661825 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6df625a35
commit
b5cd4f69a2
10
bin/hbase
10
bin/hbase
|
@ -55,11 +55,11 @@ esac
|
|||
if [ $# = 0 ]; then
|
||||
echo "Usage: hbase <command>"
|
||||
echo "where <command> is one of:"
|
||||
echo " shell run the Hbase shell"
|
||||
echo " master run an Hbase HMaster node"
|
||||
echo " regionserver run an Hbase HRegionServer node"
|
||||
echo " rest run an Hbase REST server"
|
||||
echo " thrift run an Hbase Thrift server"
|
||||
echo " shell run the HBase shell"
|
||||
echo " master run an HBase HMaster node"
|
||||
echo " regionserver run an HBase HRegionServer node"
|
||||
echo " rest run an HBase REST server"
|
||||
echo " thrift run an HBase Thrift server"
|
||||
echo " migrate upgrade an hbase.rootdir"
|
||||
echo " or"
|
||||
echo " CLASSNAME run the class named CLASSNAME"
|
||||
|
|
37
bin/hirb.rb
37
bin/hirb.rb
|
@ -1,5 +1,13 @@
|
|||
# Some goodies for hirb
|
||||
require 'irb/completion'
|
||||
# Module passed to jirb using the '-r' flag when bin/hbase shell is invoked.
|
||||
# Pollutes jirb with hbase imports and hbase commands. Outputs a banner
|
||||
# that tells user where to find help, shell version, etc.
|
||||
|
||||
# TODO: Process command-line arguments: e.g. --master= or -Dhbase.etc and --formatter
|
||||
# or read hbase shell configurations from irbrc
|
||||
# TODO: Read from environment which outputter to use (outputter should
|
||||
# be able to output to a passed Stream as well as STDIN and STDOUT)
|
||||
# TODO: Write a base class for formatters with ascii, xhtml, and json subclasses.
|
||||
# TODO: Intercept 'help'
|
||||
|
||||
# Run the java magic include and import basic HBase types.
|
||||
include Java
|
||||
|
@ -11,20 +19,25 @@ import org.apache.hadoop.hbase.HConstants
|
|||
import org.apache.hadoop.hbase.HTableDescriptor
|
||||
import org.apache.hadoop.hbase.io.BatchUpdate
|
||||
|
||||
# Some goodies for hirb. Should these be left up to the user's discretion?
|
||||
require 'irb/completion'
|
||||
|
||||
# Set the irb shell name to be hbase.
|
||||
IRB.conf[:IRB_NAME] = "hbase"
|
||||
|
||||
# TODO: Read from environment which outputter to use (outputter should
|
||||
# be able to output to a passed Stream as well as STDIN and STDOUT)
|
||||
|
||||
|
||||
def help
|
||||
puts 'HBase Commands:'
|
||||
puts ' version Output the hbase version'
|
||||
def hbase
|
||||
puts 'HBase Shell Commands:'
|
||||
puts ' version Output HBase version'
|
||||
end
|
||||
|
||||
def version
|
||||
puts "HBase Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}"
|
||||
puts "SVN Revision: #{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}"
|
||||
puts "HBase Compiled: #{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
|
||||
puts "Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()},\
|
||||
r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()},\
|
||||
#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
|
||||
end
|
||||
|
||||
# Output a banner message that tells users where to go for help
|
||||
# TODO: Test that we're in irb context. For now presume it.
|
||||
# TODO: Test that we are in shell context.
|
||||
puts "HBase Shell; type 'hbase<RETURN>' for the list of supported HBase commands"
|
||||
version
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue