Files
spring-shell/spring-shell-docs/src/main/asciidoc/using-shell-options-optional.adoc
2022-07-14 19:18:50 +03:00

24 lines
601 B
Plaintext

[[using-shell-options-optional]]
=== Optional Value
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
An option is either required or not and, generally speaking, how it behaves depends on
a command target:
====
[source, java, indent=0]
----
include::{snippets}/OptionSnippets.java[tag=option-registration-optional]
----
====
In the annotation model, there is no direct way to define if argument is
optional. Instead, it is instructed to be `NULL`:
====
[source, java, indent=0]
----
include::{snippets}/OptionSnippets.java[tag=option-with-annotation-optional]
----
====