fix: honor --dry-run in update and uninstall
This commit is contained in:
parent
6229538d29
commit
744cb36d74
9 changed files with 113 additions and 23 deletions
|
|
@ -4,6 +4,7 @@ import { dim, heading, ok, warn } from "../ui.ts";
|
|||
export async function runUninstall(opts: {
|
||||
targets?: TargetId[];
|
||||
force?: boolean;
|
||||
dryRun?: boolean;
|
||||
}): Promise<number> {
|
||||
const manifest = await readManifest();
|
||||
const targets = manifest.installs.filter(
|
||||
|
|
@ -15,13 +16,15 @@ export async function runUninstall(opts: {
|
|||
return 0;
|
||||
}
|
||||
|
||||
console.log(heading("제거"));
|
||||
console.log(heading(opts.dryRun ? "제거 계획" : "제거"));
|
||||
for (const rec of targets) {
|
||||
const res = await removeInstall(rec, { force: opts.force });
|
||||
console.log(ok(`${rec.target} (${rec.scope}) — ${res.removed.length}개 제거 ${dim(tildify(rec.root))}`));
|
||||
const res = await removeInstall(rec, { force: opts.force, dryRun: opts.dryRun });
|
||||
const verb = opts.dryRun ? "제거할 파일" : "제거";
|
||||
console.log(ok(`${rec.target} (${rec.scope}) — ${verb} ${res.removed.length}개 ${dim(tildify(rec.root))}`));
|
||||
if (res.keptModified.length > 0) {
|
||||
const tense = opts.dryRun ? "남긴다" : "남겼다";
|
||||
console.log(
|
||||
warn(` 직접 수정한 파일 ${res.keptModified.length}개는 남겼다 (--force 로 함께 지운다)`),
|
||||
warn(` 직접 수정한 파일 ${res.keptModified.length}개는 ${tense} (--force 로 함께 지운다)`),
|
||||
);
|
||||
for (const p of res.keptModified.slice(0, 5)) console.log(dim(` ${tildify(p)}`));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue