Skip to content

Commit a019934

Browse files
committed
Update docs
- Document option label - Relates #433
1 parent 088c426 commit a019934

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
====

spring-shell-docs/src/main/asciidoc/using-shell-options.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ include::using-shell-options-optional.adoc[]
1818
include::using-shell-options-default.adoc[]
1919

2020
include::using-shell-options-validation.adoc[]
21+
22+
include::using-shell-options-label.adoc[]

spring-shell-docs/src/test/java/org/springframework/shell/docs/OptionSnippets.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ public void dump1() {
163163
.build();
164164
// end::option-registration-default[]
165165

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[]
166177
}
167178

168179
}

0 commit comments

Comments
 (0)