From 0e65c651e67e1c82196db4c89e1d64da90f2512c Mon Sep 17 00:00:00 2001 From: Bauke Date: Sun, 30 Jul 2023 17:57:38 +0200 Subject: [PATCH] More documentation! --- .bauke/scripts/utilities.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.bauke/scripts/utilities.ts b/.bauke/scripts/utilities.ts index 444c66f..a93b301 100644 --- a/.bauke/scripts/utilities.ts +++ b/.bauke/scripts/utilities.ts @@ -1,5 +1,8 @@ import { toml } from "./dependencies.ts"; +/** + * Check if a path exists by running {@linkcode Deno.stat} on it. + */ export async function pathExists(path: string): Promise { try { await Deno.stat(path); @@ -9,10 +12,16 @@ export async function pathExists(path: string): Promise { } } +/** + * Run `JSON.stringify` with 2 spaces of indentation. + */ export function stringifyJsonPretty(input: unknown): string { return JSON.stringify(input, null, 2); } +/** + * Run a command with by default inherited `stderr` and `stdout`. + */ export async function runCommand( command: string, options: Deno.CommandOptions = {}, @@ -24,6 +33,9 @@ export async function runCommand( }).output(); } +/** + * Run a command and return its `stdout` output. + */ export async function runAndReturnStdout( command: string, options: Deno.CommandOptions = {},