Skip to content

Commit

Permalink
feat(cli): Add --help and -V flags to subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Jan 7, 2023
1 parent e571d80 commit a6acdd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* @author Andres Almiray
* @since 1.1.0
*/
@CommandLine.Command
@CommandLine.Command(mixinStandardHelpOptions = true,
versionProvider = Versions.class)
abstract class AbstractCommand implements Callable<Integer> {
protected Logger logger;

Expand All @@ -57,7 +58,7 @@ abstract class AbstractCommand implements Callable<Integer> {

@CommandLine.Option(names = "-D",
paramLabel = "<key=value>",
descriptionKey = "system-property",
description = "Sets a System property. Repeatable.",
mapFallbackValue = "")
void setProperty(Map<String, String> props) {
props.forEach(System::setProperty);
Expand Down
8 changes: 5 additions & 3 deletions pomchecker-cli/src/site/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Commands:
[source]
----
$ pomchecker check-bom --help
Usage: pomchecker check-bom [-diqw] --file=<pomFile>
Usage: pomchecker check-bom [-diqw] --file=<pomFile> [-D=<key=value>]...
Checks if a POM file is a minimal BOM file
-d, --debug Set log level to debug.
-D=<key=value>
--file=<pomFile> The POM file to check
-i, --info Set log level to info.
-q, --quiet Log errors only.
Expand All @@ -36,14 +37,15 @@ Checks if a POM file is a minimal BOM file
----
$ pomchecker check-maven-central --help
Usage: pomchecker check-maven-central [-diqw] [--no-release] [--no-strict]
--file=<pomFile>
--file=<pomFile> [-D=<key=value>]...
Checks if a POM complies with the rules for uploading to Maven Central
-d, --debug Set log level to debug.
-D=<key=value>
--file=<pomFile> The POM file to check
-i, --info Set log level to info.
--no-release Checks if version is -SNAPSHOT
--no-strict Checks if <repositories> and <pluginRepositories> are
present
-q, --quiet Log errors only.
-w, --warn Set log level to warn.
----
----

0 comments on commit a6acdd1

Please sign in to comment.