Update channels.js

This commit is contained in:
Aleksandr Statciuk 2021-11-15 21:58:52 +03:00
parent 4aa2446fdf
commit cf5c9b2e1c

View file

@ -6,6 +6,7 @@ const { json2xml } = require('./utils')
const program = new Command() const program = new Command()
program program
.requiredOption('-c, --config <config>', 'Config file') .requiredOption('-c, --config <config>', 'Config file')
.option('-s, --set [args...]', 'Set custom arguments')
.option('-o, --output <output>', 'Output file') .option('-o, --output <output>', 'Output file')
.parse(process.argv) .parse(process.argv)
@ -13,7 +14,12 @@ const options = program.opts()
async function main() { async function main() {
const config = require(path.resolve(options.config)) const config = require(path.resolve(options.config))
let channels = config.channels() const args = {}
options.set.forEach(arg => {
const [key, value] = arg.split(':')
args[key] = value
})
let channels = config.channels(args)
if (isPromise(channels)) { if (isPromise(channels)) {
channels = await channels channels = await channels
} }