Skip to content

Gmail search query starting with "-" is parsed as a flag; error gives no hint about -- #1184

Description

@postoso

Gmail queries often start with a negation (-in:inbox, -label:x, -from:...). Passed as the positional query, gog parses it as a flag:

v0.43.0, macOS and Linux:

gog gmail search '-in:inbox newer_than:7d' --max 2 --json
{"error":{"class":"usage","code":2,"message":"unknown flag -i, ..."}}

gog gmail search --max 2 --json -- '-in:inbox newer_than:7d' works. That is standard parser behavior, but nothing in the error or docs points at it, and the failure is easy to misread as a bad query.

Could the usage error suggest -- when the unknown flag looks like the start of a Gmail query, or could the search docs mention it? Reordering the terms inside the same quoted query also works (gog gmail search 'newer_than:7d -in:inbox' --max 2 --json), but is less obvious.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions