@@ -10,13 +10,10 @@ function getFilePath(targetCommand: string, completionsDir: string): string {
10
10
return nodePath . join ( completionsDir , `${ targetCommand } .fish` ) ;
11
11
}
12
12
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 } ]` ;
15
14
const BLOCK_END_LINE = "# @stricli/auto-complete END" ;
16
15
17
- export async function forFish (
18
- context : StricliAutoCompleteContext
19
- ) : Promise < ShellManager | undefined > {
16
+ export async function forFish ( context : StricliAutoCompleteContext ) : Promise < ShellManager | undefined > {
20
17
const { os = nodeOs , fs = nodeFs , path = nodePath } = context ;
21
18
if ( ! context . process . env [ "SHELL" ] ?. includes ( "fish" ) ) {
22
19
context . process . stderr . write ( `Skipping fish as shell was not detected.\n` ) ;
@@ -27,9 +24,7 @@ export async function forFish(
27
24
try {
28
25
await fs . promises . mkdir ( completionsDir , { recursive : true } ) ;
29
26
} 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` ) ;
33
28
return ;
34
29
}
35
30
return {
@@ -55,25 +50,21 @@ export async function forFish(
55
50
try {
56
51
await fs . promises . writeFile ( filePath , fileContent ) ;
57
52
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` ,
59
54
) ;
60
55
} 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` ) ;
64
57
}
65
58
} ,
66
59
uninstall : async ( targetCommand : string ) => {
67
60
const filePath = getFilePath ( targetCommand , completionsDir ) ;
68
61
try {
69
62
await fs . promises . unlink ( filePath ) ;
70
63
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` ,
72
65
) ;
73
66
} 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` ) ;
77
68
}
78
69
} ,
79
70
} ;
0 commit comments