3 import * as program from 'commander'
10 .version(version, '-v, --version')
11 .usage('[command] [options]')
13 /* Subcommands automatically loaded in the directory and beginning by peertube-* */
15 .command('auth [action]', 'register your accounts on remote instances to use them with other commands')
16 .command('upload', 'upload a video').alias('up')
17 .command('import-videos', 'import a video from a streaming platform').alias('import')
18 .command('get-access-token', 'get a peertube access token', { noHelp: true }).alias('token')
19 .command('watch', 'watch a video in the terminal ✩°。⋆').alias('w')
20 .command('repl', 'initiate a REPL to access internals')
22 /* Not Yet Implemented */
24 .command('plugins [action]',
25 'manage plugins on a local instance',
26 { noHelp: true } as program.CommandOptions
28 .command('diagnostic [action]',
29 'like couple therapy, but for your instance',
30 { noHelp: true } as program.CommandOptions
33 'manage an instance where you have elevated rights',
34 { noHelp: true } as program.CommandOptions
38 if (!process.argv.slice(2).length) {
39 const logo = '░P░e░e░r░T░u░b░e░'
41 ___/),.._ ` + logo + `
44 \\'='='), "\\ -._-"-. -"/
45 / ""/"\\,_\\,__"" _" /,-
47 / | ._\\\\ |\\ |_.".-" /
48 / | __\\)|)|),/|_." _,."
49 / \_." " ") | ).-""---''--
59 _,.__/"\\/_ (the CLI for red chocobos)
61 --/---"---" "-) )---- by Chocobozzz et al.\n`)
66 const state = (settings.default === undefined || settings.default === -1) ?
67 'no instance selected, commands will require explicit arguments' :
68 ('instance ' + settings.remotes[settings.default] + ' selected')
70 .on('--help', function () {
72 console.log(' State: ' + state)
74 console.log(' Examples:')
76 console.log(' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"')
77 console.log(' $ peertube up <videoFile>')
78 console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')