Skip to content

Implement pflag library #299

@digitalghost-dev

Description

@digitalghost-dev

v2 will implement the spf13/pflag library to enforce POSIX/GNU style flags (--flags | -f | -fsa).

Benefits

  • One declaration per flag
    • pflag's BoolP("natures", "n", false, ...) binds the long and short name to a single variable. Today every flag is registered twice (a --natures bool and a separate -n bool) and each command has to OR them together (*mf.Natures || *mf.ShortNatures).
    • pflag removes the duplicate fields, the duplicate registrations, and the risk of the long/short pair silently drifting apart.
  • True POSIX/GNU parsing
    • Single-char flags can be stacked (-asm == -a -s -m), and --long vs -s is actually enforced. stdlib flag treats -natures and --natures as identical, so the CLI doesn't match the convention its own help text advertises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRefactoring existing code.

    Projects

    Status
    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions