]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/cli.ts
Fix theater mode
[github/Chocobozzz/PeerTube.git] / server / tools / cli.ts
index 7658eddce5281b7df222408fc3bccf0f88efa454..d5416fc3870a8e24291881f1c8090a411deb10da 100644 (file)
@@ -35,19 +35,17 @@ interface Settings {
   default: number
 }
 
-function getSettings () {
-  return new Promise<Settings>((res, rej) => {
-    const defaultSettings = {
-      remotes: [],
-      default: -1
-    }
+async function getSettings (): Promise<Settings> {
+  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 <description>', 'Video description')
     .option('-P, --privacy <privacy_number>', 'Privacy')
     .option('-C, --channel-name <channel_name>', 'Channel name')
-    .option('-m, --comments-enabled', 'Enable comments')
+    .option('--no-comments-enabled', 'Disable video comments')
     .option('-s, --support <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 <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info')
 }
 
@@ -227,7 +214,6 @@ function getLogger (logLevel = 'info') {
 
 export {
   version,
-  config,
   getLogger,
   getSettings,
   getNetrc,