Anonymous avatar Anonymous committed 03b528a

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

Comments (0)

Files changed (4)

  * 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

src/java/org/apache/cassandra/cli/Cli.g

     ;
 
 describeTable
-    : DESCRIBE KEYSPACE keyspace 
-        -> ^(NODE_DESCRIBE_TABLE keyspace)
+    : DESCRIBE KEYSPACE (keyspace)?
+        -> ^(NODE_DESCRIBE_TABLE (keyspace)?)
     ;
     
 useKeyspace

src/java/org/apache/cassandra/cli/CliClient.java

         }
     }
 
-    // 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;
         }
         

src/java/org/apache/cassandra/cli/CliUserHelp.java

                 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;
             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.");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.