add --host and --port flags

This commit is contained in:
onyx-and-iris 2025-06-30 16:00:49 +01:00
parent 345a317bcb
commit c908147e60
2 changed files with 17 additions and 5 deletions

View File

@ -9,12 +9,12 @@ import { audioHelp, audioMute, audioUnmute, audioToggle, audioStatus } from './u
import { streamHelp, streamStart, streamStop, streamStatus } from './utils/stream.js' import { streamHelp, streamStart, streamStop, streamStatus } from './utils/stream.js'
import { recordHelp, recordStart, recordStop, recordStatus } from './utils/record.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 input = cli.input
const flags = cli.flags 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}`) const socket = new WebSocket(`ws://${address}:${port}`)
socket.onopen = function () { socket.onopen = function () {

View File

@ -17,15 +17,27 @@ const commands = {
} }
const flags = { 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: { help: {
type: 'boolean', type: 'boolean',
shortFlag: 'h', shortFlag: 'h',
description: 'Display help information' desc: 'Display help information'
}, },
version: { version: {
type: 'boolean', type: 'boolean',
shortFlag: 'v', shortFlag: 'v',
description: 'Display the version number' desc: 'Display the version number'
} }
} }