diff options
Diffstat (limited to 'server/tools/peertube-plugins.ts')
-rw-r--r-- | server/tools/peertube-plugins.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts index cb591377b..54ea1264d 100644 --- a/server/tools/peertube-plugins.ts +++ b/server/tools/peertube-plugins.ts | |||
@@ -3,13 +3,12 @@ | |||
3 | import { registerTSPaths } from '../helpers/register-ts-paths' | 3 | import { registerTSPaths } from '../helpers/register-ts-paths' |
4 | registerTSPaths() | 4 | registerTSPaths() |
5 | 5 | ||
6 | import * as program from 'commander' | 6 | import { program, Command, OptionValues } from 'commander' |
7 | import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' | 7 | import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' |
8 | import { getAdminTokenOrDie, getServerCredentials } from './cli' | 8 | import { getAdminTokenOrDie, getServerCredentials } from './cli' |
9 | import { PeerTubePlugin, PluginType } from '../../shared/models' | 9 | import { PeerTubePlugin, PluginType } from '../../shared/models' |
10 | import { isAbsolute } from 'path' | 10 | import { isAbsolute } from 'path' |
11 | import * as CliTable3 from 'cli-table3' | 11 | import * as CliTable3 from 'cli-table3' |
12 | import commander = require('commander') | ||
13 | 12 | ||
14 | program | 13 | program |
15 | .name('plugins') | 14 | .name('plugins') |
@@ -62,7 +61,7 @@ program.parse(process.argv) | |||
62 | 61 | ||
63 | // ---------------------------------------------------------------------------- | 62 | // ---------------------------------------------------------------------------- |
64 | 63 | ||
65 | async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 64 | async function pluginsListCLI (command: Command, options: OptionValues) { |
66 | const { url, username, password } = await getServerCredentials(command) | 65 | const { url, username, password } = await getServerCredentials(command) |
67 | const accessToken = await getAdminTokenOrDie(url, username, password) | 66 | const accessToken = await getAdminTokenOrDie(url, username, password) |
68 | 67 | ||
@@ -101,7 +100,7 @@ async function pluginsListCLI (command: commander.CommanderStatic, options: comm | |||
101 | process.exit(0) | 100 | process.exit(0) |
102 | } | 101 | } |
103 | 102 | ||
104 | async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 103 | async function installPluginCLI (command: Command, options: OptionValues) { |
105 | if (!options.path && !options.npmName) { | 104 | if (!options.path && !options.npmName) { |
106 | console.error('You need to specify the npm name or the path of the plugin you want to install.\n') | 105 | console.error('You need to specify the npm name or the path of the plugin you want to install.\n') |
107 | program.outputHelp() | 106 | program.outputHelp() |
@@ -132,7 +131,7 @@ async function installPluginCLI (command: commander.CommanderStatic, options: co | |||
132 | process.exit(0) | 131 | process.exit(0) |
133 | } | 132 | } |
134 | 133 | ||
135 | async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 134 | async function updatePluginCLI (command: Command, options: OptionValues) { |
136 | if (!options.path && !options.npmName) { | 135 | if (!options.path && !options.npmName) { |
137 | console.error('You need to specify the npm name or the path of the plugin you want to update.\n') | 136 | console.error('You need to specify the npm name or the path of the plugin you want to update.\n') |
138 | program.outputHelp() | 137 | program.outputHelp() |
@@ -163,7 +162,7 @@ async function updatePluginCLI (command: commander.CommanderStatic, options: com | |||
163 | process.exit(0) | 162 | process.exit(0) |
164 | } | 163 | } |
165 | 164 | ||
166 | async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 165 | async function uninstallPluginCLI (command: Command, options: OptionValues) { |
167 | if (!options.npmName) { | 166 | if (!options.npmName) { |
168 | console.error('You need to specify the npm name of the plugin/theme you want to uninstall.\n') | 167 | console.error('You need to specify the npm name of the plugin/theme you want to uninstall.\n') |
169 | program.outputHelp() | 168 | program.outputHelp() |