From d86bfed7738ca49d349aa99ef578f5c1fa9148cc Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Wed, 5 Jul 2023 10:34:17 +0100 Subject: [PATCH] Add primary command docs - Backport #755 - Relates #799 --- ...ing-shell-customization-singlecommand.adoc | 23 +++++++++++++++++++ .../asciidoc/using-shell-customization.adoc | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 spring-shell-docs/src/main/asciidoc/using-shell-customization-singlecommand.adoc diff --git a/spring-shell-docs/src/main/asciidoc/using-shell-customization-singlecommand.adoc b/spring-shell-docs/src/main/asciidoc/using-shell-customization-singlecommand.adoc new file mode 100644 index 00000000..19233207 --- /dev/null +++ b/spring-shell-docs/src/main/asciidoc/using-shell-customization-singlecommand.adoc @@ -0,0 +1,23 @@ +[[using-shell-customization-singlecommand]] +=== Single Command +ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs] + +If your shell application is made for exactly a single purpose having only one +command it may be beneficial to configure it for this. Property +`spring.shell.noninteractive.primary-command` if defined will disable all other +runners than `NonInteractiveShellRunner` and configures it to use +defined _Primary Command_. + +==== +[source, yaml] +---- +spring: + shell: + noninteractive: + primary-command: mycommand +---- +==== + +For example if you have a command `mycommand` with option `arg` +it had to be executed with ` mycommand --arg hi`, but with above +setting it can be executed with ` --arg hi`. diff --git a/spring-shell-docs/src/main/asciidoc/using-shell-customization.adoc b/spring-shell-docs/src/main/asciidoc/using-shell-customization.adoc index 00163dac..e1c80c1c 100644 --- a/spring-shell-docs/src/main/asciidoc/using-shell-customization.adoc +++ b/spring-shell-docs/src/main/asciidoc/using-shell-customization.adoc @@ -8,3 +8,5 @@ include::using-shell-customization-styling.adoc[] include::using-shell-customization-logging.adoc[] include::using-shell-customization-commandnotfound.adoc[] + +include::using-shell-customization-singlecommand.adoc[]