Rework prefix handling

This commit is contained in:
Eric Bottard
2017-08-10 15:34:38 +02:00
parent cc37bb013b
commit 136ab89678
3 changed files with 24 additions and 28 deletions

View File

@@ -114,7 +114,7 @@ public class Help {
for (ParameterDescription description : parameterDescriptions) {
if (description.defaultValue().isPresent()) {
if (description.defaultValue().isPresent() && description.formal().length()>0) {
result.append("["); // Whole parameter is optional, as there is a default value (1)
}
List<String> keys = description.keys();
@@ -137,7 +137,7 @@ public class Help {
if (description.defaultValueWhenFlag().isPresent()) {
result.append("]"); // (close 3)
}
if (description.defaultValue().isPresent()) {
if (description.defaultValue().isPresent() && description.formal().length()>0) {
result.append("]"); // (close 1)
}
result.append(" "); // two spaces between each param for better legibility

View File

@@ -7,10 +7,10 @@ SYNOPSYS&
first-command [-r] [-f] [[-n] int] [-o] float float float &
&
OPTIONS&
-r Whether to delete recursively [Mandatory]&
-r Whether to delete recursively [Optional, default = false]&
&
-f or --force&
Do not ask for confirmation. YOLO [Mandatory]&
Do not ask for confirmation. YOLO [Optional, default = false]&
&
-n int&
The answer to everything [Optional, default = 42]&