Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: fix sample code in chapter "Validation" #1155

Merged
merged 1 commit into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,7 @@ class SingleOptionValidationExample {
String.format("Invalid value '%s' for option '--p': " +
"value is not a prime number.", value));
}
prime = value;
}
// ...
}
Expand All @@ -2402,9 +2403,9 @@ The following example validates that at least one of the `--xml`, `--csv`, or `-
----
@Command(name = "myapp", mixinStandardHelpOptions = true, version = "myapp 0.1")
class MultiOptionValidationExample implements Runnable {
@Option(name="--xml") List<File> xmlFiles;
@Option(name="--csv") List<File> csvFiles;
@Option(name="--json") List<File> jsonFiles;
@Option(names="--xml") List<File> xmlFiles;
@Option(names="--csv") List<File> csvFiles;
@Option(names="--json") List<File> jsonFiles;
@Spec CommandSpec spec; // injected by picocli
Expand All @@ -2426,7 +2427,7 @@ class MultiOptionValidationExample implements Runnable {
}
}
private void missing(List<?> list) {
private boolean missing(List<?> list) {
return list == null || list.isEmpty();
}
}
Expand Down