mirror of
https://github.com/onyx-and-iris/meld-cli.git
synced 2025-07-12 10:21:45 +00:00
add --host and --port flags
This commit is contained in:
parent
345a317bcb
commit
c908147e60
6
index.js
6
index.js
@ -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 () {
|
||||||
|
16
utils/cli.js
16
utils/cli.js
@ -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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user