mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix: completion script registration
This commit is contained in:
@@ -1,21 +1,23 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import '@app/dotenv';
|
import '@app/dotenv';
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
import { execa } from 'execa';
|
||||||
|
|
||||||
import { CommandFactory } from 'nest-commander';
|
import { CommandFactory } from 'nest-commander';
|
||||||
|
|
||||||
import { cliLogger, internalLogger } from '@app/core/log';
|
import { cliLogger, internalLogger } from '@app/core/log';
|
||||||
import { CliModule } from '@app/unraid-api/cli/cli.module';
|
import { CliModule } from '@app/unraid-api/cli/cli.module';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const shellToUse = execSync('which unraid-api').toString().trim();
|
const shellToUse = await execa('which unraid-api')
|
||||||
|
.then((res) => res.toString().trim())
|
||||||
|
.catch((_) => '/usr/local/bin/unraid-api');
|
||||||
await CommandFactory.run(CliModule, {
|
await CommandFactory.run(CliModule, {
|
||||||
cliName: 'unraid-api',
|
cliName: 'unraid-api',
|
||||||
logger: false, // new LogService(), - enable this to see nest initialization issues
|
logger: false, // new LogService(), - enable this to see nest initialization issues
|
||||||
completion: {
|
completion: {
|
||||||
fig: true,
|
fig: true,
|
||||||
cmd: 'unraid-api',
|
cmd: 'completion-script',
|
||||||
nativeShell: { executablePath: shellToUse },
|
nativeShell: { executablePath: shellToUse },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user