From 865319c82a1d279f312a0a1bf160ffa900daf623 Mon Sep 17 00:00:00 2001 From: Paul Mars Date: Fri, 20 Oct 2023 14:47:20 +0200 Subject: [PATCH] Prevent from displaying help twice --- cmd/ubuntu-image/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/ubuntu-image/main.go b/cmd/ubuntu-image/main.go index b77005a0..05afa50a 100644 --- a/cmd/ubuntu-image/main.go +++ b/cmd/ubuntu-image/main.go @@ -71,6 +71,11 @@ func executeStateMachine(sm statemachine.SmInterface) error { // unhidePackOpts make pack options visible in help if the pack command is used // This should be removed when the pack command is made visible to everyone func unhidePackOpts(parser *flags.Parser) { + // Save given options before removing them temporarily + // otherwise the help will be displayed twice + opts := parser.Options + parser.Options = 0 + defer func() { parser.Options = opts }() // parse once to determine the active command // we do not care about error here since we will reparse again _, _ = parser.Parse()