Update documentation

This commit is contained in:
Mahmoud Ben Hassine
2025-04-25 10:13:56 +02:00
parent d909f79d7b
commit e3cb93791d
49 changed files with 182 additions and 189 deletions

View File

@@ -3,7 +3,7 @@
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
On default a missing command is handled via `CommandNotFoundResultHandler`
By default, a missing command is handled via `CommandNotFoundResultHandler`
and outputs a simple message:
[source, text]
@@ -12,7 +12,7 @@ shell:>missing
No command found for 'missing'
----
Internally `CommandNotFoundResultHandler` is using `CommandNotFoundMessageProvider`
Internally, `CommandNotFoundResultHandler` is using `CommandNotFoundMessageProvider`
which is a simple function taking a `ProviderContext` and returning a text
message. Below is an example what a custom message provider might look like.

View File

@@ -1,11 +1,11 @@
[[using-shell-customization-logging]]
= Logging
On default a _Spring Boot_ application will log messages into a console which
By default, a _Spring Boot_ application logs messages into a console which
at minimum is annoying and may also mix output from a shell commands.
Fortunately there is a simple way to instruct logging changes via boot properties.
Fortunately, there is a simple way to instruct logging changes via Spring Boot properties.
Completely silence console logging by defining its pattern as an empty value.
To completely silence console logging, set the console's logging pattern to an empty value:
[source, yaml]
----
@@ -14,7 +14,7 @@ logging:
console:
----
If you need log from a shell then write those into a file.
If you need log from a shell then write those into a file:
[source, yaml]
----
@@ -23,7 +23,7 @@ logging:
name: shell.log
----
If you need different log levels.
If you need different log levels:
[source, yaml]
----
@@ -34,8 +34,8 @@ logging:
shell: debug
----
Passing contiguration properties as command line options is not supported but
you can use any other ways supported by boot, for example.
Passing configuration properties as command line options is not supported,
but you can use other ways supported by Spring Boot, for example:
[source, bash]
----
@@ -43,5 +43,5 @@ $ java -Dlogging.level.root=debug -jar demo.jar
$ LOGGING_LEVEL_ROOT=debug java -jar demo.jar
----
NOTE: In a GraalVM image settings are locked during compilation which means
NOTE: In a GraalVM image, settings are locked during compilation which means
you can't change log levels at runtime.

View File

@@ -5,10 +5,9 @@
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_.
command, it may be beneficial to configure it for this. If the property
`spring.shell.noninteractive.primary-command` is defined, it will disable all other
runners than `NonInteractiveShellRunner` and configures it to use the defined _Primary Command_.
[source, yaml]
----
@@ -18,6 +17,6 @@ spring:
primary-command: mycommand
----
For example if you have a command `mycommand` with option `arg`
it had to be executed with `<shellapp> mycommand --arg hi`, but with above
setting it can be executed with `<shellapp> --arg hi`.
For example, if you have a command `mycommand` with option `arg`
that is expected to be executed with `<shellapp> mycommand --arg hi` in a multi-command app,
then with the above configuration it can be executed with `<shellapp> --arg hi`.

View File

@@ -4,37 +4,35 @@
ifndef::snippets[:snippets: ../../../../src/test/java/org/springframework/shell/docs]
Current terminal implementations are rich in features and can usually show
something else that just plain text. For example a text can be styled to be
something else that just plain text. For example, a text can be styled to be
_bold_ or have different colors. It's also common for terminals to be able
to show various characters from an unicode table like emoji's which are usually
to show various characters from a unicode table like emoji's which are usually
used to make shell output more pretty.
Spring Shell supports these via it's theming framework which contains two parts,
firstly _styling_ can be used to change text type and secondly _figures_ how
some characters are shown. These two are then combined together as a _theme_.
Spring Shell supports these via it's theming framework which contains two parts.
Firstly, _styling_ can be used to change text type and secondly, _figures_ are used
to customize how characters are shown. These two parts are then combined as a _theme_.
More about _theming_ internals, see xref:appendices/techintro/theming.adoc[Theming].
For more detail about _theming_ internals, refer to see xref:appendices/techintro/theming.adoc[Theming].
NOTE: Default theme is named `default` but can be change using property
`spring.shell.theme.name`. Other built-in theme named `dump` uses
no styling for colors and tries to not use any special figures.
NOTE: Default theme is named `default` but can be changed using the property
`spring.shell.theme.name`. There is also another built-in theme named `dump`
that uses no styling for colors and tries to not use any special figures.
Modify existing style by overriding settings.
You can modify existing styles and figures by overriding the default settings:
[source, java, indent=0]
----
include::{snippets}/ThemingSnippets.java[tag=custom-style-class]
----
Modify existing figures by overriding settings.
[source, java, indent=0]
----
include::{snippets}/ThemingSnippets.java[tag=custom-figure-class]
----
To create a new theme, create a `ThemeSettings` and provide your own _style_
and _figure_ implementations.
You can also create a new theme, by creating a `ThemeSettings` and provide your own _style_
and _figure_ implementations:
[source, java, indent=0]
----