Files
Mahmoud Ben Hassine e3cb93791d Update documentation
2025-04-25 10:13:56 +02:00

39 lines
1.2 KiB
Plaintext

[[commands-helpoptions]]
= Help Options
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
_Spring Shell_ has a build-in `help` command but not all favour getting command help
from it as you always need to call it with arguments for target command. It's
common in many CLI frameworks for every command having options _--help_ and _-h_
to print out command help.
Default functionality is that every command will get modified to have options
_--help_ and _-h_, which if present in a given command will automatically
short circuit command execution into an existing `help` command regardless
what other command-line options are typed.
The following example shows its default settings:
[source, java, indent=0]
----
include::{snippets}/CommandRegistrationHelpOptionsSnippets.java[tag=defaults]
----
It is possible to change default behaviour via configuration options:
[source, yaml]
----
spring:
shell:
help:
enabled: true
long-names: help
short-names: h
command: help
----
NOTE: Commands defined programmatically or via annotations will automatically add
help options. With the annotation model you can only turn things off globally, while
with the programmatic model you can modify settings per command.