Skip to content

Allow deleting pre-built or source only for del-download #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/SPC/command/DeleteDownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function configure(): void
{
$this->addArgument('sources', InputArgument::REQUIRED, 'The sources/packages will be deleted, comma separated');
$this->addOption('all', 'A', null, 'Delete all downloaded and locked sources/packages');
$this->addOption('pre-built-only', 'W', null, 'Delete only pre-built sources/packages, not the original ones');
$this->addOption('source-only', 'S', null, 'Delete only sources, not the pre-built packages');
}

public function initialize(InputInterface $input, OutputInterface $output): void
Expand Down Expand Up @@ -51,10 +53,11 @@ public function handle(): int
$deleted_sources = [];
foreach ($chosen_sources as $source) {
$source = trim($source);
foreach ([$source, Downloader::getPreBuiltLockName($source)] as $name) {
if (LockFile::get($name)) {
$deleted_sources[] = $name;
}
if (LockFile::get($source) && !$this->getOption('pre-built-only')) {
$deleted_sources[] = $source;
}
if (LockFile::get(Downloader::getPreBuiltLockName($source)) && !$this->getOption('source-only')) {
$deleted_sources[] = Downloader::getPreBuiltLockName($source);
}
}

Expand Down