keybase / keybase/client

`keybase chat read` behaves confusingly when flags and positionals are intermixed

Open
#17,359 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.2k
Forks
1.3k
Avg merge
12h 58m
Merged PRs (30d)
56

Description

Say I have a team `team` with channels `#general` and `#announcements`.

These commands should be invalid, since `keybase chat read` only takes one positional argument (and indeed other keybase commands complain if given extra args); instead they succeed, but return messages from `#general`:

keybase chat read team announcements
keybase chat read --since=1h team announcements

These commands should also be invalid (--help says that all flags should precede positionals, so either the flags are in the wrong place or there's too many positionals); in this case, all the --flags before `team` are accepted, and all the ones *after* are silently ignored, so the former command returns 16 messages from `#general`, and the latter an unknown number from `#announcements`:

keybase chat read --at-least=16 --at-most=16 team --channel=announcements
keybase chat read --channel=announcements team --at-least=16 --at-most=16

Interestingly, if the flags are *only* after the (single) positional argument, it works:

keybase chat read team --channel=announcements

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Go implementation and argument parsing for `keybase chat read`, then reproduce the four command forms in the issue. Check how positional arguments and flags are processed; done means invalid extra or misplaced arguments are rejected rather than ignored, while the documented valid form with flags after the single positional continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.