mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
Allow deleting pre-built or source only for del-download
This commit is contained in:
parent
1a4296386a
commit
f6d25153c6
@ -22,6 +22,8 @@ class DeleteDownloadCommand extends BaseCommand
|
||||
{
|
||||
$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
|
||||
@ -51,10 +53,11 @@ class DeleteDownloadCommand extends BaseCommand
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user