Skip to content

Commit 3b5049f

Browse files
Matovidloclaude
andcommitted
fix(cli): fix completion guard to cover all completion subcommands
Use cmd.CommandPath() to match the full "kbc completion" subtree instead of cmd.Name() == "completion", which only matched the parent command itself. When running "kbc completion bash", cmd.Name() returns "bash" (not "completion"), so the original guard failed to skip the dep stack init for the actual shell-specific subcommands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 64b6c9a commit 3b5049f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • internal/pkg/service/cli/cmd

internal/pkg/service/cli/cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func NewRootCommand(stdin io.Reader, stdout io.Writer, stderr io.Writer, osEnvs
147147
root.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
148148
// Completion commands don't need the full dependency stack.
149149
// __complete is the hidden command invoked by the shell on every TAB press.
150-
if cmd.Name() == "completion" || cmd.Name() == "__complete" {
150+
if cmd.Name() == "__complete" || strings.HasPrefix(cmd.CommandPath(), "kbc completion") {
151151
return nil
152152
}
153153

0 commit comments

Comments
 (0)