Skip to content

Commit

Permalink
feat(subcmd/clean): add --keep-installed
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Feb 17, 2025
1 parent 3fee7c6 commit b072216
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/subcommand/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub struct Clean {
/// Keep downloadable and installed packages
#[arg(long, conflicts_with = "keep_downloadable")]
keep_downloadable_and_installed: bool,
/// Keep installed packages
#[arg(long, conflicts_with = "keep_downloadable_and_installed")]
keep_installed: bool,
/// Set sysroot target directory
#[arg(from_global)]
sysroot: PathBuf,
Expand All @@ -39,6 +42,7 @@ impl CliExecuter for Clean {
dry_run,
keep_downloadable,
keep_downloadable_and_installed,
keep_installed,
} = self;

if dry_run {
Expand Down Expand Up @@ -106,7 +110,9 @@ impl CliExecuter for Clean {
continue;
}

if !version.is_downloadable() && keep_downloadable {
if (!version.is_downloadable() && keep_downloadable)
|| (!version.is_installed() && keep_installed)
{
remove_deb(&i);
continue;
}
Expand Down

0 comments on commit b072216

Please sign in to comment.