From 25030ba5d47d925758597af5e663757138111b7b Mon Sep 17 00:00:00 2001 From: Manjunath A Kumatagi Date: Wed, 9 Dec 2020 10:39:09 +0530 Subject: [PATCH] Hide audit-file option for image subcommand --- cmd/root.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index 9473917b..acd27b98 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,6 +51,16 @@ func init() { rootCmd.PersistentFlags().SortFlags = false _ = rootCmd.Flags().MarkHidden("debug") + // Hide the --audit-file for the image subcommand + // TODO: Remove this after adding audit support to image subcommand + origHelpFunc := rootCmd.HelpFunc() + rootCmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { + if cmd.Name() == "image" || (cmd.Parent() != nil && cmd.Parent().Name() == "image") { + cmd.Flags().MarkHidden("audit-file") + } + origHelpFunc(cmd, args) + }) + audit.Logger = audit.New(pkg.Options.AuditFile) }