From 7cf3e57376422e890e9703b68107e6f568a11384 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 20 Oct 2018 19:15:41 +0200 Subject: [PATCH] (doc) add manpage to peertube cli --- package.json | 2 + scripts/generate-cli-doc.sh | 5 +++ server/tools/README.md | 82 +++++++++++++++++++++++++++++++++++++ yarn.lock | 9 +++- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100755 scripts/generate-cli-doc.sh create mode 100644 server/tools/README.md diff --git a/package.json b/package.json index 0798fdba2..bc514920d 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "test": "scripty", "help": "scripty", "generate-api-doc": "scripty", + "generate-cli-doc": "scripty", "parse-log": "node ./dist/scripts/parse-log.js", "prune-storage": "node ./dist/scripts/prune-storage.js", "optimize-old-videos": "node ./dist/scripts/optimize-old-videos.js", @@ -119,6 +120,7 @@ "jsonld-signatures": "https://github.com/Chocobozzz/jsonld-signatures#rsa2017", "lodash": "^4.17.10", "magnet-uri": "^5.1.4", + "marked-man": "^0.2.1", "memoizee": "^0.4.14", "morgan": "^1.5.3", "multer": "^1.1.0", diff --git a/scripts/generate-cli-doc.sh b/scripts/generate-cli-doc.sh new file mode 100755 index 000000000..0d00f183b --- /dev/null +++ b/scripts/generate-cli-doc.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -eu + +node_modules/marked-man/bin/marked-man server/tools/README.md > dist/server/tools/peertube.8 diff --git a/server/tools/README.md b/server/tools/README.md new file mode 100644 index 000000000..6b94d74e5 --- /dev/null +++ b/server/tools/README.md @@ -0,0 +1,82 @@ +peertube(8) -- companion CLI for PeerTube +========================================= + +SYNOPSIS +-------- + +``` +peertube [command] [options] +``` + +DESCRIPTION +----------- + +`peertube` wraps various utilities around PeerTube that are used either on a running local, running remote, or cold local instance. + +COMMANDS +-------- + +Unless otherwise specified, every command can be queried for its own help or manual by passing its name to the `help` command, or by using the `--help` option. + +`auth [action]`: stores credentials for your accounts on remote instances so that you don't need to pass them at every command + +`upload|up`: upload a video to a remote instance + + $ peertube upload \ + -u "PEERTUBE_URL" \ + -U "PEERTUBE_USER" \ + --password "PEERTUBE_PASSWORD" + +`import-videos|import`: import a video from a streaming platform to a remote instance + + $ peertube import \ + -u "PEERTUBE_URL" \ + -U "PEERTUBE_USER" \ + --password "PEERTUBE_PASSWORD" \ + -t "TARGET_URL" + + The target URL can be directly the video file, or any of the supported sites of youtube-dl. The video is downloaded locally and then uploaded. Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection… + +`watch|w`: watch a video in the terminal ✩°。⋆ + + -g, --gui player type (default: ascii) + -i, --invert invert colors (ascii player only) + -r, --resolution video resolution (default: 720) + + It provides support for different players: + + - ascii (default ; plays in ascii art in your terminal!) + - mpv + - mplayer + - vlc + - stdout + - xbmc + - airplay + - chromecast + +`repl`: interact with the application libraries and objects even when PeerTube is not running + + Type .help to see the repl-only functions, or to see the available PeerTube core functions: + + repl> lodash.keys(context) + +`help [cmd]`: display help for [cmd] + +EXAMPLES +-------- + + $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" + $ peertube up + $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10 + +SEE ALSO +-------- + +[PeerTube Tools Documentation](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/tools.md) + +[PeerTube Admin Documentation](https://docs.joinpeertube.org/lang/en/docs/) + +REPORTING BUGS +-------------- + +See [PeerTube repository](https://github.com/Chocobozzz/PeerTube). diff --git a/yarn.lock b/yarn.lock index a0fec9b5f..2478a0664 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5885,7 +5885,14 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -marked@^0.3.5: +marked-man@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/marked-man/-/marked-man-0.2.1.tgz#f259271481de3b507263489f5221b7c5acfd2383" + integrity sha1-8lknFIHeO1ByY0ifUiG3xaz9I4M= + dependencies: + marked "^0.3.2" + +marked@^0.3.2, marked@^0.3.5: version "0.3.19" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==