Regarding File Formats

Viash supports both a separate YAML file and comments at the top of a script in YAML format for reading the configuration of a component. The latter is especially useful for small scripts.

Separate config file

In this example, you have two files: a config file and a bash script. Here’s the content of a config file named config.vsh.yaml:

functionality:
  name: hello
  arguments:
    - name: "name"
      type: string
      default: Bob
  resources:
    - type: bash_script
      path: script.sh
platforms:
  - type: native

This is a bash script named script.sh:

#!/bin/bash
echo Hello $par_name

To run this as a Viash component you would execute the following command:

viash run config.vsh.yaml -- World

Script with config built in

In the case of a built-in configuration, you only need a single script file with comments containing the YAML. In this case, a bash script named script.vsh.sh:

#!/bin/bash

#' functionality:
#'   name: hello
#'   arguments:
#'     - name: "name"
#'       type: string
#'       default: Bob
#' platforms:
#' - type: native

echo Hello $par_name

In order to run this as a Viash component you would execute the following command:

viash run script.vsh.yaml -- World