HBASE-20482 Printed a link to the ref guide chapter for the shell during startup

Signed-off-by: Mike Drob <mdrob@apache.org>
This commit is contained in:
Sakthi 2018-04-27 15:57:15 -07:00 committed by Mike Drob
parent cf59f2a1d2
commit 1cc62e9286
2 changed files with 14 additions and 1 deletions

View File

@ -152,6 +152,7 @@ module Shell
puts 'HBase Shell' puts 'HBase Shell'
puts 'Use "help" to get list of supported commands.' puts 'Use "help" to get list of supported commands.'
puts 'Use "exit" to quit this interactive shell.' puts 'Use "exit" to quit this interactive shell.'
puts 'For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell'
print 'Version ' print 'Version '
command('version') command('version')
puts puts

View File

@ -21,6 +21,8 @@ require 'hbase_constants'
require 'shell' require 'shell'
class ShellTest < Test::Unit::TestCase class ShellTest < Test::Unit::TestCase
include Hbase::TestHelpers
def setup def setup
@hbase = ::Hbase::Hbase.new($TEST_CLUSTER.getConfiguration) @hbase = ::Hbase::Hbase.new($TEST_CLUSTER.getConfiguration)
@shell = Shell::Shell.new(@hbase) @shell = Shell::Shell.new(@hbase)
@ -69,7 +71,17 @@ class ShellTest < Test::Unit::TestCase
@shell.command('version') @shell.command('version')
end end
#------------------------------------------------------------------------------- #-----------------------------------------------------------------------------
define_test 'Shell::Shell#print_banner should display Reference Guide link' do
@shell.interactive = true
output = capture_stdout { @shell.print_banner }
@shell.interactive = false
link_regex = %r{For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell}
assert_match(link_regex, output)
end
#-----------------------------------------------------------------------------
define_test "Shell::Shell interactive mode should not throw" do define_test "Shell::Shell interactive mode should not throw" do
# incorrect number of arguments # incorrect number of arguments