Skip to content

Commit

Permalink
Fix Quiet cli option is not honoured
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Apr 30, 2019
1 parent 95f4dd7 commit e656e4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -19,6 +19,7 @@ package nextflow.cli
import com.beust.jcommander.DynamicParameter
import com.beust.jcommander.Parameter
import groovy.util.logging.Slf4j
import nextflow.exception.AbortOperationException
import org.fusesource.jansi.Ansi

/**
Expand Down Expand Up @@ -86,12 +87,18 @@ class CliOptions {
Boolean ansiLog

boolean getAnsiLog() {
if( ansiLog && quiet )
throw new AbortOperationException("Command line options `quiet` and `ansi-log` cannot be used together")

if( ansiLog != null )
return ansiLog

if( background )
return ansiLog = false

if( quiet )
return ansiLog = false

final env = System.getenv('NXF_ANSI_LOG')
if( env ) try {
return Boolean.parseBoolean(env)
Expand All @@ -102,6 +109,4 @@ class CliOptions {
return Ansi.isEnabled()
}



}
Expand Up @@ -394,6 +394,10 @@ class Launcher {
System.exit(1)

}
catch ( AbortOperationException e ) {
System.err.println (e.message ?: "Unknown abort reason")
System.exit(1)
}
catch( Throwable e ) {
e.printStackTrace(System.err)
System.exit(1)
Expand Down Expand Up @@ -620,7 +624,7 @@ class Launcher {
*
* @param args The program options as specified by the user on the CLI
*/
public static void main(String... args) {
static void main(String... args) {

final launcher = DripMain.LAUNCHER ?: new Launcher()
final status = launcher .command(args) .run()
Expand Down

0 comments on commit e656e4b

Please sign in to comment.