devbox icon indicating copy to clipboard operation
devbox copied to clipboard

boxcli: add clean command

Open truearken opened this issue 1 year ago • 4 comments

Summary

This if a first draft for #2335, I am not sure about the behaviour or features of the command yet so I only added basic functionality. The issue also mentioned deleting files like .envrc, I didn't include this yet since these files might be generated by a user instead of the devbox, maybe this should be added by an optional parameter? or are generated files tracked? I also wasn't sure if the clean command should exit the devbox shell or not. In case it should, is the pid of the devbox saved anywhere so it can be killed, or is there a better way to do so?

How was it tested?

  • devbox init
  • devbox add go
  • devbox shell
  • devbox clean

=> expected result: .devbox, devbox.lock are deleted and the user remains in the shell.

I also included a test, but I can't test it because of #2342 so it might fail.

Edit

The behaviour is as following now: running devbox clean deletes .devbox and devbox.lock running devbox clean --hard asks for a confirmation and also deletes devbox.json

truearken avatar Oct 09 '24 11:10 truearken

I added the hard flag now to also delete the devbox.json file, I don't quite like the naming yet and am open for suggestions

truearken avatar Oct 10 '24 21:10 truearken

Hi, what about --all, or --force ?

trya2l avatar Oct 11 '24 03:10 trya2l

All might be an option. Imo force is something else, it means perform an action even though it might break things, an doesn't fit the action here.

truearken avatar Oct 11 '24 08:10 truearken

How about devbox uninit or devbox eject?

A command named clean deleting devbox.json and devbox.lock would be very surprising to me.

adamdicarlo0 avatar Oct 14 '24 18:10 adamdicarlo0