2.2. Command Line Tool#

A command-line tool is a type of Process object that can be run by itself or as a Workflow step. It is a wrapper for a command like ls, echo, tar, etc. The command-line tool is defined in the baseCommand attribute of the command-line tool CWL document.

A CWL command-line tool must also have inputs and outputs. The following example contains a minimal example of a CWL command-line tool for the echo Linux command, using inputs and outputs.

digraph G { compound=true; rankdir="LR"; fontname="Verdana"; fontsize="10"; graph [splines=ortho]; node [fontname="Verdana", fontsize="10", shape=box]; edge [fontname="Verdana", fontsize="10"]; subgraph cluster_0 { command[style="filled" label=<<FONT FACE='sans-serif;'>echo</FONT>>]; label="baseCommand"; fill=gray; } inputs -> command [lhead=cluster_0]; command -> outputs [ltail=cluster_0]; }

CWL command-line tool.#

echo.cwl#
cwlVersion: v1.2
class: CommandLineTool

baseCommand: echo

stdout: output.txt

inputs:
  message:
    type: string
    inputBinding: {}
outputs:
  out:
    type: string
    outputBinding:
      glob: output.txt
      loadContents: true
      outputEval: $(self[0].contents)

Note

The example above uses a simplified form to define inputs and outputs. You will learn more about in the Inputs and in the Outputs sections.

2.2.1. Network Access#

This indicates whether a process requires outgoing IPv4/IPv6 network access. Starting with CWL v1.1, programs are not granted network access by default, so you must include the requirement for network access in the specification of your tool.

cwlVersion: v1.2
class: CommandLineTool

requirements:
  NetworkAccess:
     networkAccess: true

Note

CWL v1.0 command-line tools that are upgraded to v1.1 or v1.2 or v1.2 will have networkAccess: true set automatically.