import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
-import * as program from 'commander'
+import { program, Command, OptionValues } from 'commander'
import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins'
import { getAdminTokenOrDie, getServerCredentials } from './cli'
import { PeerTubePlugin, PluginType } from '../../shared/models'
import { isAbsolute } from 'path'
import * as CliTable3 from 'cli-table3'
-import commander = require('commander')
program
.name('plugins')
// ----------------------------------------------------------------------------
-async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
+async function pluginsListCLI (command: Command, options: OptionValues) {
const { url, username, password } = await getServerCredentials(command)
const accessToken = await getAdminTokenOrDie(url, username, password)
process.exit(0)
}
-async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
+async function installPluginCLI (command: Command, options: OptionValues) {
if (!options.path && !options.npmName) {
console.error('You need to specify the npm name or the path of the plugin you want to install.\n')
program.outputHelp()
process.exit(0)
}
-async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
+async function updatePluginCLI (command: Command, options: OptionValues) {
if (!options.path && !options.npmName) {
console.error('You need to specify the npm name or the path of the plugin you want to update.\n')
program.outputHelp()
process.exit(0)
}
-async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
+async function uninstallPluginCLI (command: Command, options: OptionValues) {
if (!options.npmName) {
console.error('You need to specify the npm name of the plugin/theme you want to uninstall.\n')
program.outputHelp()