From fd76ea5b637f762766d4a18edf990e114bada94c Mon Sep 17 00:00:00 2001 From: "Adam D. Cornett" Date: Wed, 6 Dec 2023 11:08:30 -0700 Subject: [PATCH] remove experimental subcommand Signed-off-by: Adam D. Cornett --- cmd/preflight/cmd/experimental.go | 36 ------------------------------- cmd/preflight/cmd/root.go | 1 - 2 files changed, 37 deletions(-) delete mode 100644 cmd/preflight/cmd/experimental.go diff --git a/cmd/preflight/cmd/experimental.go b/cmd/preflight/cmd/experimental.go deleted file mode 100644 index 9303cbd8..00000000 --- a/cmd/preflight/cmd/experimental.go +++ /dev/null @@ -1,36 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -// experimentalCmd returns a Cobra command containing experimental subcommands. -// These subcommands are not supported for production workflows. -func experimentalCmd() *cobra.Command { - expCmd := &cobra.Command{ - Use: "experimental", - Short: "Run experimental commands within Preflight", - Long: "This command will allow you to run experimental subcommands of the Preflight tool. These commands are not supported, may be potentially buggy, and should not be used by most people outside of specific testing cases. Experimental subcommands are subject to change or removal without notice.", - Hidden: true, - Aliases: []string{"exp"}, - PersistentPreRun: func(cmd *cobra.Command, args []string) { - // The root command tries to create the prelfight log early - // even if we don't write to it. Set it to DevNull because - // experimental won't make use of it. - viper.Set("logfile", os.DevNull) - }, - } - - // Hide preflight-specific global flags from being suggested to experimental commands, - // where they're not expected to function in the same capacity. - expCmd.SetHelpFunc(func(command *cobra.Command, strings []string) { - _ = command.Parent().Flags().MarkHidden("logfile") - _ = command.Parent().Flags().MarkHidden("loglevel") - command.Root().HelpFunc()(command, strings) - }) - - return expCmd -} diff --git a/cmd/preflight/cmd/root.go b/cmd/preflight/cmd/root.go index e52de955..681f9aa4 100644 --- a/cmd/preflight/cmd/root.go +++ b/cmd/preflight/cmd/root.go @@ -47,7 +47,6 @@ func rootCmd() *cobra.Command { rootCmd.AddCommand(listChecksCmd()) rootCmd.AddCommand(runtimeAssetsCmd()) rootCmd.AddCommand(supportCmd()) - rootCmd.AddCommand(experimentalCmd()) return rootCmd }