Convert environment variables to command-line arguments
export MKCMDARGV_ARGS='[abc def]'
export MKCMDARGV_OPTIONS='{ a: 0, foo: 123 }'
export MKCMDARGV_SINGLE_FLAGS='sfx'
export MKCMDARGV_DOUBLE_FLAGS='quiet splash'
echo $(mkcmdargv)
iterateCommandArguments
Creates an iterator of command arguments
const { iterateCommandArguments } = require('mkcmdargv')
console.log(...iterateCommandArguments({
args: ['abc', 'def'],
options: { a: 0, foo: 123 },
flags: ['s', 'f', 'x', 'quiet', 'splash']
}))
createCommandArguments
Creates an array of command arguments
const { createCommandArguments } = require('mkcmdargv')
createCommandArguments({
args: ['abc', 'def'],
options: { a: 0, foo: 123 },
flags: ['s', 'f', 'x', 'quiet', 'splash']
}).forEach(arg => console.log(arg))
Generated using TypeDoc