From bb8f7872f5a473c47a688b0c282ff34cd78a9835 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Jan 2019 11:01:40 +0100 Subject: [PATCH] Fix peertube CLI documentation --- server/tools/peertube-import-videos.ts | 14 +++++++++++--- support/doc/tools.md | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 2874a2131..f50aafc35 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -78,7 +78,11 @@ getSettings() password: program['password'] } - run(user, program['url']).catch(err => console.error(err)) + run(user, program['url']) + .catch(err => { + console.error(err) + process.exit(-1) + }) }) async function promptPassword () { @@ -112,8 +116,12 @@ async function run (user, url: string) { secret: res.body.client_secret } - const res2 = await login(url, client, user) - accessToken = res2.body.access_token + try { + const res = await login(program[ 'url' ], client, user) + accessToken = res.body.access_token + } catch (err) { + throw new Error('Cannot authenticate. Please check your username/password.') + } const youtubeDL = await safeGetYoutubeDL() diff --git a/support/doc/tools.md b/support/doc/tools.md index 4f806a9db..1a9ba7d2b 100644 --- a/support/doc/tools.md +++ b/support/doc/tools.md @@ -59,7 +59,8 @@ $ npm run build:server ### CLI wrapper -The wrapper provides a convenient interface to the following scripts. You can access it as `peertube` via an alias in your `.bashrc` like `alias peertube="node /your/peertube/directory/dist/server/tools/peertube.js"`: +The wrapper provides a convenient interface to the following scripts. +You can access it as `peertube` via an alias in your `.bashrc` like `alias peertube="cd /your/peertube/directory/ && node ./dist/server/tools/peertube.js"` (you have to keep the `cd` command): ``` Usage: peertube [command] [options] -- 2.25.1