Skip to content

Commit

Permalink
Prevent from displaying help twice
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Oct 20, 2023
1 parent 50d3a9e commit 865319c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/ubuntu-image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 865319c

Please sign in to comment.