« get me outta code hell

let client specify host through command line - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-07-11 17:50:24 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 19:03:06 -0300
commit50a70ed6a332ec1e8a2e17ca94e74252e1a8cdcb (patch)
treea0881a782d6fc44fc9e571e409f20ae0c18b0129
parentf88d7c4959e7603714a5bb8f25807889a25304ee (diff)
let client specify host through command line
-rwxr-xr-xindex.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/index.js b/index.js
index 97b9504..2c352cd 100755
--- a/index.js
+++ b/index.js
@@ -190,7 +190,10 @@ async function main() {
 
   if (options['socket-client']) {
     socketClient = makeSocketClient()
-    socketClient.socket.connect(options['socket-client'])
+    const [ p1, p2 ] = options['socket-client'].split(':')
+    const host = p2 && p1
+    const port = p2 ? p2 : p1
+    socketClient.socket.connect(port, host)
   }
 
   if (socketClient) {