viash-io / viash

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

Add argument groups #154

Closed Grifs closed 2 years ago

Grifs commented 2 years ago

In the functionality config, add option to group arguments into groups.

Advantage could be to organize the help output into sections

rcannood commented 2 years ago

Option 1:

arguments:
  - name: "--input"
    type: file
    group: io
  - name: "--output"
    type: file
    direction: output
    group: io

Option 2:

arguments:
  - name: "--input"
    type: file
  - name: "--output"
    type: file
    direction: output
argument_groups:
  io: [ input, output ]

Option 3:

arguments:
  - name: "--input"
    type: file
  - name: "--output"
    type: file
    direction: output
argument_groups:
  - name: Input/Output
    description: Foo Bar Baz         # optional
    arguments: [input, output]

Defining argument groups would (amongst others) result in a grouped help message:


mytool

mytool description

Arguments:
    --foo
        type: file, output
        example: output.txt
        Path to the output.

<group_name> arguments:
    <group_description>

    --input
        type: file
        example: input.txt
        Path to the sample.

    --output
        type: file, output
        example: output.txt
        Path to the output.
rcannood commented 2 years ago

Update: we went with option 3.

Option 3:

arguments:
  - name: "--input"
    type: file
  - name: "--output"
    type: file
    direction: output
  - name: "--foo"
    type: file
    example: foo.txt
argument_groups:
  - name: Input/Output
    description: Foo Bar Baz         # optional
    arguments: [input, output]

Defining argument groups would (amongst others) result in a grouped help message:


mytool

mytool description

Arguments:
    --foo
        type: file
        example: foo.txt

<group_name> arguments:
    <group_description>

    --input
        type: file
        example: input.txt
        Path to the sample.

    --output
        type: file, output
        example: output.txt
        Path to the output.
Grifs commented 2 years ago

Implemented in Viash 0.5.15