MrHedmad/kerblam

Dry run for `kerblam data clean`

Closed this issue · 7 comments

As per the title, it would be nice to have a dry run for 'kerblam data clean'.

Good idea, but it could be implemented in many ways. Should a shallow list of paths be printed out? Should it show something like tree with, marked, the files to be deleted? If there are many files, should it just show those that are not to be deleted?

As a temporary workaround, you can enable the debug log, where a list of files is shown. Then just say no when Kerblam! asks you to delete the files:

RUST_LOG=debug kerblam data clean

You get something like this:

Long code alert
RUST_LOG=debug kerblam data clean
[2024-10-29T08:07:21Z DEBUG kerblam] Kerblam! invoked in "/tmp/test"
[2024-10-29T08:07:21Z DEBUG kerblam] Args: Cli { command: Data { subcommand: Some(Clean { include_remote: false, keep_dirs: false, yes: false }) } }
[2024-10-29T08:07:21Z DEBUG kerblam] Kerblam is starting in "/tmp/test"
[2024-10-29T08:07:21Z DEBUG kerblam::options] Reading "/tmp/test/kerblam.toml" for TOML options...
[2024-10-29T08:07:21Z DEBUG kerblam::options] Extracting "/tmp/test/data" with filters ["/tmp/test/data/in", "/tmp/test/data/out"]
[2024-10-29T08:07:21Z DEBUG kerblam::options] Extracting "/tmp/test/data/out" with filters ["/tmp/test/data/in"]
[2024-10-29T08:07:21Z DEBUG kerblam::options] Extracting "/tmp/test/data/in" with filters ["/tmp/test/data/out"]
[2024-10-29T08:07:21Z DEBUG kerblam::options] Remote file save dir is "/tmp/test/data/in"
[2024-10-29T08:07:21Z DEBUG kerblam::options] Remote file save dir is "/tmp/test/data/in"
[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] test: "/tmp/test/data/test"
[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] test: "/tmp/test/data/test2"
[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] test: "/tmp/test/data/out/outtest2"
[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] test: "/tmp/test/data/out/outtest"
[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] Files to clean: ["/tmp/test/data/test", "/tmp/test/data/test2", "/tmp/test/data/out/outtest2", "/tmp/test/data/out/outtest"]
🧹 About to delete 4 files (0 B). Continue? [yes/no]: no
Error: Aborted!

The last lines are what you need, specifically:

[2024-10-29T08:07:21Z DEBUG kerblam::commands::data] Files to clean: ["/tmp/test/data/test", "/tmp/test/data/test2", "/tmp/test/data/out/outtest2", "/tmp/test/data/out/outtest"]

@all-contributors please add @Feat-FeAR for bugs and design

As a temporary workaround, you can enable the debug log, where a list of files is shown. Then just say no when Kerblam! asks you to delete the files:

RUST_LOG=debug kerblam data clean

Very nice debug feature from Rust!

Good idea, but it could be implemented in many ways. Should a shallow list of paths be printed out? Should it show something like tree with, marked, the files to be deleted? If there are many files, should it just show those that are not to be deleted?

I would settle for the simplest solution (to begin with), which is the shallow list of files that will be deleted, exactly as provided by Rust's debug log... then, if we see that it is not the best thing, you can always add another option in the future
:-)

@MrHedmad

I've put up a pull request to add @Feat-FeAR! 🎉

thank you!

Fixed in 308ae8d, scheduled to ship in the next release.