From 0f15ad70e50a58e1bf6b638f1e6310478c8f8141 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Thu, 12 Dec 2024 15:23:28 +0100 Subject: [PATCH] [MNG-8423] mvnenc -h (#1971) Expand mvnenc help --- https://issues.apache.org/jira/browse/MNG-8423 --- .../mvnenc/CommonsCliEncryptOptions.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnenc/CommonsCliEncryptOptions.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnenc/CommonsCliEncryptOptions.java index 7ec71cb787..c21e3dce95 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnenc/CommonsCliEncryptOptions.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnenc/CommonsCliEncryptOptions.java @@ -23,11 +23,13 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Optional; +import java.util.function.Consumer; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; import org.apache.maven.api.cli.Options; +import org.apache.maven.api.cli.ParserRequest; import org.apache.maven.api.cli.mvnenc.EncryptOptions; import org.apache.maven.cling.invoker.CommonsCliOptions; import org.codehaus.plexus.interpolation.BasicInterpolator; @@ -103,6 +105,19 @@ public class CommonsCliEncryptOptions extends CommonsCliOptions implements Encry return interpolate(this, properties); } + @Override + public void displayHelp(ParserRequest request, Consumer printStream) { + super.displayHelp(request, printStream); + printStream.accept(""); + // we have no DI here (to discover) + printStream.accept("Goals:"); + printStream.accept(" diag - display encryption configuration diagnostic"); + printStream.accept(" init - wizard to configure encryption (interactive only)"); + printStream.accept(" encrypt - encrypts input"); + printStream.accept(" decrypt - decrypts encrypted input"); + printStream.accept(""); + } + protected static class CLIManager extends CommonsCliOptions.CLIManager { public static final String FORCE = "f"; public static final String YES = "y"; @@ -119,10 +134,5 @@ public class CommonsCliEncryptOptions extends CommonsCliOptions implements Encry .desc("Should imply user answered \"yes\" to all incoming questions?") .build()); } - - @Override - protected String commandLineSyntax(String command) { - return command + " [options] [goal]"; - } } }