hop export

hop export writes the diagram of a pipeline or a workflow to a file, in SVG or Mermaid format. It exports one file, or every pipeline and workflow in a folder.

It uses the same exporters as File > Export diagram in Hop Gui, so you can create the diagrams from a script or a build. The installation also has hop-export.sh and hop-export.bat, which run the same command.

bash
# One file
hop export -f pipelines/load-orders.hpl -o diagrams/load-orders.svg

# One file as Mermaid
hop export -f workflows/main.hwf --format mermaid -o diagrams/main.mmd

# Every pipeline and workflow in a folder and its subfolders
hop export -s /path/to/project -t /path/to/diagrams --recursive

# The formats this installation can write
hop export --list-exporters

Options

Option Description

-f, --file <file>

The pipeline (.hpl) or workflow (.hwf) to export.

-o, --output-file <file>

The file to write, for -f. By default, the name of the exported file with the extension of the format (.svg or .mmd), in the same folder.

--format <format>

svg or mermaid, in upper or lower case. Without it, an -o file that ends in .mmd is written as Mermaid, and one that ends in .svg as SVG. Without --format and -o, the format is SVG.

-s, --source-folder <folder>

The folder to export every pipeline and workflow from.

-t, --target-folder <folder>

The folder to write the diagrams to, for -s. Required with -s. See Exporting a folder.

-r, --recursive

With -s, also export the subfolders.

-m, --magnification <factor>

Scale an SVG diagram, for example 2 for twice the size. The default is 1.0. Mermaid diagrams are not scaled.

-in, --include-notes

Notes are included by default. Use -in=false to leave them out of a Mermaid diagram. Giving -in without a value also leaves them out. SVG diagrams always show the notes.

--list-exporters

List the exporters in this installation, with their format and file extension.

-j, --project <name>

Enable a project first, so that variables such as ${PROJECT_HOME} can be used in the file names.

-e, --environment <name>

Enable an environment, and its project, first.

The project options are the same as for hop run:

bash
hop export -j my-project -f '${PROJECT_HOME}/pipelines/load-orders.hpl' -o /tmp/load-orders.svg

Run hop export --help for the full list, which also has -pl, --environments and the other options of the hop command.

Formats

Hop has an SVG and a Mermaid exporter for both pipelines and workflows. Plugins can add more; --list-exporters shows what your installation has.

bash
$ ./hop export --list-exporters
Available Diagram Exporters (4):
  ID: pipeline-mermaid
    Name: Pipeline Mermaid Exporter
    Format: MERMAID
    Extension: .mmd
    Description: Exports a pipeline diagram to Mermaid flowchart (.mmd)

  ID: pipeline-svg
    Name: Pipeline SVG Exporter
...
  • SVG draws the diagram as it looks in Hop Gui, with the transform and action icons and the notes.

  • Mermaid writes a text flowchart (.mmd) with a node per transform or action and an arrow per hop. You can keep it next to the project in version control, or paste it into a page that renders Mermaid.

Exporting a folder

With -s, hop export exports every .hpl and .hwf file in the folder, and with -r in its subfolders too. Each diagram is written under -t with the same relative path, for example pipelines/load-orders.hpl becomes pipelines/load-orders.svg.

  • -t must be an existing folder. With -r, its subfolders must exist as well.

  • The export stops at the first file it can’t export, for example a diagram whose folder is missing under -t, or a file that is not valid XML. The diagrams written before it stay.

  • A pipeline and a workflow with the same name in the same folder are written to the same file, so only the last one is kept.

At the end, the command logs how many diagrams it exported.

Exit codes

hop export ends with 0 when the export is done, and with 1 when it fails, for example when the source folder doesn’t exist or a diagram can’t be written.

The hop-export.sh and hop-export.bat scripts end with other codes:

Code Meaning

0

The export is done.

1

The help was shown, with --help.

2

The export failed, for example when the source folder doesn’t exist or a file is not a valid pipeline or workflow.

9

An option is not valid.