Skip to content

Commit

Permalink
fix completion for shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Nov 22, 2024
1 parent 043059c commit 1eef7c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"context"
"fmt"
"strings"
"time"

"github.com/spf13/cobra"
Expand All @@ -18,7 +19,9 @@ func NewRootCmd() *cobra.Command {
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if cmd.Use != "completion" && cmd.Use != "version" {
// Check for new versions only when shell completion scripts are not being
// generated to avoid invalid output to stdout when a new version is available
if cmd.Use != "completion" || !strings.HasPrefix(cmd.Use, cobra.ShellCompRequestCmd) {
checkNewVersion(cmd.Context())
}

Expand Down

0 comments on commit 1eef7c3

Please sign in to comment.