Skip to content

Commit 1ab2ab5

Browse files
committed
feat: switch to nest-commander
1 parent 0dfb07f commit 1ab2ab5

33 files changed

+1090
-1264
lines changed

api/package-lock.json

Lines changed: 221 additions & 418 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"mustache": "^4.2.0",
102102
"nest-access-control": "^3.1.0",
103103
"nest-authz": "^2.11.0",
104+
"nest-commander": "^3.15.0",
104105
"nestjs-pino": "^4.1.0",
105106
"node-cache": "^5.1.2",
106107
"node-window-polyfill": "^1.0.2",
@@ -120,7 +121,6 @@
120121
"stoppable": "^1.1.0",
121122
"strftime": "^0.10.3",
122123
"systeminformation": "^5.23.5",
123-
"ts-command-line-args": "^2.5.1",
124124
"uuid": "^11.0.2",
125125
"ws": "^8.18.0",
126126
"xhr2": "^0.2.1",

api/src/__test__/cli/commands/report/anonymise-origins.test.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

api/src/__test__/cli/log-to-syslog.test.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

api/src/cli.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
#!/usr/bin/env node
22
import '@app/dotenv';
33

4-
import { main } from '@app/cli/index';
5-
import { internalLogger } from '@app/core/log';
4+
import { execSync } from 'child_process';
5+
6+
import { CommandFactory } from 'nest-commander';
7+
8+
import { cliLogger, internalLogger } from '@app/core/log';
9+
import { CliModule } from '@app/unraid-api/cli/cli.module';
610

711
try {
8-
await main();
12+
const shellToUse = execSync('which bash');
13+
await CommandFactory.run(CliModule, {
14+
cliName: 'unraid-api',
15+
logger: false,
16+
completion: {
17+
fig: true,
18+
cmd: 'unraid-api',
19+
nativeShell: { executablePath: shellToUse.toString('utf-8') },
20+
},
21+
});
922
} catch (error) {
10-
console.log(error);
23+
cliLogger.error('ERROR:', error);
1124
internalLogger.error({
1225
message: 'Failed to start unraid-api',
1326
error,

api/src/cli/commands/key.ts

Lines changed: 0 additions & 119 deletions
This file was deleted.

api/src/cli/commands/no-op.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)