export const getValue = (argv: string[], type: string): string => {
switch (type) {
case 'dir':
const dir: string[] | null = argv.join(' ').match(/(--cwd).*/gi)
return dir !== null
? dir
.join(' ')
.replace(/(s).*/gi, '')
.split('=')[1]
.replace(/.*(')/gi, '')
: 'default'
case 'file':
const file: string[] | null = argv.join(' ').match(/[a-z/*]+.*(js|cjs|mjs|ts)/gi)
return file !== null ? file[0] : 'default.js'
default:
throw new NyelemError('Get value type not exist')
}
}