]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tools/peertube.ts
3 /* eslint-disable no-useless-escape */
5 import { registerTSPaths
} from '../helpers/register-ts-paths'
8 import * as program
from 'commander'
9 import { getSettings
, version
} from './cli'
12 .version(version
, '-v, --version')
13 .usage('[command] [options]')
15 /* Subcommands automatically loaded in the directory and beginning by peertube-* */
17 .command('auth [action]', 'register your accounts on remote instances to use them with other commands')
18 .command('upload', 'upload a video').alias('up')
19 .command('import-videos', 'import a video from a streaming platform').alias('import')
20 .command('get-access-token', 'get a peertube access token', { noHelp: true }).alias('token')
21 .command('watch', 'watch a video in the terminal ✩°。⋆').alias('w')
22 .command('repl', 'initiate a REPL to access internals')
23 .command('plugins [action]', 'manage instance plugins/themes').alias('p')
24 .command('redundancy [action]', 'manage instance redundancies').alias('r')
26 /* Not Yet Implemented */
29 'diagnostic [action]',
30 'like couple therapy, but for your instance',
31 { noHelp: true } as program
.CommandOptions
34 'manage an instance where you have elevated rights',
35 { noHelp: true } as program
.CommandOptions
39 if (!process
.argv
.slice(2).length
) {
40 const logo
= '░P░e░e░r░T░u░b░e░'
42 ___/),.._ ` + logo
+ `
45 \\'='='), "\\ -._-"-. -"/
46 / ""/"\\,_\\,__"" _" /,-
48 / | ._\\\\ |\\ |_.".-" /
49 / | __\\)|)|),/|_." _,."
50 / \_." " ") | ).-""---''--
60 _,.__/"\\/_ (the CLI for red chocobos)
62 --/---"---" "-) )---- by Chocobozzz et al.\n`)
67 const state
= (settings
.default === undefined || settings
.default === -1)
68 ? 'no instance selected, commands will require explicit arguments'
69 : 'instance ' + settings
.remotes
[settings
.default] + ' selected'
72 .on('--help', function () {
74 console
.log(' State: ' + state
)
76 console
.log(' Examples:')
78 console
.log(' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"')
79 console
.log(' $ peertube up <videoFile>')
80 console
.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')
85 .catch(err
=> console
.error(err
))