aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/cli.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-13 13:59:34 +0200
committerChocobozzz <me@florianbigard.com>2019-06-17 08:16:09 +0200
commit6b226c32782ea7779ced56c1e1090d8b51c5c504 (patch)
tree529c9108d92d26dde650f89b0106b2c15dba79c8 /server/tools/cli.ts
parentb30acc0e4b2cf596704e5949c2d7020eccb7f720 (diff)
downloadPeerTube-6b226c32782ea7779ced56c1e1090d8b51c5c504.tar.gz
PeerTube-6b226c32782ea7779ced56c1e1090d8b51c5c504.tar.zst
PeerTube-6b226c32782ea7779ced56c1e1090d8b51c5c504.zip
Fix CLI default boolean values
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r--server/tools/cli.ts13
1 files changed, 10 insertions, 3 deletions
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) {
117} 117}
118 118
119async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any) { 119async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any) {
120 const booleanAttributes: { [id: string]: boolean } = {} 120 const defaultBooleanAttributes = {
121 nsfw: false,
122 commentsEnabled: true,
123 downloadEnabled: true,
124 waitTranscoding: true
125 }
126
127 const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {}
121 128
122 for (const key of [ 'nsfw', 'commentsEnabled', 'downloadEnabled', 'waitTranscoding' ]) { 129 for (const key of Object.keys(defaultBooleanAttributes)) {
123 if (command[ key ] !== undefined) { 130 if (command[ key ] !== undefined) {
124 booleanAttributes[key] = command[ key ] 131 booleanAttributes[key] = command[ key ]
125 } else if (defaultAttributes[key] !== undefined) { 132 } else if (defaultAttributes[key] !== undefined) {
126 booleanAttributes[key] = defaultAttributes[key] 133 booleanAttributes[key] = defaultAttributes[key]
127 } else { 134 } else {
128 booleanAttributes[key] = false 135 booleanAttributes[key] = defaultBooleanAttributes[key]
129 } 136 }
130 } 137 }
131 138