Skip to content

Commit f00381d

Browse files
Add support for URL completions in buf curl (#4402)
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.
1 parent 2b51c55 commit f00381d

6 files changed

Lines changed: 756 additions & 26 deletions

File tree

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ linters:
209209
# We verify manually so that we can emit verbose output while doing so.
210210
path: private/buf/bufcurl/tls.go
211211
text: "G402:"
212+
- linters:
213+
- gosec
214+
# InsecureSkipVerify mirrors the value of the --insecure flag chosen by the user.
215+
path: cmd/buf/internal/command/curl/curl.go
216+
text: "G402:"
212217
- linters:
213218
- paralleltest
214219
# This test shouldn't run in parallel as it needs osext.Getwd.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [Unreleased]
44

55
- Improve shell completions for `buf` flags with fixed value sets and file/directory arguments.
6+
- Add `buf curl` URL path shell completions (service and method names) via
7+
server reflection, `--schema`, or the local buf module.
68
- Add support for Edition 2024 syntax to `buf format`.
79

810
## [v1.67.0] - 2026-04-01

0 commit comments

Comments
 (0)