port r429917 from branch - add a quiet option for the CLI

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@429921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2006-08-09 01:46:31 +00:00
parent 6eddbb1242
commit 52f6e19961
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,8 @@ public class CLIManager
public static final char REACTOR = 'r';
public static final char QUIET = 'q';
public static final char DEBUG = 'X';
public static final char ERRORS = 'e';
@ -83,6 +85,9 @@ public class CLIManager
options.addOption(
OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create(
VERSION ) );
options.addOption(
OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show warnings and errors" ).create(
QUIET ) );
options.addOption(
OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create(
DEBUG ) );

View File

@ -170,6 +170,13 @@ public class MavenCli
{
recursive = false;
}
else if ( commandLine.hasOption( CLIManager.QUIET ) )
{
// TODO: we need to do some more work here. Some plugins use sys out or log errors at info level.
// Ideally, we could use Warn across the board
loggerManager.setThreshold( Logger.LEVEL_ERROR );
// TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing.
}
if ( commandLine.hasOption( CLIManager.FAIL_FAST ) )
{