Skip to content

Commit 23a5920

Browse files
committed
fix: completion script registration
1 parent 6030cea commit 23a5920

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

api/src/cli.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#!/usr/bin/env node
2-
import '@app/dotenv';
32

4-
import { execSync } from 'child_process';
3+
import '@app/dotenv';
54

5+
import { execa } from 'execa';
66
import { CommandFactory } from 'nest-commander';
77

88
import { cliLogger, internalLogger } from '@app/core/log';
99
import { CliModule } from '@app/unraid-api/cli/cli.module';
1010

1111
try {
12-
const shellToUse = execSync('which unraid-api').toString().trim();
12+
const shellToUse = await execa('which unraid-api')
13+
.then((res) => res.toString().trim())
14+
.catch((_) => '/usr/local/bin/unraid-api');
1315
await CommandFactory.run(CliModule, {
1416
cliName: 'unraid-api',
1517
logger: false, // new LogService(), - enable this to see nest initialization issues
1618
completion: {
1719
fig: true,
18-
cmd: 'unraid-api',
20+
cmd: 'completion-script',
1921
nativeShell: { executablePath: shellToUse },
2022
},
2123
});

0 commit comments

Comments
 (0)