pydra icon indicating copy to clipboard operation
pydra copied to clipboard

Shortcut for equal-separated option value pairs

Open ghisvail opened this issue 2 years ago • 1 comments

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": "=",
        }
    )
    ...

ghisvail avatar Sep 14 '23 13:09 ghisvail

Pydra implements space-separated options, which are common to short and long option names in modern standards.

pydra actually follows nipype in this perspective and allows various formulations.

satra avatar Sep 14 '23 14:09 satra