Skip to content

Conversation

@lferrazzini95
Copy link
Contributor

Feature or Problem

Currently user do not have the ability to easily clean up cache, config or data files related to wash. Therefore a subcomand was introduced to clean up all directories.

Related Issues

Issue 29

Release Information

next

Consumer Impact

None

Testing

Currenlty no tests are added but probably it would be nice to add an integration test to check that the only the correct files are deleted. Waiting on Input on this.

Unit Test(s)

Added unit test to list all objects in a specific directory.

Acceptance or Integration

None

Manual Verification

Verified manually

@lferrazzini95
Copy link
Contributor Author

I currently added flags to delete specific folders ( --config, --data, --cache). The original issue only stated to specifically delete data and cache. But as it is about deleting files I thought it might be nice to only allow deletions if specific flags are passed and if non are given to do nothing.

@lferrazzini95 lferrazzini95 force-pushed the feat/add-config-cleanup-subcommand branch 3 times, most recently from 4c6c68f to eab9e0c Compare October 8, 2025 11:48
Comment on lines +19 to +20
.filter_map(|entry| entry.ok())
.filter(|entry| entry.path() != dir)
.map(|entry| entry.into_path())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supernit: this feels like it could be collapsed but it reads well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brooksmtownsend do I got this correctly that you would rather have something like this?

     .filter_map(|entry| entry.ok())
        .filter_map(|entry| (entry.path() != dir).then(|| entry.into_path()))

Or even more collapsed? I would be interested in the cleanest way by your opinion! :)

Comment on lines 132 to 140
if !(*config || *cache || *data || *all) {
return Ok(CommandOutput::error(
"Nothing to do. Please specify --config, --data, --cache, or --all to clean up.",
Some(serde_json::json!({
"message": "Nothing to do. Please specify --config, --data, --cache, or --all to clean up.",
"success": true,
})),
));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use the clap ArgGroup capability to put config, data, cache, and all in a single arg group, make the group required, and make multiple flags true. That would prevent us from having to update this if we add more fields in the future!

Copy link
Member

@brooksmtownsend brooksmtownsend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!! I left only optional comments and happy to merge as-is, just want to give ya a chance to take a look and see if you wanted to implement anything (like the clap ArgGroup)

Happy to take these as followup PRs too

Comment on lines 268 to 270
format!("Successfully deleted {} files", successful_deletions),
Some(serde_json::json!({
"message": format!("{} files deleted successfully.",successful_deletions),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
format!("Successfully deleted {} files", successful_deletions),
Some(serde_json::json!({
"message": format!("{} files deleted successfully.",successful_deletions),
format!("Successfully deleted {successful_deletions} files"),
Some(serde_json::json!({
"message": format!("{successful_deletions} files deleted successfully."),

This format better matches the rest of the crate's usage

@lferrazzini95 lferrazzini95 force-pushed the feat/add-config-cleanup-subcommand branch from eab9e0c to c68f19b Compare November 20, 2025 07:43
@lferrazzini95 lferrazzini95 requested a review from a team as a code owner November 20, 2025 07:43
@lferrazzini95
Copy link
Contributor Author

Hi @brooksmtownsend I am so sorry for the long delay of my changes had a lot going on... I considered your remarks and hope this is fine now.
Thanks a lot for your review! And I have to say the way you interact with newcomers like me is really motivating <3

@lferrazzini95 lferrazzini95 force-pushed the feat/add-config-cleanup-subcommand branch 4 times, most recently from 51b0932 to 778ba5c Compare November 20, 2025 08:16
Signed-off-by: Eric Gregory <[email protected]>
@lferrazzini95 lferrazzini95 force-pushed the feat/add-config-cleanup-subcommand branch from 778ba5c to a7fbc1e Compare November 20, 2025 08:19
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.

3 participants