Deduplicate more

This commit is contained in:
quotentiroler
2026-02-09 18:56:58 -08:00
parent c4d9b6eadb
commit 53910f3643
14 changed files with 38 additions and 138 deletions

View File

@@ -1,4 +1,3 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import type { ShellCompletionStatus } from "../commands/doctor-completion.js";
@@ -10,6 +9,7 @@ import {
checkShellCompletionStatus,
ensureCompletionCacheExists,
} from "../commands/doctor-completion.js";
import { pathExists } from "../utils.js";
type CompletionDeps = {
resolveCliName: () => string;
@@ -18,15 +18,6 @@ type CompletionDeps = {
installCompletion: (shell: string, yes: boolean, binName?: string) => Promise<void>;
};
async function pathExists(filePath: string): Promise<boolean> {
try {
await fs.access(filePath);
return true;
} catch {
return false;
}
}
async function resolveProfileHint(shell: ShellCompletionStatus["shell"]): Promise<string> {
const home = process.env.HOME || os.homedir();
if (shell === "zsh") {