code: func setupCommonRootCommand(rootCmd *cobra.Command) (*cliflags.ClientOptions, *pflag.FlagSet, *cobra.Command) {
  	opts := cliflags.NewClientOptions()
  	flags := rootCmd.Flags()
  
  	flags.StringVar(&opts.ConfigDir, "config", cliconfig.Dir(), "Location of client config files")
  	opts.Common.InstallFlags(flags)
  
  	cobra.AddTemplateFunc("add", func(a, b int) int { return a + b })
  	cobra.AddTemplateFunc("hasSubCommands", hasSubCommands)
  	cobra.AddTemplateFunc("hasManagementSubCommands", hasManagementSubCommands)
  	cobra.AddTemplateFunc("hasInvalidPlugins", hasInvalidPlugins)
  	cobra.AddTemplateFunc("operationSubCommands", operationSubCommands)
  	cobra.AddTemplateFunc("managementSubCommands", managementSubCommands)
  	cobra.AddTemplateFunc("invalidPlugins", invalidPlugins)
  	cobra.AddTemplateFunc("wrappedFlagUsages", wrappedFlagUsages)
  	cobra.AddTemplateFunc("vendorAndVersion", vendorAndVersion)
  	cobra.AddTemplateFunc("invalidPluginReason", invalidPluginReason)
  	cobra.AddTemplateFunc("isPlugin", isPlugin)
  	cobra.AddTemplateFunc("decoratedName", decoratedName)
  
  	rootCmd.SetUsageTemplate(usageTemplate)
  	rootCmd.SetHelpTemplate(helpTemplate)
  	rootCmd.SetFlagErrorFunc(FlagErrorFunc)
  	rootCmd.SetHelpCommand(helpCommand)
  
  	rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage")
  	rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")
  	rootCmd.PersistentFlags().Lookup("help").Hidden = true
  
  	return opts, flags, helpCommand
  }
docs: // setupCommonRootCommand contains the setup common to
  // SetupRootCommand and SetupPluginRootCommand.