You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by to...@apache.org on 2010/05/30 20:03:47 UTC
svn commit: r949549 - in /hbase/trunk: CHANGES.txt
src/main/ruby/shell/commands/list.rb
Author: todd
Date: Sun May 30 18:03:46 2010
New Revision: 949549
URL: http://svn.apache.org/viewvc?rev=949549&view=rev
Log:
HBASE-2371. Fix 'list' command in shell
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/ruby/shell/commands/list.rb
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=949549&r1=949548&r2=949549&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun May 30 18:03:46 2010
@@ -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
Modified: hbase/trunk/src/main/ruby/shell/commands/list.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/list.rb?rev=949549&r1=949548&r2=949549&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/list.rb (original)
+++ hbase/trunk/src/main/ruby/shell/commands/list.rb Sun May 30 18:03:46 2010
@@ -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