From 6b226c32782ea7779ced56c1e1090d8b51c5c504 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 13 Jun 2019 13:59:34 +0200 Subject: Fix CLI default boolean values --- server/tools/cli.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'server/tools/cli.ts') diff --git a/server/tools/cli.ts b/server/tools/cli.ts index 4aa3d9ce8..2eec51aa4 100644 --- a/server/tools/cli.ts +++ b/server/tools/cli.ts @@ -117,15 +117,22 @@ function buildCommonVideoOptions (command: Command) { } async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any) { - const booleanAttributes: { [id: string]: boolean } = {} + const defaultBooleanAttributes = { + nsfw: false, + commentsEnabled: true, + downloadEnabled: true, + waitTranscoding: true + } + + const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {} - for (const key of [ 'nsfw', 'commentsEnabled', 'downloadEnabled', 'waitTranscoding' ]) { + for (const key of Object.keys(defaultBooleanAttributes)) { if (command[ key ] !== undefined) { booleanAttributes[key] = command[ key ] } else if (defaultAttributes[key] !== undefined) { booleanAttributes[key] = defaultAttributes[key] } else { - booleanAttributes[key] = false + booleanAttributes[key] = defaultBooleanAttributes[key] } } -- cgit v1.2.3