X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fcli.ts;h=d5416fc3870a8e24291881f1c8090a411deb10da;hb=99fa5c5badd4f4d35a1d55c80b0102ee1c4e71cd;hp=7658eddce5281b7df222408fc3bccf0f88efa454;hpb=ded739eb381565aafcf2de81356eb34234fa027d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/cli.ts b/server/tools/cli.ts index 7658eddce..d5416fc38 100644 --- a/server/tools/cli.ts +++ b/server/tools/cli.ts @@ -35,19 +35,17 @@ interface Settings { default: number } -function getSettings () { - return new Promise((res, rej) => { - const defaultSettings = { - remotes: [], - default: -1 - } +async function getSettings (): Promise { + const defaultSettings = { + remotes: [], + default: -1 + } - config.read((err, data) => { - if (err) return rej(err) + const data = await config.read() - return res(Object.keys(data).length === 0 ? defaultSettings : data) - }) - }) + return Object.keys(data).length === 0 + ? defaultSettings + : data } async function getNetrc () { @@ -62,24 +60,12 @@ async function getNetrc () { return netrc } -function writeSettings (settings) { - return new Promise((res, rej) => { - config.write(settings, err => { - if (err) return rej(err) - - return res() - }) - }) +function writeSettings (settings: Settings) { + return config.write(settings) } function deleteSettings () { - return new Promise((res, rej) => { - config.trash((err) => { - if (err) return rej(err) - - return res() - }) - }) + return config.trash() } function getRemoteObjectOrDie ( @@ -133,9 +119,10 @@ function buildCommonVideoOptions (command: CommanderStatic) { .option('-d, --video-description ', 'Video description') .option('-P, --privacy ', 'Privacy') .option('-C, --channel-name ', 'Channel name') - .option('-m, --comments-enabled', 'Enable comments') + .option('--no-comments-enabled', 'Disable video comments') .option('-s, --support ', 'Video support text') - .option('-w, --wait-transcoding', 'Wait transcoding before publishing the video') + .option('--no-wait-transcoding', 'Do not wait transcoding before publishing the video') + .option('--no-download-enabled', 'Disable video download') .option('-v, --verbose ', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info') } @@ -227,7 +214,6 @@ function getLogger (logLevel = 'info') { export { version, - config, getLogger, getSettings, getNetrc,