mirror of https://github.com/apache/maven.git
[MNG-7180] Make --color option behave more like BSD/GNU grep's --color option
This commit is contained in:
parent
d8be2f0e4c
commit
a70828c737
|
@ -152,7 +152,7 @@ public class CLIManager
|
|||
options.addOption( Option.builder( LEGACY_LOCAL_REPOSITORY ).longOpt( "legacy-local-repository" ).desc( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _remote.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).build() );
|
||||
options.addOption( Option.builder( BUILDER ).longOpt( "builder" ).hasArg().desc( "The id of the build strategy to use" ).build() );
|
||||
options.addOption( Option.builder( NO_TRANSFER_PROGRESS ).longOpt( "no-transfer-progress" ).desc( "Do not display transfer progress when downloading or uploading" ).build() );
|
||||
options.addOption( Option.builder().longOpt( COLOR ).hasArg().desc( "Defines the color mode of the output. Available options are auto/always/never" ).build() );
|
||||
options.addOption( Option.builder().longOpt( COLOR ).hasArg().optionalArg( true ).desc( "Defines the color mode of the output. Supported are 'auto', 'always', 'never'." ).build() );
|
||||
}
|
||||
|
||||
public CommandLine parse( String[] args )
|
||||
|
|
|
@ -512,18 +512,18 @@ public class MavenCli
|
|||
// LOG COLOR
|
||||
String styleColor = cliRequest.getUserProperties().getProperty( STYLE_COLOR_PROPERTY, "auto" );
|
||||
styleColor = cliRequest.commandLine.getOptionValue( COLOR, styleColor );
|
||||
if ( "always".equals( styleColor ) )
|
||||
if ( "always".equals( styleColor ) || "yes".equals( styleColor ) || "force".equals( styleColor ) )
|
||||
{
|
||||
MessageUtils.setColorEnabled( true );
|
||||
}
|
||||
else if ( "never".equals( styleColor ) )
|
||||
else if ( "never".equals( styleColor ) || "no".equals( styleColor ) || "none".equals( styleColor ) )
|
||||
{
|
||||
MessageUtils.setColorEnabled( false );
|
||||
}
|
||||
else if ( !"auto".equals( styleColor ) )
|
||||
else if ( !"auto".equals( styleColor ) && !"tty".equals( styleColor ) && !"if-tty".equals( styleColor ) )
|
||||
{
|
||||
throw new IllegalArgumentException( "Invalid color configuration option [" + styleColor
|
||||
+ "]. Supported values are (auto|always|never)." );
|
||||
throw new IllegalArgumentException( "Invalid color configuration value '" + styleColor
|
||||
+ "'. Supported are 'auto', 'always', 'never'." );
|
||||
}
|
||||
else if ( cliRequest.commandLine.hasOption( CLIManager.BATCH_MODE )
|
||||
|| cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
|
||||
|
|
Loading…
Reference in New Issue