]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tools/peertube.ts
Update server dependencies
[github/Chocobozzz/PeerTube.git] / server / tools / peertube.ts
CommitLineData
8704acf4
RK
1#!/usr/bin/env node
2
a1587156
C
3/* eslint-disable no-useless-escape */
4
2aaa1a3f
C
5import { registerTSPaths } from '../helpers/register-ts-paths'
6registerTSPaths()
7
8704acf4 8import * as program from 'commander'
a1587156 9import { getSettings, version } from './cli'
8704acf4
RK
10
11program
499d9015 12 .version(version, '-v, --version')
8704acf4
RK
13 .usage('[command] [options]')
14
15/* Subcommands automatically loaded in the directory and beginning by peertube-* */
16program
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')
c141f68b 22 .command('repl', 'initiate a REPL to access internals')
9b474844 23 .command('plugins [action]', 'manage instance plugins/themes').alias('p')
26fcf2ef 24 .command('redundancy [action]', 'manage instance redundancies').alias('r')
8704acf4
RK
25
26/* Not Yet Implemented */
27program
a1587156
C
28 .command(
29 'diagnostic [action]',
30 'like couple therapy, but for your instance',
31 { noHelp: true } as program.CommandOptions
32 ).alias('d')
8704acf4 33 .command('admin',
a1587156
C
34 'manage an instance where you have elevated rights',
35 { noHelp: true } as program.CommandOptions
36 ).alias('a')
8704acf4
RK
37
38// help on no command
39if (!process.argv.slice(2).length) {
40 const logo = '░P░e░e░r░T░u░b░e░'
41 console.log(`
42 ___/),.._ ` + logo + `
43/' ,. ."'._
44( "' '-.__"-._ ,-
45\\'='='), "\\ -._-"-. -"/
46 / ""/"\\,_\\,__"" _" /,-
47 / / -" _/"/
48 / | ._\\\\ |\\ |_.".-" /
49 / | __\\)|)|),/|_." _,."
50 / \_." " ") | ).-""---''--
51 ( "/.""7__-""''
52 | " ."._--._
53 \\ \\ (_ __ "" ".,_
54 \\.,. \\ "" -"".-"
55 ".,_, (",_-,,,-".-
56 "'-,\\_ __,-"
57 ",)" ")
58 /"\\-"
59 ,"\\/
60 _,.__/"\\/_ (the CLI for red chocobos)
61 / \\) "./, ".
e5cb43e0 62 --/---"---" "-) )---- by Chocobozzz et al.\n`)
8704acf4
RK
63}
64
65getSettings()
66 .then(settings => {
1a12f66d
C
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'
70
8704acf4 71 program
ba5a8d89
C
72 .addHelpText('after', '\n\n State: ' + state + '\n\n' +
73 ' Examples:\n\n' +
74 ' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"\n' +
75 ' $ peertube up <videoFile>\n' +
76 ' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10\n'
77 )
8704acf4
RK
78 .parse(process.argv)
79 })
a1587156 80 .catch(err => console.error(err))