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.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts
index c8a576844..54ea1264d 100644
--- a/server/tools/peertube-plugins.ts
+++ b/server/tools/peertube-plugins.ts
@@ -3,14 +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 { PluginType } from '../../shared/models/plugins/plugin.type'
8import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' 7import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins'
9import { getAdminTokenOrDie, getServerCredentials } from './cli' 8import { getAdminTokenOrDie, getServerCredentials } from './cli'
10import { PeerTubePlugin } from '../../shared/models/plugins/peertube-plugin.model' 9import { PeerTubePlugin, PluginType } from '../../shared/models'
11import { isAbsolute } from 'path' 10import { isAbsolute } from 'path'
12import * as CliTable3 from 'cli-table3' 11import * as CliTable3 from 'cli-table3'
13import commander = require('commander')
14 12
15program 13program
16 .name('plugins') 14 .name('plugins')
@@ -63,7 +61,7 @@ program.parse(process.argv)
63 61
64// ---------------------------------------------------------------------------- 62// ----------------------------------------------------------------------------
65 63
66async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 64async function pluginsListCLI (command: Command, options: OptionValues) {
67 const { url, username, password } = await getServerCredentials(command) 65 const { url, username, password } = await getServerCredentials(command)
68 const accessToken = await getAdminTokenOrDie(url, username, password) 66 const accessToken = await getAdminTokenOrDie(url, username, password)
69 67
@@ -102,7 +100,7 @@ async function pluginsListCLI (command: commander.CommanderStatic, options: comm
102 process.exit(0) 100 process.exit(0)
103} 101}
104 102
105async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 103async function installPluginCLI (command: Command, options: OptionValues) {
106 if (!options.path && !options.npmName) { 104 if (!options.path && !options.npmName) {
107 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')
108 program.outputHelp() 106 program.outputHelp()
@@ -133,7 +131,7 @@ async function installPluginCLI (command: commander.CommanderStatic, options: co
133 process.exit(0) 131 process.exit(0)
134} 132}
135 133
136async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 134async function updatePluginCLI (command: Command, options: OptionValues) {
137 if (!options.path && !options.npmName) { 135 if (!options.path && !options.npmName) {
138 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')
139 program.outputHelp() 137 program.outputHelp()
@@ -164,7 +162,7 @@ async function updatePluginCLI (command: commander.CommanderStatic, options: com
164 process.exit(0) 162 process.exit(0)
165} 163}
166 164
167async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { 165async function uninstallPluginCLI (command: Command, options: OptionValues) {
168 if (!options.npmName) { 166 if (!options.npmName) {
169 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')
170 program.outputHelp() 168 program.outputHelp()