Skip to content

Simple CWL document generator from given execution commands

License

Notifications You must be signed in to change notification settings

tom-tan/zatsu-cwl-generator

Repository files navigation

zatsu-cwl-generator

release container Actions Status

This is a simple CWL document generator from given execution commands.

Build Requirements

How to execute

There are several ways to execute it. See zatsu-cwl-generator --help for more details.

  • Use Docker container

    $ docker run --rm ghcr.io/tom-tan/zatsu-cwl-generator "cat aaa.txt bbb.txt > output.txt"
    #!/usr/bin/env cwl-runner
    # Generated from: cat aaa.txt bbb.txt > output.txt
    class: CommandLineTool
    cwlVersion: v1.0
    baseCommand: cat
    arguments:
      - $(inputs.aaa_txt)
      - $(inputs.bbb_txt)
    inputs:
      - id: aaa_txt
        type: File
        default:
          class: File
          location: aaa.txt
      - id: bbb_txt
        type: File
        default:
          class: File
          location: bbb.txt
    outputs:
      - id: all-for-debugging
        type:
          type: array
          items: [File, Directory]
        outputBinding:
          glob: "*"
      - id: out
        type: stdout
    stdout: output.txt
  • Download the latest binary from the release page

    $ export ver=v1.1.0
    $ export os=linux # `export os=osx` for macOS
    $ wget -O zatsu-cwl-generator.tar.xz https://github.com/tom-tan/zatsu-cwl-generator/releases/download/${ver}/zatsu-cwl-generator-${ver}-${os}-x86_64.tar.xz
    $ tar xf zatsu-cwl-generator.tar.xz
    $ chmod +x zatsu-cwl-generator
    $ ./zatsu-cwl-generator "cat aaa.txt bbb.txt > output.txt"
    ...
  • Use rdmd

    $ rdmd -J. zatsu-cwl-generator.d "cat aaa.txt bbb.txt > output.txt"
    ...
  • Build a binary and use it

    $ ldc2 -J. zatsu-cwl-generator.d
    $ ./zatsu-cwl-generator "cat aaa.txt bbb.txt > output.txt"
    ...

If you need a static linked binary, add -static to the build command:

$ ldc2 -J. zatsu-cwl-generator.d # for dynamic link (default)
$ ldd zatsu-cwl-generator
        /lib/ld-musl-x86_64.so.1 (0x7f476696e000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f4766711000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f476696e000)

$ ldc2 -J. -static zatsu-cwl-generator.d # for static link
$ ldd zatsu-cwl-generator
/lib/ld-musl-x86_64.so.1: zatsu-cwl-generator: Not a valid dynamic program

How to test this program

$ rdmd -J. -unittest -run zatsu-cwl-generator.d

How to generate an internal document

$ ldc2 -J. -Dddocs zatsu-cwl-generator.d

You can see a HTML file in the docs directory.