skip pre run hook for completion/help commands

This commit is contained in:
onyx-and-iris 2026-03-29 23:13:47 +01:00
parent 5983f286d1
commit 48172fd99e

View File

@ -25,6 +25,11 @@ var rootCmd = &cobra.Command{
It allows users to easily create and manage .gitignore files for various programming languages and frameworks.
You may also list available templates and generate .gitignore files based on those templates.`,
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if strings.HasPrefix(cmd.CommandPath(), "exclude completion") ||
strings.HasPrefix(cmd.CommandPath(), "exclude help") {
return nil
}
client, err := gogi.NewHTTPClient()
if err != nil {
return fmt.Errorf("error creating HTTP client: %w", err)