Migrate docs to antora
- This is basically copy from main branch minus all terminal ui things. - Relates #971
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
[[using-shell-options-basics-annotation]]
|
||||
= Annotation
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
`Option` annotation can be used to define an option name if you
|
||||
don't want it to be same as argument name.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/OptionSnippets.java[tag=option-with-option-annotation]
|
||||
----
|
||||
@@ -0,0 +1,12 @@
|
||||
[[using-shell-options-basics]]
|
||||
= Basics
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
This section gives a generic idea how an option can be defined. Following
|
||||
sections, beyond basics, discuss more about how various option behaviour
|
||||
can be accomplished for a particular use case.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
[[using-shell-options-basics-legacyannotation]]
|
||||
= Legacy Annotation
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
Having a target method with argument is automatically registered with a matching
|
||||
argument name.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/OptionSnippets.java[tag=option-without-annotation]
|
||||
----
|
||||
|
||||
`@ShellOption` annotation can be used to define an option name if you
|
||||
don't want it to be same as argument name.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/OptionSnippets.java[tag=option-with-annotation]
|
||||
----
|
||||
|
||||
If option name is defined without prefix, either `-` or `--`, it is discovered
|
||||
from _ShellMethod#prefix_.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/OptionSnippets.java[tag=option-with-annotation-without-prefix]
|
||||
----
|
||||
@@ -0,0 +1,19 @@
|
||||
[[using-shell-options-basics-registration]]
|
||||
[[using-shell-options-basics-programmatic]]
|
||||
= Programmatic
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
Programmatic way with `CommandRegistration` is to use `withOption` to define
|
||||
an option.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/OptionSnippets.java[tag=option-registration-longarg]
|
||||
----
|
||||
|
||||
`CommandRegistration` can be defined as a bean or manually registered
|
||||
with a `CommandCatalog`.
|
||||
|
||||
NOTE: Check below sections for other option types, i.e. short format.
|
||||
Reference in New Issue
Block a user