update message

This commit is contained in:
2026-02-08 16:16:39 +08:00
parent 8a1aee9d00
commit 23a6bfde8c
2 changed files with 34 additions and 7 deletions

View File

@@ -159,12 +159,12 @@
}, },
"message.ts": { "message.ts": {
"script_name": "message.ts", "script_name": "message.ts",
"script_length": 1053, "script_length": 1791,
"script_sha256": "410db83a1e2c7d21d1eb324a545d0c8208f67c10b80a06fa7ad8123553d9786e", "script_sha256": "7c837640d6f607b15c4ebc3c590bf86784ebec2a7ce7cd2ef98edba8a7929a68",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/message.ts", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/message.ts",
"single_script_file": true, "single_script_file": true,
"publish_time": 1770129305453, "publish_time": 1770129305453,
"update_time": 1770133790553 "update_time": 1770538595147
}, },
"post-note.ts": { "post-note.ts": {
"script_name": "post-note.ts", "script_name": "post-note.ts",

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env runts -- --allow-import #!/usr/bin/env runts -- --allow-import
import {log} from "https://global.hatter.ink/script/get/@18/deno-commons-mod.ts"; import {log, term,} from "https://global.hatter.ink/script/get/@33/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args"; import {parseArgs} from "jsr:@std/cli/parse-args";
function main() { function main() {
@@ -12,6 +12,13 @@ function main() {
"warn", "warn",
"warning", "warning",
"error", "error",
"bold",
"under",
"auto",
],
string: [
"color",
"bgcolor",
], ],
}); });
@@ -31,11 +38,31 @@ function main() {
} else if (flags.debug) { } else if (flags.debug) {
log.debug(...flags._); log.debug(...flags._);
} else { } else {
console.log(flags._.join(' ')); if (flags.auto) {
console.log(term.auto(flags._.join(" ")));
} else {
const sb: string[] = [];
if (flags.color) {
sb.push(`[${flags.color}]`);
}
if (flags.bold) {
sb.push(`[bold]`);
}
if (flags.under) {
sb.push(`[under]`);
}
if (flags.bgcolor) {
sb.push(`[bg_${flags.bgcolor}]`);
}
sb.push("[[[");
sb.push(flags._.join(" "));
sb.push("]]]");
console.log(term.auto(sb.join("")));
}
} }
} }
main(); main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260203T234925+08:00.MEQCIHHUP+yyL547VOxi5cwT // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T161629+08:00.MEUCIQD2GNZVw70Ke2g12xC+
// ekRl7ckyStN+s0Ni3aICU9tzAiBKydlOovYShx9a/9SP2W4vMOiA1ABsWwHupiBovZaXsg== // FHqhxP0o8IK1WcMmijGRjoCIEwIgK2svmajusuU7quHyIurV6JnRp9fLzElmA/wmVwuLv1A=