🔧 Update color rendering logic and upgrade script dependencies

This commit is contained in:
2026-04-11 08:53:13 +08:00
parent dc11b5c0ff
commit a315d9778d
3 changed files with 17 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ import {
log,
parseIntVal,
term,
} from "https://global.hatter.ink/script/get/@21/deno-commons-mod.ts";
} from "https://global.hatter.ink/script/get/@70/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
const defaultSkipDirs = [
@@ -35,7 +35,7 @@ async function listDir(
const showNextDepth = (depth + 1) <= maxDepth;
console.log(
`${tab}- [${dirEntry.name}]${
showNextDepth ? "" : term.blue(" \t[...more dirs...]")
showNextDepth ? "" : term.auto("[blue][[[ \t[...more dirs...]]]][/]")
}`,
);
if (showNextDepth) {
@@ -48,22 +48,22 @@ async function listDir(
} else if (dirEntry.isFile) {
const fileInfo = await Deno.stat(fullName);
if (fileInfo.size > 1024 * 1024) {
fileDesc = term.red(
` - ${formatSize2(fileInfo.size)}`,
fileDesc = term.auto(
`[red][[[ - ${formatSize2(fileInfo.size)}]]]][/]`,
);
} else {
fileDesc = term.yellow(
` - ${formatSize2(fileInfo.size)}`,
fileDesc = term.auto(
`[yellow][[[ - ${formatSize2(fileInfo.size)}]]][/]`,
);
}
}
console.log(
`${tab}- ${term.green(dirEntry.name)} \t${fileDesc}`,
`${tab}- ${term.auto("[green][[["+dirEntry.name+"]]][/]")} \t${fileDesc}`,
);
}
}
} catch (e) {
console.log(term.red(`${tab} ERROR: ${e}`));
console.log(term.auto(`[red][[[${tab} ERROR: ${e}]]][/]`));
}
}
@@ -93,5 +93,5 @@ tree.ts [parameters] <dir>
main().catch((e) => log.error(e));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260130T005327+08:00.MEUCICFLf8ZlGN4bSzCiRBlW
// AnPVvd4by4hrwq6ZZPaN/cY6AiEAtyx0B6/EINNU2ilPoY1g0+LGc5FylLEJ5Ybn+pkpn8I=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260411T085252+08:00.MEQCIF2mljiVKgw/oBHggTcd
// bIyoWblVNdk8NxsEqMsxUqFMAiBVZKjn/XaZOPwpluv8wOlRtl/FqZZ3fmPj3YgGjVNjsg==