[MNG-7181] Make --version support -q

This commit is contained in:
Michael Osipov 2021-07-03 19:17:19 +02:00
parent a70828c737
commit 1fc605dd69
2 changed files with 15 additions and 1 deletions

View File

@ -75,6 +75,13 @@ public static String showVersion()
return version.toString();
}
public static String showVersionMinimal()
{
Properties properties = getBuildProperties();
String version = reduce( properties.getProperty( BUILD_VERSION_PROPERTY ) );
return ( version != null ? version : "<version unknown>" );
}
/**
* Create a human readable string containing the Maven version, buildnumber, and time of build
*

View File

@ -439,7 +439,14 @@ private void informativeCommands( CliRequest cliRequest ) throws ExitException
if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
{
System.out.println( CLIReportingUtils.showVersion() );
if ( cliRequest.commandLine.hasOption( CLIManager.QUIET ) )
{
System.out.println( CLIReportingUtils.showVersionMinimal() );
}
else
{
System.out.println( CLIReportingUtils.showVersion() );
}
throw new ExitException( 0 );
}
}