@@ -21,14 +21,13 @@ package commands
2121import (
2222 "fmt"
2323
24- "github.com/rsteube/carapace"
25- "github.com/spf13/cobra"
26- "github.com/spf13/pflag"
27-
2824 "github.com/reeflective/team/client"
2925 cli "github.com/reeflective/team/client/commands"
3026 "github.com/reeflective/team/internal/command"
3127 "github.com/reeflective/team/server"
28+ "github.com/rsteube/carapace"
29+ "github.com/spf13/cobra"
30+ "github.com/spf13/pflag"
3231)
3332
3433// Generate returns a "teamserver" command root and its tree for teamserver (server-side) management.
@@ -118,7 +117,12 @@ func serverCommands(server *server.Server, client *client.Client) *cobra.Command
118117 closeComps .PositionalAnyCompletion (carapace .ActionCallback (listenerIDCompleter (client , server )))
119118
120119 closeComps .PreRun (func (cmd * cobra.Command , args []string ) {
121- cmd .PersistentPreRunE (cmd , args )
120+ if cmd .PersistentPreRunE != nil {
121+ cmd .PersistentPreRunE (cmd , args )
122+ }
123+ if cmd .PreRunE != nil {
124+ cmd .PreRunE (cmd , args )
125+ }
122126 })
123127
124128 teamCmd .AddCommand (closeCmd )
@@ -213,7 +217,12 @@ func serverCommands(server *server.Server, client *client.Client) *cobra.Command
213217 rmUserComps .PositionalCompletion (carapace .ActionCallback (userCompleter (client , server )))
214218
215219 rmUserComps .PreRun (func (cmd * cobra.Command , args []string ) {
216- cmd .PersistentPreRunE (cmd , args )
220+ if cmd .PersistentPreRunE != nil {
221+ cmd .PersistentPreRunE (cmd , args )
222+ }
223+ if cmd .PreRunE != nil {
224+ cmd .PreRunE (cmd , args )
225+ }
217226 })
218227
219228 // Import a list of users and their credentials.
0 commit comments