mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 21:50:22 +00:00
Deduplicate more
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user