From c908147e6069b5a554e9e1c38ea5f6a738982877 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 30 Jun 2025 16:00:49 +0100 Subject: [PATCH] add --host and --port flags --- index.js | 6 +++--- utils/cli.js | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index ea606d3..8b0e29a 100755 --- a/index.js +++ b/index.js @@ -9,12 +9,12 @@ import { audioHelp, audioMute, audioUnmute, audioToggle, audioStatus } from './u import { streamHelp, streamStart, streamStop, streamStatus } from './utils/stream.js' import { recordHelp, recordStart, recordStop, recordStatus } from './utils/record.js' -const address = process.env.MELD_CLI_HOST || 'localhost' -const port = process.env.MELD_CLI_PORT || 13376 - const input = cli.input const flags = cli.flags +const address = flags.host || process.env.MELD_CLI_HOST || 'localhost' +const port = flags.port || process.env.MELD_CLI_PORT || 13376 + const socket = new WebSocket(`ws://${address}:${port}`) socket.onopen = function () { diff --git a/utils/cli.js b/utils/cli.js index 8a12fcb..c4c7ae8 100644 --- a/utils/cli.js +++ b/utils/cli.js @@ -17,15 +17,27 @@ const commands = { } const flags = { + host: { + type: 'string', + shortFlag: 'H', + default: 'localhost', + desc: 'Host address for the Meld server' + }, + port: { + type: 'number', + shortFlag: 'P', + default: 13376, + desc: 'Port number for the Meld server' + }, help: { type: 'boolean', shortFlag: 'h', - description: 'Display help information' + desc: 'Display help information' }, version: { type: 'boolean', shortFlag: 'v', - description: 'Display the version number' + desc: 'Display the version number' } }