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:
parent
c8f365c85b
commit
57740b8e12
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue