mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-10-18 00:14:18 +00:00
Output revision with -v/--version
This commit is contained in:
@@ -108,6 +108,7 @@ public class DefaultClient implements Client {
|
||||
boolean version = false;
|
||||
boolean showVersion = false;
|
||||
boolean debug = false;
|
||||
boolean batchMode = false;
|
||||
for (String arg : argv) {
|
||||
switch (arg) {
|
||||
case "-v":
|
||||
@@ -126,6 +127,11 @@ public class DefaultClient implements Client {
|
||||
debug = true;
|
||||
args.add(arg);
|
||||
break;
|
||||
case "-B":
|
||||
case "--batch-mode":
|
||||
batchMode = true;
|
||||
args.add(arg);
|
||||
break;
|
||||
default:
|
||||
if (arg.startsWith("-D")) {
|
||||
final int eqPos = arg.indexOf('=');
|
||||
@@ -144,14 +150,16 @@ public class DefaultClient implements Client {
|
||||
if (version || showVersion || debug) {
|
||||
// Print mvnd version
|
||||
BuildProperties buildProperties = BuildProperties.getInstance();
|
||||
final String nativeSuffix = Environment.isNative() ? " (native)" : "";
|
||||
final String v = Ansi.ansi().bold().a(
|
||||
"Maven Daemon "
|
||||
+ buildProperties.getVersion()
|
||||
+ "-" + buildProperties.getOsName()
|
||||
+ "-" + buildProperties.getOsArch()
|
||||
+ nativeSuffix)
|
||||
.reset().toString();
|
||||
final String mvndVersionString = "mvnd "
|
||||
+ (Environment.isNative() ? "native client " : "JVM client ")
|
||||
+ buildProperties.getVersion()
|
||||
+ "-" + buildProperties.getOsName()
|
||||
+ "-" + buildProperties.getOsArch()
|
||||
+ " (" + buildProperties.getRevision() + ")";
|
||||
|
||||
final String v = batchMode
|
||||
? mvndVersionString
|
||||
: Ansi.ansi().bold().a(mvndVersionString).reset().toString();
|
||||
output.accept(Message.log(v));
|
||||
// Print terminal information
|
||||
output.describeTerminal();
|
||||
|
Reference in New Issue
Block a user