aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-plugins.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/peertube-plugins.ts')
-rw-r--r--server/tools/peertube-plugins.ts11
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 @@
3import { registerTSPaths } from '../helpers/register-ts-paths' 3import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths() 4registerTSPaths()
5 5
6import * as program from 'commander' 6import { program, Command, OptionValues } from 'commander'
7import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' 7import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins'
8import { getAdminTokenOrDie, getServerCredentials } from './cli' 8import { getAdminTokenOrDie, getServerCredentials } from './cli'
9import { PeerTubePlugin, PluginType } from '../../shared/models' 9import { PeerTubePlugin, PluginType } from '../../shared/models'
10import { isAbsolute } from 'path' 10import { isAbsolute } from 'path'
11import * as CliTable3 from 'cli-table3' 11import * as CliTable3 from 'cli-table3'
12import commander = require('commander')
13 12
14program 13program
15 .name('plugins') 14 .name('plugins')
@@ -62,7 +61,7 @@ program.parse(process.argv)
62 61
63// ---------------------------------------------------------------------------- 62// ----------------------------------------------------------------------------
64 63
65async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 64async 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
104async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 103async 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
135async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 134async 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
166async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 165async 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()