« 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
committerFlorrie <towerofnix@gmail.com>2020-07-11 17:50:24 -0300
commit5c827bc31679115616cb3bc80774099edf4cc167 (patch)
treee07e09535f5ee3cdcf222e700696e2ade9858413
parent07fb4b2d4a59319ab5ba03d842274aba8182c412 (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 03b5bb1..6e83e8a 100755
--- a/index.js
+++ b/index.js
@@ -160,7 +160,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) {