diff --git a/libraries/deno-commons-mod.ts b/libraries/deno-commons-mod.ts index 943b6ff..ecec189 100644 --- a/libraries/deno-commons-mod.ts +++ b/libraries/deno-commons-mod.ts @@ -41,6 +41,15 @@ export class ProcessOutput { } } +export async function execCommandAndStdout( + command: string, + args?: string[], + options?: Deno.CommandOptions,): Promise { + const processOutput = await execCommand(command, args, options); + processOutput.assertSuccess(); + return processOutput.stdout.trim(); +} + export async function execCommand( command: string, args?: string[], diff --git a/script-meta-v2.json b/script-meta-v2.json index d7e57ef..5efed59 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -98,12 +98,12 @@ }, "git-check.ts": { "script_name": "git-check.ts", - "script_length": 3084, - "script_sha256": "84ebf44e6aa0a46641f822b412b29f58c9585cce778ab3dce33e870505340214", + "script_length": 3040, + "script_sha256": "f03171ce3129c63f35d55c69fe7e8e5f085739ad56887810284716d1f1c95a27", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/git-check.ts", "single_script_file": true, "publish_time": 1770541896791, - "update_time": 1770553485311 + "update_time": 1770553736989 }, "helloworld-bun.ts": { "script_name": "helloworld-bun.ts", diff --git a/single-scripts/git-check.ts b/single-scripts/git-check.ts index 01d293c..dcc4bfe 100755 --- a/single-scripts/git-check.ts +++ b/single-scripts/git-check.ts @@ -1,7 +1,7 @@ #!/usr/bin/env runts -- --allow-all import { - execCommand, + execCommandAndStdout, formatHumanTime, log, ProcessBar, @@ -10,12 +10,9 @@ import { term, uint8ArrayToHexString, writeStringToFile, -} from "https://script.hatter.ink/@34/deno-commons-mod.ts"; -import { - getGitLocalRev, - getGitRemoteRev, -} from "https://script.hatter.ink/@0/deno-git-mod.ts"; -import { parseArgs } from "jsr:@std/cli/parse-args"; +} from "https://script.hatter.ink/@35/deno-commons-mod.ts"; +import {getGitLocalRev, getGitRemoteRev,} from "https://script.hatter.ink/@0/deno-git-mod.ts"; +import {parseArgs} from "jsr:@std/cli/parse-args"; const MILLIS_OF_HOUR = 60 * 60 * 1000; @@ -26,9 +23,7 @@ async function sha256OfString(input: string): Promise { } async function getPwd(): Promise { - return (await execCommand("pwd")) - .assertSuccess() - .stdout.trim(); + return await execCommandAndStdout("pwd"); } interface GitCheckCache { @@ -100,5 +95,5 @@ git-check.ts [--interval NUMBER-OF-HOURS]`); await main(); -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T202409+08:00.MEUCIQDQct1xYu1frnSk3uzu -// RZ5WHoOdBCzaMDAe16JIbKZlGAIgZ3gBrD8FIH+H6efI8C7mkyn3RjoAqa6PAz72KcX/d80= +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T202755+08:00.MEQCID0gTH0EMJ32IuSwRD2G +// WzpwUI7eCDHExlRBPmPizM49AiAJ0T2Haify9X26A2S9ve16kSHMI1SPYgoTbD1ho3b2Xw==