diff --git a/docs/src/reference/docbook/reference/shell.xml b/docs/src/reference/docbook/reference/shell.xml
index 3b999783..a4d01b18 100644
--- a/docs/src/reference/docbook/reference/shell.xml
+++ b/docs/src/reference/docbook/reference/shell.xml
@@ -286,6 +286,15 @@ public class HelloWorldCommands implements CommandMarker {
lines to store in the command history file. Default value is
3000.
+
+
+ --disableInternalCommands - Flag that disables all commands that would
+ be pre-registered with the shell. There is no argument to this option. You can selectively add
+ back any internal commands by referencing them in your shell plugin file. Look at the
+ Spring Shell javadocs for specific commands located in the
+ org.springframework.shell.commands package as well as the section in this documentation
+ of Built in commands.
+
diff --git a/samples/helloworld/gradle.properties b/samples/helloworld/gradle.properties
index 43f26f22..1b81abf8 100644
--- a/samples/helloworld/gradle.properties
+++ b/samples/helloworld/gradle.properties
@@ -1,4 +1,4 @@
-springShellVersion = 1.1.0.M1
+springShellVersion = 1.1.0.BUILD-SNAPSHOT
junitVersion = 4.10
log4jVersion = 1.2.17
version = 1.0.0.RELEASE
diff --git a/src/main/java/org/springframework/shell/Bootstrap.java b/src/main/java/org/springframework/shell/Bootstrap.java
index faa8daa6..94fde82f 100644
--- a/src/main/java/org/springframework/shell/Bootstrap.java
+++ b/src/main/java/org/springframework/shell/Bootstrap.java
@@ -86,7 +86,11 @@ public class Bootstrap {
configureApplicationContext(ctx);
//built-in commands and converters
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx);
- scanner.scan("org.springframework.shell.commands", "org.springframework.shell.converters", "org.springframework.shell.plugin.support");
+ if (commandLine.getDisableInternalCommands()) {
+ scanner.scan("org.springframework.shell.converters", "org.springframework.shell.plugin.support");
+ } else {
+ scanner.scan("org.springframework.shell.commands", "org.springframework.shell.converters", "org.springframework.shell.plugin.support");
+ }
//user contributed commands
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) ctx);
reader.loadBeanDefinitions(contextPath);
diff --git a/src/main/java/org/springframework/shell/CommandLine.java b/src/main/java/org/springframework/shell/CommandLine.java
index 3bca778b..c4d6466a 100644
--- a/src/main/java/org/springframework/shell/CommandLine.java
+++ b/src/main/java/org/springframework/shell/CommandLine.java
@@ -26,6 +26,7 @@ public class CommandLine {
private String[] args;
private int historySize;
private String[] shellCommandsToExecute;
+ private boolean disableInteralCommands;
/**
* Construct a new CommandLine
@@ -33,10 +34,11 @@ public class CommandLine {
* @param historySize the size of this history buffer
* @param shellCommandsToExecute semi-colon delimited list of commands for the shell to execute
*/
- public CommandLine(String[] args, int historySize, String[] shellCommandsToExecute) {
+ public CommandLine(String[] args, int historySize, String[] shellCommandsToExecute, boolean disableInteralCommands) {
this.args = args;
this.historySize = historySize;
this.shellCommandsToExecute = shellCommandsToExecute;
+ this.disableInteralCommands = disableInteralCommands;
}
/**
@@ -60,5 +62,13 @@ public class CommandLine {
public String[] getShellCommandsToExecute() {
return shellCommandsToExecute;
}
+
+ /**
+ *
+ * @return the disableInteralCommands value
+ */
+ public boolean getDisableInternalCommands() {
+ return disableInteralCommands;
+ }
}
diff --git a/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java b/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java
index 5edff271..6890b0a1 100644
--- a/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java
+++ b/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java
@@ -38,6 +38,7 @@ public class SimpleShellCommandLineOptions {
String[] executeThenQuit = null;
Map extraSystemProperties = new HashMap();
int historySize = DEFAULT_HISTORY_SIZE;
+ boolean disableCommands;
public static CommandLine parseCommandLine(String[] args)
throws IOException {
@@ -79,6 +80,8 @@ public class SimpleShellCommandLineOptions {
} catch (ArrayIndexOutOfBoundsException ae) {
LOGGER.warning("No value specified for --histsize option");
}
+ } else if (arg.equals("--disableInternalCommands")) {
+ options.disableCommands = true;
} else if (arg.equals("--help")) {
printUsage();
System.exit(0);
@@ -112,7 +115,7 @@ public class SimpleShellCommandLineOptions {
System.setProperty(entry.getKey(), entry.getValue());
}
- return new CommandLine(args, options.historySize, options.executeThenQuit);
+ return new CommandLine(args, options.historySize, options.executeThenQuit, options.disableCommands);
}
private static void printUsage() {