Skip to content

Survey of option-argument behaviours #79

Open
@shadowspawn

Description

@shadowspawn

Taking a look at how implementations deal with option-arguments. Some made up terminology to describe the behaviours.

  • "greedy" vs "choosy" vs "embedded"
    • greedy: any value consumed with -w VALUE, including starting with hyphen
    • choosy: some values are rejected for -w VALUE, such as starting with hyphen
    • embedded: the only way to supply a value is embedded in the argument, like -wVALUE or --with=VALUE
  • "required" vs "optional"
    • required: the option requires an option-argument
    • optional: the option can be used with or without an option-argument

Taking a look at the reference specifications and implementations from #76

POSIX: describes "greedy required" and "embedded optional"
GNU: no changes
getopt_long: "greedy required" and "embedded optional"
Commander: "greedy required" and "choosy optional"
Yargs: "choosy required" and "choosy optional"
Minimist: "choosy optional" (I didn't see how to make the option-argument required.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions