add message.ts
This commit is contained in:
41
single-scripts/message.ts
Normal file
41
single-scripts/message.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env runts -- --allow-import
|
||||
import {log} from "https://global.hatter.ink/script/get/@18/deno-commons-mod.ts";
|
||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
||||
|
||||
function main() {
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: [
|
||||
"debug",
|
||||
"info",
|
||||
"success",
|
||||
"ok",
|
||||
"warn",
|
||||
"warning",
|
||||
"error",
|
||||
],
|
||||
});
|
||||
|
||||
if (flags._.length === 0) {
|
||||
log.info("-");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.error) {
|
||||
log.error(...flags._);
|
||||
} else if (flags.warn || flags.warning) {
|
||||
log.warn(...flags._);
|
||||
} else if (flags.ok || flags.success) {
|
||||
log.success(...flags._);
|
||||
} else if (flags.info) {
|
||||
log.info(...flags._);
|
||||
} else if (flags.debug) {
|
||||
log.debug(...flags._);
|
||||
} else {
|
||||
log.log(...flags._);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260203T223424+08:00.MEQCIFt7nQax27tfDXq1HfO3
|
||||
// 4L3SeCKjfcbGM6mCqYJxwxGJAiAkfEXY4r7NTyMPz3z2bccBSiDo56ZF3/V08EH0BXz08A==
|
||||
Reference in New Issue
Block a user