viash-io / viash

script + metadata = standalone component
https://viash.io
GNU General Public License v3.0
39 stars 2 forks source link

Suggestion: Add optional 'example usage' string that gets printed out below the description of a component in config yaml #53

Closed BlackDragonBE closed 3 years ago

BlackDragonBE commented 3 years ago

For example, take this yaml:

functionality:
  name: hello_world
  description: A very simple 'Hello world' component.
  example: visitor. --greeter="Greetings"
  arguments:
  - type: string
    name: input
    multiple: true
    multiple_sep: " "
  - type: string
    name: --greeter
    default: "Hello world!"
  resources:
  - type: bash_script
    path: script.sh
  tests:
  - type: bash_script
    path: test.sh
platforms:
  - type: native
  - type: docker
    image: bash:4.0
  - type: docker
    id: alpine
    image: alpine
    setup:
      - type: apk
        packages: [ bash ]

If you'd run viash run config.vsh.yaml -- --help on this, this might be the possible output:

A very simple 'Hello world' component.
Example usage:
viash run config.vsh.yaml -- visitor. --greeter="Greetings"

Options:
    string1 string2 ...
        type: string, multiple values allowed

    --greeter=string
        type: string, default: Hello world!

In a nutshell, it adds an example by adding viash run config.vsh.yaml -- before the example defined in yaml.

rcannood commented 3 years ago

Interesting. Nothing is stopping users from currently doing this already using the description field, but it might be nice to have a separate field for this.

We could also add an 'example' field to each of the arguments.

@tverbeiren what do you think? .functionality.example? .functionality.arguments[].example?

(An argument example might be useful for Nextflow too...)

tverbeiren commented 3 years ago

@tverbeiren what do you think? .functionality.example? .functionality.arguments[].example?

+1

rcannood commented 3 years ago

Duplicate of #56.