contact
Version:
private, one-to-one or many-to-many command line chat
35 lines (31 loc) • 845 B
JavaScript
import CliApp from './cli-app.js'
import fromTo from 'array-from-to'
import util from 'node:util'
util.inspect.defaultOptions.depth = 6
util.inspect.defaultOptions.breakLength = process.stdout.columns
util.inspect.defaultOptions.maxArrayLength = Infinity
util.inspect.defaultOptions.maxStringLength = Infinity
const url = process.argv[2] || 'http://127.0.0.1:9000'
const validCommands = [
'/join',
'/nick'
]
const args = process.argv.slice(3)
let stillParsing = true
const initialCommands = []
while (stillParsing) {
const result = fromTo(args, {
from: validCommands,
to: validCommands,
remove: true
})
if (result.length) {
initialCommands.push(result)
} else {
stillParsing = false
}
}
// console.log(initialCommands)
const cliApp = new CliApp()
await cliApp.start(url, initialCommands)