HBASE-2371. Fix 'list' command in shell

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@949549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2010-05-30 18:03:46 +00:00
parent c8f365c85b
commit 57740b8e12
2 changed files with 16 additions and 4 deletions

View File

@ -364,6 +364,7 @@ Release 0.21.0 - Unreleased
(Christo Wilson via Stack)
HBASE-2621 Fix bad link to HFile documentation in javadoc
(Jeff Hammerbacher via Todd Lipcon)
HBASE-2371 Fix 'list' command in shell (Alexey Kovyrin via Todd Lipcon)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -23,14 +23,25 @@ module Shell
class List < Command
def help
return <<-EOF
List all tables in hbase
List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:
hbase> list
hbase> list 'abc.*'
EOF
end
def command
format_simple_command do
admin.list
def command(regex = ".*")
now = Time.now
formatter.header([ "TABLE" ])
regex = /#{regex}/ unless regex.is_a?(Regexp)
list = admin.list.grep(regex)
list.each do |table|
formatter.row([ table ])
end
formatter.footer(now, list.count)
end
end
end