File tree 3 files changed +50
-0
lines changed
test/java/org/springframework/shell/docs
3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ [[using-shell-options-label]]
2
+ ==== Label
3
+ ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
4
+
5
+ _Option Label_ has no functional behaviour within a shell itself other than
6
+ what a default `help` command outputs. Within a command documentation
7
+ a type of an option is documented but this is not always super useful. Thus
8
+ you may want to give better descriptive word for an option.
9
+
10
+ ====
11
+ [source, java, indent=0]
12
+ ----
13
+ include::{snippets}/OptionSnippets.java[tag=option-registration-label]
14
+ ----
15
+ ====
16
+
17
+ Defining label is then shown in `help`.
18
+
19
+ ====
20
+ [source, bash]
21
+ ----
22
+ my-shell:>help mycommand
23
+ NAME
24
+ mycommand -
25
+
26
+ SYNOPSIS
27
+ mycommand --arg1 String --arg2 MYLABEL
28
+
29
+ OPTIONS
30
+ --arg1 String
31
+ [Optional]
32
+
33
+ --arg2 MYLABEL
34
+ [Optional]
35
+
36
+ ----
37
+ ====
Original file line number Diff line number Diff line change @@ -18,3 +18,5 @@ include::using-shell-options-optional.adoc[]
18
18
include::using-shell-options-default.adoc[]
19
19
20
20
include::using-shell-options-validation.adoc[]
21
+
22
+ include::using-shell-options-label.adoc[]
Original file line number Diff line number Diff line change @@ -163,6 +163,17 @@ public void dump1() {
163
163
.build ();
164
164
// end::option-registration-default[]
165
165
166
+ // tag::option-registration-label[]
167
+ CommandRegistration .builder ()
168
+ .withOption ()
169
+ .longNames ("arg1" )
170
+ .and ()
171
+ .withOption ()
172
+ .longNames ("arg2" )
173
+ .label ("MYLABEL" )
174
+ .and ()
175
+ .build ();
176
+ // end::option-registration-label[]
166
177
}
167
178
168
179
}
You can’t perform that action at this time.
0 commit comments