Skip to content

Help text

paramsHelp()

This function returns a help message with the command to run a pipeline and the available parameters. Pass it to log.info to print in the terminal.

It accepts two arguments:

  1. An example command, typically used to run the pipeline, to be included in the help string
  2. The file name of a Nextflow Schema file (Default: nextflow_schema.json)

Note

paramsHelp() doesn't stop pipeline execution after running. You must add this into your pipeline code if it's the desired functionality.

Typical usage:

include { paramsHelp } from 'plugin/nf-validation'

if (params.help) {
    log.info paramsHelp("nextflow run my_pipeline --input input_file.csv")
    exit 0
}
plugins {
  id 'nf-validation@0.2.1'
}

params {
  input = "samplesheet.csv"
  outdir = "results"
}
{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/testpipeline/master/nextflow_schema.json",
    "title": "nf-core/testpipeline pipeline parameters",
    "description": "this is a test",
    "type": "object",
    "definitions": {
        "input_output_options": {
            "title": "Input/output options",
            "type": "object",
            "fa_icon": "fas fa-terminal",
            "description": "Define where the pipeline should find input data and save output data.",
            "required": ["input", "outdir"],
            "properties": {
                "input": {
                    "type": "string",
                    "format": "file-path",
                    "mimetype": "text/csv",
                    "schema": "assets/schema_input.json",
                    "pattern": "^\\S+\\.(csv|tsv|yaml)$",
                    "description": "Path to comma-separated file containing information about the samples in the experiment.",
                    "help_text": "You will need to create a design file with information about the samples in your experiment before running the pipeline. Use this parameter to specify its location. It has to be a comma-separated file with 3 columns, and a header row. See [usage docs](https://nf-co.re/testpipeline/usage#samplesheet-input).",
                    "fa_icon": "fas fa-file-csv"
                },
                "outdir": {
                    "type": "string",
                    "format": "directory-path",
                    "description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.",
                    "fa_icon": "fas fa-folder-open"
                }
            }
        }
    },
    "allOf": [
        {
            "$ref": "#/definitions/input_output_options"
        }
    ]
}

Output:

N E X T F L O W  ~  version 23.04.1
Launching `pipeline/main.nf` [infallible_turing] DSL2 - revision: 8bf4c8d053

Typical pipeline command:

  nextflow run my_pipeline --input input_file.csv

Input/output options
  --input  [string]  Path to comma-separated file containing information about the samples in the experiment.
  --outdir [string]  The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.

------------------------------------------------------

Warning

We shouldn't be using exit as it kills the Nextflow head job in a way that is difficult to handle by systems that may be running it externally, but at the time of writing there is no good alternative. See nextflow-io/nextflow#3984.

Specific parameter help

By default, when printing the help message only a selection of attributes are printed: type of the variable, accepted options (enums), description and default value.

To print the complete information for a single parameter, pass the parameter name to the --help option.

For example, with the example above:

nextflow run my_pipeline --help outdir
N E X T F L O W  ~  version 23.04.1
Launching `pipeline/main.nf` [exotic_rutherford] DSL2 - revision: 8bf4c8d053

Typical pipeline command:

  nextflow run my_pipeline --input input_file.csv

--outdir
    type       : string
    format     : directory-path
    description: The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.
------------------------------------------------------

Hidden parameters

Params that are set as hidden in the JSON Schema are not shown in the help message. To show these parameters, set the validationShowHiddenParams parameter:

nextflow run my_pipeline --help --validationShowHiddenParams

or specifying it in the configuration file

params.validationShowHiddenParams = true

Coloured logs

By default, the help output is coloured using ANSI escape codes.

If you prefer, you can disable these by using the argument monochrome_logs, e.g. paramsHelp(monochrome_logs: true). Alternatively this can be set at a global level via parameter --monochrome_logs or adding params.monochrome_logs = true to a configuration file. --monochromeLogs or params.monochromeLogs is also supported.

Default help output

Default help output