diff --git a/single-scripts/message.ts b/single-scripts/message.ts new file mode 100644 index 0000000..8cb7c43 --- /dev/null +++ b/single-scripts/message.ts @@ -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==