diff options
Diffstat (limited to 'scripts/plugin')
-rwxr-xr-x | scripts/plugin/install.ts | 10 | ||||
-rwxr-xr-x | scripts/plugin/uninstall.ts | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts index 54738f50f..2ea8a658b 100755 --- a/scripts/plugin/install.ts +++ b/scripts/plugin/install.ts | |||
@@ -12,12 +12,14 @@ program | |||
12 | .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') | 12 | .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') |
13 | .parse(process.argv) | 13 | .parse(process.argv) |
14 | 14 | ||
15 | if (!program['npmName'] && !program['pluginPath']) { | 15 | const options = program.opts() |
16 | |||
17 | if (!options.npmName && !options.pluginPath) { | ||
16 | console.error('You need to specify a plugin name with the desired version, or a plugin path.') | 18 | console.error('You need to specify a plugin name with the desired version, or a plugin path.') |
17 | process.exit(-1) | 19 | process.exit(-1) |
18 | } | 20 | } |
19 | 21 | ||
20 | if (program['pluginPath'] && !isAbsolute(program['pluginPath'])) { | 22 | if (options.pluginPath && !isAbsolute(options.pluginPath)) { |
21 | console.error('Plugin path should be absolute.') | 23 | console.error('Plugin path should be absolute.') |
22 | process.exit(-1) | 24 | process.exit(-1) |
23 | } | 25 | } |
@@ -32,6 +34,6 @@ run() | |||
32 | async function run () { | 34 | async function run () { |
33 | await initDatabaseModels(true) | 35 | await initDatabaseModels(true) |
34 | 36 | ||
35 | const toInstall = program['npmName'] || program['pluginPath'] | 37 | const toInstall = options.npmName || options.pluginPath |
36 | await PluginManager.Instance.install(toInstall, program['pluginVersion'], !!program['pluginPath']) | 38 | await PluginManager.Instance.install(toInstall, options.pluginVersion, !!options.pluginPath) |
37 | } | 39 | } |
diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts index c56f18466..8710b1750 100755 --- a/scripts/plugin/uninstall.ts +++ b/scripts/plugin/uninstall.ts | |||
@@ -9,7 +9,9 @@ program | |||
9 | .option('-n, --npm-name [npmName]', 'Package name to install') | 9 | .option('-n, --npm-name [npmName]', 'Package name to install') |
10 | .parse(process.argv) | 10 | .parse(process.argv) |
11 | 11 | ||
12 | if (!program['npmName']) { | 12 | const options = program.opts() |
13 | |||
14 | if (!options.npmName) { | ||
13 | console.error('You need to specify the plugin name.') | 15 | console.error('You need to specify the plugin name.') |
14 | process.exit(-1) | 16 | process.exit(-1) |
15 | } | 17 | } |
@@ -25,6 +27,6 @@ async function run () { | |||
25 | 27 | ||
26 | await initDatabaseModels(true) | 28 | await initDatabaseModels(true) |
27 | 29 | ||
28 | const toUninstall = program['npmName'] | 30 | const toUninstall = options.npmName |
29 | await PluginManager.Instance.uninstall(toUninstall) | 31 | await PluginManager.Instance.uninstall(toUninstall) |
30 | } | 32 | } |