Skip to content

Commit e0da9df

Browse files
committed
fix: types
1 parent 280db1b commit e0da9df

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

packages/auto-complete/src/context.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface StricliAutoCompleteContext extends CommandContext {
66
readonly process: Pick<NodeJS.Process, "stderr" | "stdout" | "env">;
77
readonly os?: Pick<typeof import("os"), "homedir">;
88
readonly fs?: {
9-
readonly promises: Pick<typeof import("fs").promises, "readFile" | "writeFile">;
9+
readonly promises: Pick<typeof import("fs").promises, "readFile" | "writeFile" | "mkdir" | "unlink">;
1010
};
1111
readonly path?: Pick<typeof import("path"), "join">;
1212
}

packages/auto-complete/src/shells/fish.ts

+7-16
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ function getFilePath(targetCommand: string, completionsDir: string): string {
1010
return nodePath.join(completionsDir, `${targetCommand}.fish`);
1111
}
1212

13-
const BLOCK_START_LINE = (targetCommand: string) =>
14-
`# @stricli/auto-complete START [${targetCommand}]`;
13+
const BLOCK_START_LINE = (targetCommand: string) => `# @stricli/auto-complete START [${targetCommand}]`;
1514
const BLOCK_END_LINE = "# @stricli/auto-complete END";
1615

17-
export async function forFish(
18-
context: StricliAutoCompleteContext
19-
): Promise<ShellManager | undefined> {
16+
export async function forFish(context: StricliAutoCompleteContext): Promise<ShellManager | undefined> {
2017
const { os = nodeOs, fs = nodeFs, path = nodePath } = context;
2118
if (!context.process.env["SHELL"]?.includes("fish")) {
2219
context.process.stderr.write(`Skipping fish as shell was not detected.\n`);
@@ -27,9 +24,7 @@ export async function forFish(
2724
try {
2825
await fs.promises.mkdir(completionsDir, { recursive: true });
2926
} catch {
30-
context.process.stderr.write(
31-
`Could not create fish completions directory at ${completionsDir}.\n`
32-
);
27+
context.process.stderr.write(`Could not create fish completions directory at ${completionsDir}.\n`);
3328
return;
3429
}
3530
return {
@@ -55,25 +50,21 @@ export async function forFish(
5550
try {
5651
await fs.promises.writeFile(filePath, fileContent);
5752
context.process.stdout.write(
58-
`Fish completions installed to ${filePath}. Restart fish shell or run 'source ${filePath}' to load changes.\n`
53+
`Fish completions installed to ${filePath}. Restart fish shell or run 'source ${filePath}' to load changes.\n`,
5954
);
6055
} catch {
61-
context.process.stderr.write(
62-
`Failed to write fish completions file at ${filePath}.\n`
63-
);
56+
context.process.stderr.write(`Failed to write fish completions file at ${filePath}.\n`);
6457
}
6558
},
6659
uninstall: async (targetCommand: string) => {
6760
const filePath = getFilePath(targetCommand, completionsDir);
6861
try {
6962
await fs.promises.unlink(filePath);
7063
context.process.stdout.write(
71-
`Fish completions removed from ${filePath}. Restart fish shell or run 'source ${filePath}' to update changes.\n`
64+
`Fish completions removed from ${filePath}. Restart fish shell or run 'source ${filePath}' to update changes.\n`,
7265
);
7366
} catch {
74-
context.process.stderr.write(
75-
`Could not remove fish completions file at ${filePath}.\n`
76-
);
67+
context.process.stderr.write(`Could not remove fish completions file at ${filePath}.\n`);
7768
}
7869
},
7970
};

0 commit comments

Comments
 (0)