Commit f00381d
authored
Add support for URL completions in
First mentioned in #2044, which is long something I've wanted. This adds
support for completing URLs based on the available RPCs, which either
comes from the existing `--schema` flag or gRPC reflection.
The completion itself works somewhat similar to LSP completion, in that
it attempts to complete as far as it can before giving the user an
option between the remaining values to disambiguate. It will complete up
to the entire service URL, and then provide completions for RPCs within
the service (if there are multiple).
This requires one fix upstream in app-go so that subcommands that define
`ModifyCobra` actually run: bufbuild/app-go#5. We'll want to land
upstream to `main` before landing this.
Open to suggestions on the completion UX. It feels fairly natural to me
currently, but I'm sure there are edge cases.
Future work here could include better completions for `--schema` values,
either using local directories or BSR modules, and completions for
`--data` values (if we know the schema and the specific RPC targeted by
the URL, we know the shape of the JSON for the `--data` flag). Also,
following this pattern of using ModifyCobra, other commands could be
made to have better contextual completion.
Also fixes the buf curl help examples to have consistent indentation.
Resolves #2044.buf curl (#4402)1 parent 2b51c55 commit f00381d
6 files changed
Lines changed: 756 additions & 26 deletions
File tree
- cmd/buf/internal/command/curl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
0 commit comments