[[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 a existing `help` command regardless
what other command-line options is typed.

Below 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 programmationally or via annotations will automatically add
help options. With annotation model you can only turn things off globally, programmatic
model gives option to modify settings per command.
