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