You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/10/10 14:27:56 UTC
svn commit: r1530935 -
/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
Author: jbonofre
Date: Thu Oct 10 12:27:56 2013
New Revision: 1530935
URL: http://svn.apache.org/r1530935
Log:
[KARAF-2496] Improvements on the shell:completion command
Modified:
karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
Modified: karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java?rev=1530935&r1=1530934&r2=1530935&view=diff
==============================================================================
--- karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java (original)
+++ karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java Thu Oct 10 12:27:56 2013
@@ -24,18 +24,25 @@ import org.apache.karaf.shell.console.Se
/**
* Command to change the completion mode while using the shell console.
*/
-@Command(scope = "shell", name = "completion", description = "Change the completion mode on the current console session.")
+@Command(scope = "shell", name = "completion", description = "Display or change the completion mode on the current console session.")
public class CompletionAction extends AbstractAction {
- @Argument(index = 0, name = "mode", description = "", required = true, multiValued = false)
+ @Argument(index = 0, name = "mode", description = "The completion mode to set. The valid completion modes are: global, first, subshell.", required = false, multiValued = false)
String mode;
protected Object doExecute() throws Exception {
+ if (mode == null) {
+ System.out.println(session.get(SessionProperties.COMPLETION_MODE));
+ return null;
+ }
+
if (!mode.equalsIgnoreCase("global") && !mode.equalsIgnoreCase("first") && !mode.equalsIgnoreCase("subshell")) {
System.err.println("The completion mode is not correct. The valid modes are: global, first, subshell. See documentation for details.");
return null;
}
+ mode = mode.toUpperCase();
+
session.put(SessionProperties.COMPLETION_MODE, mode);
return null;
}