diff --git a/cmd/root.go b/cmd/root.go index 3a766b28..f5393e65 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -50,6 +50,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) }