fix(flowctl): honor -q short flag on raw get (#3084)#3172
Open
0xfandom wants to merge 2 commits into
Open
Conversation
The long help for `raw get` tells users to pass query arguments as
`-q key=value`, but `Get::query` was declared `#[clap(long, ...)]`, so
the parser only accepted `--query` and rejected the documented form:
$ flowctl raw get --table data_planes -q select=data_plane_name
error: unexpected argument '-q' found
Add the short flag rather than amend the help text: the documented
spelling is the friendlier one, and `-q` is unused elsewhere in flowctl
(the only short flags are the global `-o/--output` and `catalog list`'s
`-f/--flows`), so it is free to take.
Fixes estuary#3084
`raw rpc` and `raw update` take the same optional query parameters as
`raw get`, and rpc's help defers to it ("As with `get`, you may pass
optional query parameters"), so a user who learns `-q` from `get` will
reasonably expect it on both. Give them the same short flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
flowctl raw getdocuments a-qshort flag in its own long help, but the parser only ever accepted--query, so the documented invocation fails:The help text comes from the
Getvariant's doc comment ("Pass query arguments as multiple-q key=valuearguments. For example:-q select=col1,col2 -q col3=eq.MyValue"), whileGet::querywas declared#[clap(long, ...)]— long-only. This addsshort = 'q', making the parser match what the help has always promised.I took the add-the-flag route rather than amending the help text: the documented spelling is the friendlier one, and
-qis unused across flowctl — the only short flags are the global-o/--outputandcatalog list's-f/--flows— so it was free to take.A second commit extends
-qtoraw rpcandraw update, which take the same query parameters and whose help defers toget("As withget, you may pass optional query parameters"). It's split out so it can be dropped if you'd rather keep this strictly to #3084.Fixes #3084
Workflow steps:
-qnow works anywhere--querydid, and is repeatable:--queryis unchanged and keeps working; this is purely additive, so no existing invocation breaks.raw get --helpnow renders-q, --query <QUERY>, matching the prose above it.Documentation links affected:
None. The only place
-qis documented is the command's own long help, which this change makes accurate rather than requiring an edit. Nothing undersite/docs/referencesraw get's query flag.Notes for reviewers:
getfix for flowctl: raw get help documents -q short flag but only --query is accepted #3084, the second extends-qtorpc/updatefor consistency. Drop the second if it's out of scope for you.cargo build -p flowctllocally —simd-doc's C++ build fails on my machine withrust::Slice<const unsigned char>::iteratorfailing thecontiguous_iteratorconcept check against my SDK's libc++ headers. That's a pre-existing local toolchain issue on a clean tree, unrelated to this change, and I didn't want to bundle a toolchain fix into a one-line CLI fix.Get/Rpc/Updatestructs replicated exactly: the issue's invocation is rejected before the change and accepted after;-qand--queryproduce identical parses; repeated-qaccumulates;-qdoesn't collide with the global-o; and invalid values still fail throughparse_key_val(-q no-equals→invalid KEY=value: no `=` found in `no-equals`). Relying on CI for the full build.raw's arg parsing, so I didn't add any — happy to if you'd like coverage here.