diff options
Diffstat (limited to 'server/tools/peertube-plugins.ts')
-rw-r--r-- | server/tools/peertube-plugins.ts | 14 |
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 @@ | |||
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 { PluginType } from '../../shared/models/plugins/plugin.type' | ||
8 | import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' | 7 | import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins' |
9 | import { getAdminTokenOrDie, getServerCredentials } from './cli' | 8 | import { getAdminTokenOrDie, getServerCredentials } from './cli' |
10 | import { PeerTubePlugin } from '../../shared/models/plugins/peertube-plugin.model' | 9 | import { PeerTubePlugin, PluginType } from '../../shared/models' |
11 | import { isAbsolute } from 'path' | 10 | import { isAbsolute } from 'path' |
12 | import * as CliTable3 from 'cli-table3' | 11 | import * as CliTable3 from 'cli-table3' |
13 | import commander = require('commander') | ||
14 | 12 | ||
15 | program | 13 | program |
16 | .name('plugins') | 14 | .name('plugins') |
@@ -63,7 +61,7 @@ program.parse(process.argv) | |||
63 | 61 | ||
64 | // ---------------------------------------------------------------------------- | 62 | // ---------------------------------------------------------------------------- |
65 | 63 | ||
66 | async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 64 | async 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 | ||
105 | async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 103 | async 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 | ||
136 | async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 134 | async 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 | ||
167 | async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) { | 165 | async 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() |