X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube.ts;h=655f07f0c86a59a9691ff13a841fcb57cb611c13;hb=3b54e5902a54c99c2968383e967370ae17bbba03;hp=ad76bafb4063411070d2974282d5cb48aa0ed61f;hpb=499d9015955c0cedd094fbe814dee6235e639627;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube.ts b/server/tools/peertube.ts old mode 100755 new mode 100644 index ad76bafb4..655f07f0c --- a/server/tools/peertube.ts +++ b/server/tools/peertube.ts @@ -1,10 +1,12 @@ #!/usr/bin/env node +/* eslint-disable no-useless-escape */ + +import { registerTSPaths } from '../helpers/register-ts-paths' +registerTSPaths() + import * as program from 'commander' -import { - version, - getSettings -} from './cli' +import { getSettings, version } from './cli' program .version(version, '-v, --version') @@ -17,21 +19,21 @@ program .command('import-videos', 'import a video from a streaming platform').alias('import') .command('get-access-token', 'get a peertube access token', { noHelp: true }).alias('token') .command('watch', 'watch a video in the terminal ✩°。⋆').alias('w') + .command('repl', 'initiate a REPL to access internals') + .command('plugins [action]', 'manage instance plugins/themes').alias('p') + .command('redundancy [action]', 'manage instance redundancies').alias('r') /* Not Yet Implemented */ program - .command('plugins [action]', - 'manage plugins on a local instance', - { noHelp: true } as program.CommandOptions - ).alias('p') - .command('diagnostic [action]', - 'like couple therapy, but for your instance', - { noHelp: true } as program.CommandOptions - ).alias('d') + .command( + 'diagnostic [action]', + 'like couple therapy, but for your instance', + { noHelp: true } as program.CommandOptions + ).alias('d') .command('admin', - 'manage an instance where you have elevated rights', - { noHelp: true } as program.CommandOptions - ).alias('a') + 'manage an instance where you have elevated rights', + { noHelp: true } as program.CommandOptions + ).alias('a') // help on no command if (!process.argv.slice(2).length) { @@ -57,25 +59,22 @@ if (!process.argv.slice(2).length) { ,"\\/ _,.__/"\\/_ (the CLI for red chocobos) / \\) "./, ". - --/---"---" "-) )---- by Chocobozzz et al.`) + --/---"---" "-) )---- by Chocobozzz et al.\n`) } getSettings() .then(settings => { - const state = (settings.default === undefined || settings.default === -1) ? - 'no instance selected, commands will require explicit arguments' : - ('instance ' + settings.remotes[settings.default] + ' selected') + const state = (settings.default === undefined || settings.default === -1) + ? 'no instance selected, commands will require explicit arguments' + : 'instance ' + settings.remotes[settings.default] + ' selected' + program - .on('--help', function () { - console.log() - console.log(' State: ' + state) - console.log() - console.log(' Examples:') - console.log() - console.log(' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"') - console.log(' $ peertube up ') - console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10') - console.log() - }) + .addHelpText('after', '\n\n State: ' + state + '\n\n' + + ' Examples:\n\n' + + ' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"\n' + + ' $ peertube up \n' + + ' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10\n' + ) .parse(process.argv) }) + .catch(err => console.error(err))