spkenv / spk

A Package Manager for high velocity software environments, built on spfs.
https://spkenv.dev
Apache License 2.0
40 stars 6 forks source link

`spk rm` needs reliable confirmation prompts when working on a non-local repo #1026

Open jrray opened 6 months ago

jrray commented 6 months ago

At present, spk rm only prompts for confirmation if the user is attempting to delete an entire package, as in spk rm pkgname. It does not prompt if any '/' appears in the deletion subject, as in spk rm pkgname/1.0.

This means that even spk rm -r origin pkgname/1.0 will proceed with the deletion without a confirmation prompt. This unsettles users who would like to see what is going to happen before applying the change.

The current behavior is okay when working on the local repo and having fewer confirmation prompts for less risky operations is desirable, because otherwise users can fall into the habit of typing --yes all the time and then make mistakes.

The proposal is to rework the logic of spk rm so it can create a plan of all it is going to do (making it also possible to implement a --dry-run option), print a message of what it is going to do, and prompt once for confirmation. A key change is that the prompt is mandatory no matter what is going to be deleted if anything that is to be deleted lives in a repo other than the local repo. The --yes flag would continue to bypass the prompt.