X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Freset-password.ts;h=7e7de6b8ae9e355dcf79b40fc7d18d7b8bf5525b;hb=9a911038d9ac38bf590e9199b3b7477ebf91de19;hp=863537500a55fb61dbbeb91d15d3204ab5a2323e;hpb=80fdaf064562aff968f4c9cea1cf220bc12a70da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 863537500..7e7de6b8a 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts @@ -10,25 +10,27 @@ program .option('-u, --user [user]', 'User') .parse(process.argv) -if (program['user'] === undefined) { +const options = program.opts() + +if (options.user === undefined) { console.error('All parameters are mandatory.') process.exit(-1) } initDatabaseModels(true) .then(() => { - return UserModel.loadByUsername(program['user']) + return UserModel.loadByUsername(options.user) }) .then(user => { if (!user) { - console.error('User unknown.') + console.error('Unknown user.') process.exit(-1) } const readline = require('readline') const Writable = require('stream').Writable const mutableStdout = new Writable({ - write: function (chunk, encoding, callback) { + write: function (_chunk, _encoding, callback) { callback() } }) @@ -53,3 +55,7 @@ initDatabaseModels(true) .finally(() => process.exit(0)) }) }) + .catch(err => { + console.error(err) + process.exit(-1) + })