Skip to content

Conversation

@abitrolly
Copy link

@abitrolly abitrolly commented Nov 17, 2025

Fixes #4665

Change Summary

What and Why:

This fixes endless loop in when supplied wg create filename already exists. The problem was caused by argOrPrompt helper, which always returns the command line argument if it is set, so the prompt never appears in this case.

How:

Added flag.GetArg(ctx, idx) helper to clean up the logic. Then reworked the loop so that it first checks for all favorable conditions, and then runs prompt without the helper that attempts to do too much.

Now if there is a problem with config file supplied as cmdline argument, flyctl enters the interactive prompt to allow to fix the mistake.

Related to:

#4665


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

@abitrolly abitrolly changed the title refactor: add flag.GetArg(ctx, idx) helper fix(wg create): break endless loop when file exists Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wg create: infinite loop when file exists

1 participant