From 052ac6612b9fdbd7573da5a62338411438911c33 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 8 Feb 2026 15:56:03 +0800 Subject: [PATCH] update term color --- script-meta-v2.json | 6 +++--- single-scripts/term-color.ts | 24 ++++++++++++++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index 70ac94f..26aa94f 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -256,12 +256,12 @@ }, "term-color.ts": { "script_name": "term-color.ts", - "script_length": 1472, - "script_sha256": "64523ef7952cc9e189b04605677e2e03193b9435b9d171423d590fd6a37280e3", + "script_length": 2040, + "script_sha256": "19bfc6d98fd3e6eee305b30a89904d4c5d8961bc203e84e0ce00c35485372d26", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/term-color.ts", "single_script_file": true, "publish_time": 1770533214194, - "update_time": 1770536826085 + "update_time": 1770537359527 }, "tree.ts": { "script_name": "tree.ts", diff --git a/single-scripts/term-color.ts b/single-scripts/term-color.ts index 7564021..963e410 100755 --- a/single-scripts/term-color.ts +++ b/single-scripts/term-color.ts @@ -1,6 +1,7 @@ -#!/usr/bin/env runts -- --allow-import +#!/usr/bin/env runts -- --allow-import --allow-net -import {term} from "https://script.hatter.ink/@33/deno-commons-mod.ts"; +import { term } from "https://script.hatter.ink/@33/deno-commons-mod.ts"; +import { fetchDataWithTimeout } from "../libraries/deno-commons-mod.ts"; function printColors(colors: string[], prefix: string, suffix: string) { const termOutputs: string[] = []; @@ -25,6 +26,21 @@ async function main() { "cyan", "white", ]; + try { + const denoCommonsModResponse = await fetchDataWithTimeout( + "https://hatter.ink/s/deno-commons-mod.ts", + ); + const denoCommonsMod = await denoCommonsModResponse.json(); + const denoCommonsModUrl = denoCommonsMod.data["script-url"]; + console.log( + term.auto( + `[bg_white][green][bold]import {term} from "${denoCommonsModUrl}";\n`, + ), + ); + } catch (e) { + // IGNORE + } + printColors(colors, "", ""); console.log(); printColors(colors, "", "_bright"); @@ -46,5 +62,5 @@ async function main() { } await main(); -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T154653+08:00.MEUCIQCt2qj/3lPKwhX8n5ID -// jvkItXyST6mG1/j3fcUHybaePQIgAM4ErXInKntZU3DvmuX8szEFXIcFN1W3+zYLzPuYywk= +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T155509+08:00.MEUCIEkRx6ftytYOS1NOOi/C +// 5k1uznr7juyMmOMq/11nkyWIAiEA8tGnRCDfOyaQriwMSjxfO4tTm2xfxbcUbvJfmy/HAso=