diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index ce41e5965..58d44645b 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -134,11 +134,6 @@ change in the future. Exec: func(context.Context, []string) error { return flag.ErrHelp }, UsageFunc: usageFunc, } - for _, c := range rootCmd.Subcommands { - if c.UsageFunc == nil { - c.UsageFunc = usageFunc - } - } if envknob.UseWIPCode() { rootCmd.Subcommands = append(rootCmd.Subcommands, idTokenCmd, @@ -156,6 +151,12 @@ change in the future. rootCmd.Subcommands = append(rootCmd.Subcommands, configureHostCmd) } + for _, c := range rootCmd.Subcommands { + if c.UsageFunc == nil { + c.UsageFunc = usageFunc + } + } + if err := rootCmd.Parse(args); err != nil { if errors.Is(err, flag.ErrHelp) { return nil