Skip to content

Commit

Permalink
Hide audit-file option for image subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumatag committed Dec 9, 2020
1 parent a14a08a commit 25030ba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 25030ba

Please sign in to comment.