This package has been archived, and as such it is read-only.
This release is 1 version behind 0.0.9 — the latest version of @apompolo/mr-cli. Jump to latest
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
58%
Published
4 weeks ago (0.0.8)
import { Spinner } from "jsr:/@std/cli@^1.0.10/unstable-spinner"; export const Terminal = { async checkIfInstalled(programName: string) { const isInstalled = await new Deno.Command("which", { args: [programName] }) .output() .then((result) => result.success); if (!isInstalled) { console.error(`${programName} was not found`); return Deno.exit(1); } }, async withSpinner(title: string, fn: (spinner: Spinner) => Promise<unknown>) { const spinner = new Spinner({ message: `${title}...` }); spinner.start(); await fn(spinner); spinner.stop(); console.log(`✅ ${title}`); }, async run(fullCmd: string) { const [cmd, ...args] = fullCmd.split(" "); const result = await new Deno.Command(cmd, { args }).output(); const textDecoder = new TextDecoder(); if (result.success) { return textDecoder.decode(result.stdout); } else { throw new Error(textDecoder.decode(result.stderr)); } }, };