Skip to content

Shortcut for equal-separated option value pairs #703

Closed
@ghisvail

Description

@ghisvail

Certain CLI parsers, such as FSL's Eddy, implement a rigid formulation where only equal-separated options (--long-option=value) are accepted and space-separated ones (--long-option value) are rejected. Pydra implements space-separated options, which are common to short and long option names in modern standards.

Sadly, this complicates specification definition slightly with repetition:

class InputSpec(ShellSpec):
    input_image: PathLike = field(
        metadata={
            "help_string": "input image",
            "argstr": "--imain={input_image}",
        }
    )
    ...

There is a notion of separator in Pydra's field metadata, but it is used for lists of values.

Maybe we could introduce an option separator (defaults to whitespace if unspecified), such as:

class InputSpec(ShellSpec):
    input_image: PathLike = field(
        metadata={
            "help_string": "input image",
            "argstr": "--imain",
            "optsep": "=",
        }
    )
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions