Skip to content

Unrecognised flags silently no-op (no central flag validation) #8

@tejpochiraju

Description

@tejpochiraju

Problem

Commands pluck known flags with get_flag/has_flag but never validate that all passed --flags were consumed. A typo'd or unsupported flag is silently ignored:

forgejo issue edit OWNER/REPO 42 --lables=bug      # typo: silently does nothing
forgejo pr merge OWNER/REPO 17 --squash            # wrong form: ignored, default method used

This is the same "silent no-op" class fixed in #7 (fields the API drops), but at the CLI-parsing layer. Extends the project rule: don't no-op anything — fail loudly.

Why it's deferred

There's no central argument parser; each verb reads flags ad hoc. Loud rejection of unknown flags requires each command to declare its known-flag set (or a shared parser that takes an allow-list), plus care around positional args and forgejo api's gh-style -f/-F passthrough.

Sketch

  • A helper like reject_unknown_flags "<space-separated known flags>" "$@" that scans remaining --* tokens and errors with the offending flag + the command's usage line.
  • Roll out per verb (start with the high-traffic ones: issue/pr/repo edit & create).
  • forgejo api is exempt (its -f/-F are the documented surface).

Acceptance

forgejo issue edit OWNER/REPO 42 --lables=bug exits non-zero naming --lables and printing the usage line, instead of reporting success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions