]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tools/peertube.ts
improve description of the HTTP video import feature
[github/Chocobozzz/PeerTube.git] / server / tools / peertube.ts
CommitLineData
8704acf4
RK
1#!/usr/bin/env node
2
3import * as program from 'commander'
4import {
5 version,
6 getSettings
7} from './cli'
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')
19 .command('watch', 'watch a video in the terminal ✩°。⋆').alias('w')
20
21/* Not Yet Implemented */
22program
23 .command('plugins [action]',
24 'manage plugins on a local instance',
25 { noHelp: true } as program.CommandOptions
26 ).alias('p')
27 .command('diagnostic [action]',
28 'like couple therapy, but for your instance',
29 { noHelp: true } as program.CommandOptions
30 ).alias('d')
31 .command('admin',
32 'manage an instance where you have elevated rights',
33 { noHelp: true } as program.CommandOptions
34 ).alias('a')
35
36// help on no command
37if (!process.argv.slice(2).length) {
38 const logo = '░P░e░e░r░T░u░b░e░'
39 console.log(`
40 ___/),.._ ` + logo + `
41/' ,. ."'._
42( "' '-.__"-._ ,-
43\\'='='), "\\ -._-"-. -"/
44 / ""/"\\,_\\,__"" _" /,-
45 / / -" _/"/
46 / | ._\\\\ |\\ |_.".-" /
47 / | __\\)|)|),/|_." _,."
48 / \_." " ") | ).-""---''--
49 ( "/.""7__-""''
50 | " ."._--._
51 \\ \\ (_ __ "" ".,_
52 \\.,. \\ "" -"".-"
53 ".,_, (",_-,,,-".-
54 "'-,\\_ __,-"
55 ",)" ")
56 /"\\-"
57 ,"\\/
58 _,.__/"\\/_ (the CLI for red chocobos)
59 / \\) "./, ".
60 --/---"---" "-) )---- by Chocobozzz et al.`)
61}
62
63getSettings()
64 .then(settings => {
5c142a4b 65 const state = (settings.default === undefined || settings.default === -1) ?
8704acf4
RK
66 'no instance selected, commands will require explicit arguments' :
67 ('instance ' + settings.remotes[settings.default] + ' selected')
68 program
69 .on('--help', function () {
70 console.log()
71 console.log(' State: ' + state)
72 console.log()
73 console.log(' Examples:')
74 console.log()
75 console.log(' $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"')
76 console.log(' $ peertube up <videoFile>')
77 console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')
78 console.log()
79 })
80 .parse(process.argv)
81 })