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