hazy
0a01583f56
Make CLI arguments use flags, support webm output encoding, allow running from any working directory, add optional profiles, add audio to spliced-in clips, various small fixes
14 lines
510 B
JavaScript
14 lines
510 B
JavaScript
export default function getArgument(name) {
|
|
let fullName = ''
|
|
if (name.length>1) fullName = '--'+name
|
|
else fullName = '-'+name
|
|
let index = process.argv.findIndex(e => e===fullName)+1
|
|
if (index===0) return null
|
|
if (process.argv[index].startsWith('-')) { // this means there was no value after the argument, so a boolean
|
|
return true
|
|
}
|
|
const value = process.argv[index]
|
|
if (parseInt(value,10).toString()===value) return parseInt(value)
|
|
return process.argv[index]
|
|
}
|