Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Add support for `--rbs_out` as a `protoc_builtin` plugin (requires protoc v34.0+).
- Add relevant links from CEL LSP hover documentation to either <celbyexample.com> or <protovalidate.com>
- Skip writing unchanged output files in `buf generate` to preserve modification times
- Improve shell completions for `buf` flags with fixed value sets and file/directory arguments.

## [v1.66.1] - 2026-03-09

Expand Down
9 changes: 8 additions & 1 deletion cmd/buf/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,14 @@ func newRootCommand(name string) *appcmd.Command {
},
ModifyCobra: func(cobraCommand *cobra.Command) error {
cobraCommand.AddCommand(bufcobra.NewWebpagesCommand("webpages", cobraCommand))
return nil
return cobraCommand.RegisterFlagCompletionFunc(
"log-format",
cobra.FixedCompletions([]string{
appext.LogFormatText.String(),
appext.LogFormatColor.String(),
appext.LogFormatJSON.String(),
}, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
)
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/bufbuild/buf/private/pkg/connectclient"
"github.com/bufbuild/buf/private/pkg/netext"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand All @@ -52,6 +53,9 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionOutputFormat(cmd, formatFlagName)
},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/bufbuild/buf/private/pkg/connectclient"
"github.com/bufbuild/buf/private/pkg/netext"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand All @@ -54,6 +55,9 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionOutputFormat(cmd, formatFlagName)
},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
pkgv1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -83,6 +84,12 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return errors.Join(
bufcli.RegisterFlagCompletionOutputFormat(cmd, formatFlagName),
bufcli.RegisterFlagCompletionVisibility(cmd, visibilityFlagName),
)
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/buf/internal/command/breaking/breaking.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufregistryapi/bufregistryapimodule"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/bufbuild/buf/private/pkg/wasm"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -74,6 +75,9 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName)
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/buf/internal/command/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/bufbuild/buf/private/buf/buffetch"
"github.com/bufbuild/buf/private/bufpkg/bufanalysis"
"github.com/bufbuild/buf/private/bufpkg/bufimage/bufimageutil"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -62,6 +63,9 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName)
},
}
}

Expand Down
11 changes: 11 additions & 0 deletions cmd/buf/internal/command/config/configlsmodules/configlsmodules.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufconfig"
"github.com/bufbuild/buf/private/pkg/normalpath"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -69,6 +70,16 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return cmd.RegisterFlagCompletionFunc(
formatFlagName,
cobra.FixedCompletions([]string{
formatPath,
formatName,
formatJSON,
}, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
)
},
}
}

Expand Down
19 changes: 14 additions & 5 deletions cmd/buf/internal/command/config/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufconfig"
"github.com/bufbuild/buf/private/pkg/normalpath"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -66,6 +67,12 @@ func NewLSCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return errors.Join(
bufcli.RegisterFlagCompletionRuleFormat(cmd, formatFlagName),
bufcli.RegisterFlagCompletionFileVersion(cmd, versionFlagName),
)
},
}
}

Expand Down Expand Up @@ -123,11 +130,13 @@ func (f *flags) Bind(flagSet *pflag.FlagSet) {
fmt.Sprintf(
"List all the rules for the given configuration version. By default, the version in the buf.yaml in the current directory is used, or the latest version otherwise (currently v2). Cannot be set if --%s is set. Must be one of %s",
configuredOnlyFlagName,
xslices.Map(
bufconfig.AllFileVersions,
func(fileVersion bufconfig.FileVersion) string {
return fileVersion.String()
},
xstrings.SliceToString(
xslices.Map(
bufconfig.AllFileVersions,
func(fileVersion bufconfig.FileVersion) string {
return fileVersion.String()
},
),
),
),
)
Expand Down
4 changes: 4 additions & 0 deletions cmd/buf/internal/command/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufimage/bufimageutil"
"github.com/bufbuild/buf/private/bufpkg/bufmodule"
"github.com/bufbuild/buf/private/gen/data/datawkt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -91,6 +92,9 @@ Use a module on the bsr:
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName)
},
}
}

