All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nextflow.cli.CliOptions.groovy Maven / Gradle / Ivy

Go to download

A DSL modelled around the UNIX pipe concept, that simplifies writing parallel and scalable pipelines in a portable manner

There is a newer version: 24.11.0-edge
Show newest version
/*
 * Copyright 2013-2024, Seqera Labs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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

/**
 * Main application command line options
 *
 * @author Paolo Di Tommaso 
 */
@Slf4j
class CliOptions {

    /**
     * The packages to debug
     */
    @Parameter(hidden = true, names='-debug')
    List debug

    @Parameter(names=['-log'], description = 'Set nextflow log file path')
    String logFile

    @Parameter(names=['-c','-config'], description = 'Add the specified file to configuration set')
    List userConfig

    @Parameter(names=['-config-ignore-includes'], description = 'Disable the parsing of config includes')
    boolean ignoreConfigIncludes

    @Parameter(names=['-C'], description = 'Use the specified configuration file(s) overriding any defaults')
    List config

    /**
     * the packages to trace
     */
    @Parameter(names='-trace', description = 'Enable trace level logging for the specified package name - multiple packages can be provided separating them with a comma e.g. \'-trace nextflow,io.seqera\'')
    List trace

    /**
     * Enable syslog appender
     */
    @Parameter(names = ['-syslog'], description = 'Send logs to syslog server (eg. localhost:514)' )
    String syslog

    /**
     * Print out the version number and exit
     */
    @Parameter(names = ['-v','-version'], description = 'Print the program version')
    boolean version

    /**
     * Print out the 'help' and exit
     */
    @Parameter(names = ['-h'], description = 'Print this help', help = true)
    boolean help

    @Parameter(names = ['-q','-quiet'], description = 'Do not print information messages' )
    boolean quiet

    @Parameter(names = ['-bg'], description = 'Execute nextflow in background', arity = 0)
    boolean background

    @DynamicParameter(names = ['-D'], description = 'Set JVM properties' )
    Map jvmOpts = [:]

    @Parameter(names = ['-self-update'], description = 'Update nextflow to the latest version', arity = 0, hidden = true)
    boolean selfUpdate

    @Parameter(names=['-remote-debug'], description = "Enable JVM interactive remote debugging (experimental)")
    boolean remoteDebug

    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)
        }
        catch (Exception e) {
            log.warn "Invalid boolean value for variable NXF_ANSI_LOG: $env -- it must be 'true' or 'false'"
        }
        return Ansi.isEnabled()
    }

    boolean hasAnsiLogFlag() {
        ansiLog==true || System.getenv('NXF_ANSI_LOG')=='true'
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy