fvm icon indicating copy to clipboard operation
fvm copied to clipboard

Add flag to exit with error instead of asking for interaction

Open Rexios80 opened this issue 1 year ago • 15 comments

Fixes https://github.com/leoafarias/fvm/issues/710

Rexios80 avatar Apr 12 '24 15:04 Rexios80

@Rexios80 is attempting to deploy a commit to the FlutterTools Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 12 '24 15:04 vercel[bot]

@Rexios80 Shouldn't this return a selection or default selection instead of just exiting? Also, we have added an isCI flag. Would it be the same type of behavior to essentially skip selections in this case or select the default, and if no default is set, then exit?

leoafarias avatar Apr 12 '24 17:04 leoafarias

The main user input I have issue with is the confirmation to install. The default value for that one is true which is not what I want. It also exits with a success exit code if you say no which is bad since it hides the issue from my tool. As for the selections, I don't see a way to do that without user interaction. The two selections I see (the one for selecting a flutter version and the one for fixing "invalid" flutter versions) both cannot be handled with a default. I mostly added the exit to the select call for consistency with the confirm call, so maybe we can remove that change?

The isCI flag looks promising, but this tool isn't only meant for use in CI so that seems a little weird.

Rexios80 avatar Apr 12 '24 17:04 Rexios80

I think I misread that you wanted to use the isCI flag for this. Yes this PR should be replicating the same behavior that we would expect in CI.

Rexios80 avatar Apr 13 '24 00:04 Rexios80

@Rexios80 can I close this in favor of #713?

leoafarias avatar Apr 17 '24 13:04 leoafarias

What do you mean "in favor of"? They're two completely separate PRs.

Rexios80 avatar Apr 17 '24 13:04 Rexios80

The force flag also skips interaction. Which command do you need this no interaction for?

leoafarias avatar Apr 18 '24 16:04 leoafarias

Theoretically it could be any command that asks for interaction, but the biggest issue is when fvm asks to install a flutter version with fvm flutter ...

Rexios80 avatar Apr 18 '24 16:04 Rexios80

@leoafarias What do we need to get this functionality in?

Rexios80 avatar Apr 30 '24 23:04 Rexios80

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fvm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 1:05pm

vercel[bot] avatar May 07 '24 13:05 vercel[bot]

@Rexios80 can you just update the docs on the website to document this flag?

leoafarias avatar May 07 '24 13:05 leoafarias

@leoafarias Before I do that are we sure we like the flag name "--no-interact"? I didn't put much thought into it and I don't want us to be stuck with something we don't like forever.

Rexios80 avatar May 07 '24 15:05 Rexios80

Maybe "--no-input" would be better? Or even something like "--fvm-no-input" to guarantee it can't conflict with any dart/flutter flags?

Rexios80 avatar May 07 '24 15:05 Rexios80

@leoafarias Please review this when you get a chance

Rexios80 avatar May 15 '24 18:05 Rexios80

@leoafarias Do you need anything from me on this?

Rexios80 avatar Jun 12 '24 14:06 Rexios80

@Rexios80 I will bring this in, but will change the default behavior to if isCI, to just use the default value on confirmation... and will define the default values for each.

leoafarias avatar Aug 25 '24 18:08 leoafarias

--fvm-skip-input option is not found. how is the usage? @leoafarias

kaj777 avatar Aug 26 '24 09:08 kaj777

@kaj777, there was an issue with the merge. I am doing a hotfix now.

leoafarias avatar Aug 26 '24 12:08 leoafarias

@leoafarias I appreciate you merging this, but I would strongly prefer the default to be NOT installing a missing flutter version when --fvm-skip-input is passed. If a command is running headless, this will effectively freeze the command for up to several minutes.

Rexios80 avatar Aug 27 '24 19:08 Rexios80

I understand. As you can imagine, I am trying to minimize the flags and flows as much as possible.

What is the case where you run an fvm command that needs a version installed, but you don't want it to install?

leoafarias avatar Aug 27 '24 20:08 leoafarias

The puby tool can run pub commands in mono-repos in parallel. If a project is set up with fvm, it will call fvm flutter commands. In the case that a user of puby calls puby {link, clean, etc} in an fvm project, but they do not have the required flutter version installed, the command will seem to hang for a long time. It also might try to install flutter many times at once which could cause issues. Since the commands are running in parallel, there is no good solution besides exiting. This could happen when another developer on the project updates the fvm flutter version, but other user's haven't installed it yet.

I don't see a use-case for --fvm-skip-input and auto-installing flutter versions. Scripts running in CI environments should be calling fvm install first anyways.

Rexios80 avatar Aug 27 '24 21:08 Rexios80