Expand Down
19 changes: 19 additions & 0 deletions cmd/buf/internal/command/curl/curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/bufbuild/buf/private/pkg/verbose"
"github.com/quic-go/quic-go"
"github.com/quic-go/quic-go/http3"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"google.golang.org/protobuf/reflect/protoreflect"
)
Expand Down Expand Up @@ -195,6 +196,24 @@ exit code that is the gRPC code, shifted three bits to the left.
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return errors.Join(
cmd.RegisterFlagCompletionFunc(
protocolFlagName,
cobra.FixedCompletions([]string{
connect.ProtocolConnect,
connect.ProtocolGRPC,
connect.ProtocolGRPCWeb,
}, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
),
cmd.RegisterFlagCompletionFunc(
reflectProtocolFlagName,
cobra.FixedCompletions(bufcurl.AllKnownReflectProtocolStrings, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
),
cmd.RegisterFlagCompletionFunc(headerFlagName, cobra.NoFileCompletions),
cmd.RegisterFlagCompletionFunc(reflectHeaderFlagName, cobra.NoFileCompletions),
)
},
}
}

Expand Down
14 changes: 14 additions & 0 deletions cmd/buf/internal/command/dep/depgraph/depgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package depgraph
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"

Expand All @@ -31,6 +32,7 @@ import (
"github.com/bufbuild/buf/private/pkg/dag"
"github.com/bufbuild/buf/private/pkg/uuidutil"
"github.com/google/uuid"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -90,6 +92,18 @@ buf dep graph | dot -Tpng >| graph.png && open graph.png
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return errors.Join(
bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName),
cmd.RegisterFlagCompletionFunc(
formatFlagName,
cobra.FixedCompletions([]string{
cobra.CompletionWithDesc(dotFormatString, "Graphviz DOT"),
jsonFormatString,
}, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
),
)
},
}
}

Expand Down
7 changes: 7 additions & 0 deletions cmd/buf/internal/command/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/bufbuild/buf/private/pkg/storage"
"github.com/bufbuild/buf/private/pkg/storage/storageos"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -86,6 +87,12 @@ Export a git repo to a local directory.
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return cmd.RegisterFlagCompletionFunc(
outputFlagName,
cobra.FixedCompletions(nil, cobra.ShellCompDirectiveFilterDirs),
)
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/buf/internal/command/format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/bufbuild/buf/private/pkg/storage"
"github.com/bufbuild/buf/private/pkg/storage/storageos"
"github.com/bufbuild/buf/private/pkg/syserror"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -165,6 +166,9 @@ The -w and -o flags cannot be used together in a single invocation.
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName)
},
}
}

Expand Down
17 changes: 17 additions & 0 deletions cmd/buf/internal/command/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package generate

import (
"context"
"errors"
"fmt"
"log/slog"
"os"
Expand All @@ -33,6 +34,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufconfig"
"github.com/bufbuild/buf/private/bufpkg/bufimage"
"github.com/bufbuild/buf/private/pkg/storage/storageos"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -384,6 +386,21 @@ Insertion points are processed in the order the plugins are specified in the tem
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return errors.Join(
bufcli.RegisterFlagCompletionErrorFormat(cmd, errorFormatFlagName),
cmd.RegisterFlagCompletionFunc(
templateFlagName,
cobra.FixedCompletions([]string{"yaml", "yml", "json"}, cobra.ShellCompDirectiveFilterFileExt),
),
cmd.RegisterFlagCompletionFunc(
baseOutDirPathFlagName,
cobra.FixedCompletions(nil, cobra.ShellCompDirectiveFilterDirs),
),
cmd.RegisterFlagCompletionFunc(typeFlagName, cobra.NoFileCompletions),
cmd.RegisterFlagCompletionFunc(excludeTypeFlagName, cobra.NoFileCompletions),
)
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/buf/internal/command/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/bufbuild/buf/private/bufpkg/bufanalysis"
"github.com/bufbuild/buf/private/bufpkg/bufcheck"
"github.com/bufbuild/buf/private/bufpkg/bufconfig"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -55,6 +56,9 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return bufcli.RegisterFlagCompletionLintErrorFormat(cmd, errorFormatFlagName)
},
}
}

Expand Down
11 changes: 11 additions & 0 deletions cmd/buf/internal/command/lsfiles/lsfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/bufbuild/buf/private/gen/data/datawkt"
"github.com/bufbuild/buf/private/pkg/uuidutil"
"github.com/google/uuid"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -72,6 +73,16 @@ func NewCommand(
},
),
BindFlags: flags.Bind,
ModifyCobra: func(cmd *cobra.Command) error {
return cmd.RegisterFlagCompletionFunc(
formatFlagName,
cobra.FixedCompletions([]string{
formatText,
formatJSON,
formatImport,
}, cobra.ShellCompDirectiveNoFileComp|cobra.ShellCompDirectiveKeepOrder),
)
},
}
}

Expand Down
Loading
Loading