import { get, instanciate } from "../../utils/anonymous.ts"; let cachedGitDir: Promise | undefined; export function gitDir(): Promise { if (!cachedGitDir) { cachedGitDir = new Deno.Command("git", { args: ["rev-parse", "--show-toplevel"], }).output() .then(get("stdout")) .then((x) => `file://${new TextDecoder().decode(x).trim()}/`) .then(instanciate(URL)); } return cachedGitDir; }