fix(cli): honor --dry-run when updating and removing core files
This commit is contained in:
@@ -284,6 +284,13 @@ final class Installer
|
||||
}
|
||||
|
||||
$absolute = $this->root . '/' . $relative;
|
||||
|
||||
if ($options['dryRun'] ?? false) {
|
||||
$actions[$relative] = 'planned';
|
||||
$installed[$relative] = 'sha256:' . hash('sha256', $provider->read($relative));
|
||||
continue;
|
||||
}
|
||||
|
||||
$action = $this->sync->write($absolute, $provider->read($relative), $expected[$relative] ?? null, $options);
|
||||
$actions[$relative] = $action;
|
||||
|
||||
@@ -300,6 +307,10 @@ final class Installer
|
||||
if (isset($installed[$relative]) || isset($protected[$relative]) || in_array($relative, $files, true)) {
|
||||
continue;
|
||||
}
|
||||
if ($options['dryRun'] ?? false) {
|
||||
$actions[$relative] = 'remove-planned';
|
||||
continue;
|
||||
}
|
||||
$action = $this->sync->remove($this->root . '/' . $relative, $hash, $options);
|
||||
if ($action === FileSync::ABORTED) {
|
||||
$aborted[] = $relative;
|
||||
|
||||
Reference in New Issue
Block a user