Permalink
Browse files

makekeyspace argument to "describe keyspace" in CLIoptional

patch by Pavel Yaskevich; reviewed by jbellis for CASSANDRA-2029

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1062181 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent d9a3243 commit 03b528aa2eb469b94e45c0ee305bb41b7cdbb095 @jbellis jbellis committed Jan 22, 2011
View
@@ -28,6 +28,8 @@
* fix streaming of multiple CFs during bootstrap (CASSANDRA-1992)
* explicitly set JVM GC new generation size with -Xmn (CASSANDRA-1968)
* add short options for CLI flags (CASSANDRA-1565)
+ * make keyspace argument to "describe keyspace" in CLI optional
+ when authenticated to keyspace already (CASSANDRA-2029)
0.7.0-final
@@ -321,8 +321,8 @@ showKeyspaces
;
describeTable
- : DESCRIBE KEYSPACE keyspace
- -> ^(NODE_DESCRIBE_TABLE keyspace)
+ : DESCRIBE KEYSPACE (keyspace)?
+ -> ^(NODE_DESCRIBE_TABLE (keyspace)?)
;
useKeyspace
@@ -1336,17 +1336,30 @@ private void describeKeySpace(String keySpaceName, KsDef metadata) throws TExcep
}
}
- // DESCRIBE KEYSPACE <keyspace_name>
+ // DESCRIBE KEYSPACE (<keyspace_name>)?
private void executeDescribeKeySpace(Tree statement) throws TException, InvalidRequestException
{
if (!CliMain.isConnected())
return;
- // Get keySpace name
- String keySpaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces());
- if( keySpaceName == null ) {
- sessionState.out.println("Keyspace argument required");
+ String keySpaceName;
+
+ // Get keyspace name
+ if (statement.getChildCount() == 0)
+ {
+ // trying to use current keyspace if keyspace name was not given
+ keySpaceName = keySpace;
+ }
+ else
+ {
+ // we have keyspace name as an argument
+ keySpaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces());
+ }
+
+ if (keySpaceName == null)
+ {
+ sessionState.out.println("Keyspace argument required if you are not authorized in any keyspace.");
return;
}
@@ -97,8 +97,9 @@ protected void printCmdHelp(Tree statement, CliSessionState state)
break;
case CliParser.NODE_DESCRIBE_TABLE:
- state.out.println("describe keyspace <keyspace>;\n");
- state.out.println("Show additional information about the specified keyspace.\n");
+ state.out.println("describe keyspace (<keyspace>)?;\n");
+ state.out.println("Show additional information about the specified keyspace.");
+ state.out.println("Command could be used without <keyspace> argument if you are already authenticated to keyspace.\n");
state.out.println("example:");
state.out.println("describe keyspace system;");
break;
@@ -321,7 +322,7 @@ protected void printCmdHelp(Tree statement, CliSessionState state)
state.out.println("help <command>; Display detailed, command-specific help.");
state.out.println("connect <hostname>/<port>; Connect to thrift service.");
state.out.println("use <keyspace> [<username> 'password']; Switch to a keyspace.");
- state.out.println("describe keyspace <keyspacename>; Describe keyspace.");
+ state.out.println("describe keyspace (<keyspacename>)?; Describe keyspace.");
state.out.println("exit; Exit CLI.");
state.out.println("quit; Exit CLI.");
state.out.println("show cluster name; Display cluster name.");

0 comments on commit 03b528a

Please sign in to comment.