Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update commander #1636

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"axios": "1.6.0",
"class-transformer": "0.5.1",
"class-validator": "0.14.0",
"commander": "7.2.0",
"commander": "11.1.0",
"dayjs": "1.11.10",
"emoji-js": "3.7.0",
"fastify": "4.24.3",
Expand Down
14 changes: 7 additions & 7 deletions src/bin/hb-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as child_process from 'child_process';
import * as os from 'os';
import * as path from 'path';
import axios from 'axios';
import * as commander from 'commander';
import { program } from 'commander';
import * as fs from 'fs-extra';
import * as ora from 'ora';
import * as semver from 'semver';
Expand Down Expand Up @@ -87,7 +87,7 @@ export class HomebridgeServiceHelper {
process.exit(1);
}

commander
program
.allowUnknownOption()
.storeOptionsAsProperties(true)
.arguments('[install|uninstall|start|stop|restart|rebuild|run|logs|view|add|remove]')
Expand Down Expand Up @@ -139,7 +139,7 @@ export class HomebridgeServiceHelper {
}
case 'rebuild': {
this.logger(`Rebuilding for Node.js ${process.version}...`);
this.installer.rebuild(commander.args.includes('--all'));
this.installer.rebuild(program.args.includes('--all'));
break;
}
case 'run': {
Expand All @@ -155,15 +155,15 @@ export class HomebridgeServiceHelper {
break;
}
case 'add': {
this.npmPluginManagement(commander.args);
this.npmPluginManagement(program.args);
break;
}
case 'remove': {
this.npmPluginManagement(commander.args);
this.npmPluginManagement(program.args);
break;
}
case 'update-node': {
this.checkForNodejsUpdates(commander.args.length === 2 ? commander.args[1] : null);
this.checkForNodejsUpdates(program.args.length === 2 ? program.args[1] : null);
break;
}
case 'before-start': {
Expand All @@ -175,7 +175,7 @@ export class HomebridgeServiceHelper {
break;
}
default: {
commander.outputHelp();
program.outputHelp();

console.log('\nThe hb-service command is provided by homebridge-config-ui-x\n');
console.log('Please provide a command:');
Expand Down
4 changes: 2 additions & 2 deletions src/bin/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ process.title = 'homebridge-config-ui-x';

import * as os from 'os';
import * as path from 'path';
import * as commander from 'commander';
import { program } from 'commander';

commander
program
.allowUnknownOption()
.option('-U, --user-storage-path [path]', '', (p) => process.env.UIX_STORAGE_PATH = p)
.option('-P, --plugin-path [path]', '', (p) => process.env.UIX_CUSTOM_PLUGIN_PATH = p)
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as child_process from 'child_process';
import * as path from 'path';
import * as commander from 'commander';
import { program } from 'commander';
import * as semver from 'semver';

let homebridge;
Expand All @@ -19,7 +19,7 @@ class HomebridgeConfigUi {
process.env.UIX_STORAGE_PATH = homebridge.user.storagePath();
process.env.UIX_PLUGIN_NAME = config.name || 'homebridge-config-ui-x';

commander
program
.allowUnknownOption()
.option('-P, --plugin-path [path]', '', (p) => process.env.UIX_CUSTOM_PLUGIN_PATH = p)
.option('-I, --insecure', '', () => process.env.UIX_INSECURE_MODE = '1')
Expand Down