You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/11/14 06:24:23 UTC
[groovy] 04/04: GROOVY-8668: add property groovysh.disableDocCommand (#1822)
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 557b6a6c42e119f178ac8d1393f5c90c680bd80c
Author: tison <wa...@gmail.com>
AuthorDate: Sun Nov 13 12:42:19 2022 +0800
GROOVY-8668: add property groovysh.disableDocCommand (#1822)
* add property groovysh.disableDocCommand
Signed-off-by: tison <wa...@gmail.com>
* null safe operator
Signed-off-by: tison <wa...@gmail.com>
Signed-off-by: tison <wa...@gmail.com>
---
.../groovysh/util/DefaultCommandsRegistrar.groovy | 47 +++++++++++-----------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/util/DefaultCommandsRegistrar.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/util/DefaultCommandsRegistrar.groovy
index 3c7d1f0600..9fc9ef430c 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/util/DefaultCommandsRegistrar.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/util/DefaultCommandsRegistrar.groovy
@@ -57,31 +57,32 @@ class DefaultCommandsRegistrar {
}
void register() {
+ def commands = [
+ new HelpCommand(shell),
+ new ExitCommand(shell),
+ new ImportCommand(shell),
+ new DisplayCommand(shell),
+ new ClearCommand(shell),
+ new ShowCommand(shell),
+ new InspectCommand(shell),
+ new PurgeCommand(shell),
+ new EditCommand(shell),
+ new LoadCommand(shell),
+ new SaveCommand(shell),
+ new RecordCommand(shell),
+ new HistoryCommand(shell),
+ new AliasCommand(shell),
+ new SetCommand(shell),
+ new GrabCommand(shell),
+ new RegisterCommand(shell),
+ ]
- for (Command classname in [
- new HelpCommand(shell),
- new ExitCommand(shell),
- new ImportCommand(shell),
- new DisplayCommand(shell),
- new ClearCommand(shell),
- new ShowCommand(shell),
- new InspectCommand(shell),
- new PurgeCommand(shell),
- new EditCommand(shell),
- new LoadCommand(shell),
- new SaveCommand(shell),
- new RecordCommand(shell),
- new HistoryCommand(shell),
- new AliasCommand(shell),
- new SetCommand(shell),
- new GrabCommand(shell),
- // does not do anything
- //new ShadowCommand(shell),
- new RegisterCommand(shell),
- new DocCommand(shell)
- ]) {
- shell.register(classname)
+ if (!System.getProperty("groovysh.disableDocCommand")?.toBoolean()) {
+ commands.add(new DocCommand(shell))
}
+ for (Command classname in commands) {
+ shell.register(classname)
+ }
}
}