Archived
1
0

feat: check for empty str in isHashMatch

This commit is contained in:
Joe Previte
2021-06-07 15:45:11 -07:00
parent 3b50bfc17d
commit 1e55a648a5
4 changed files with 39 additions and 31 deletions

View File

@ -263,6 +263,7 @@ export const parse = (
if (opts?.configFile) {
msg = `error reading ${opts.configFile}: ${msg}`
}
return new Error(msg)
}
@ -286,6 +287,13 @@ export const parse = (
const split = splitOnFirstEquals(arg.replace(/^--/, ""))
key = split[0] as keyof Args
value = split[1]
} else {
const short = arg.replace(/^-/, "")
const pair = Object.entries(options).find(([, v]) => v.short === short)
if (pair) {
key = pair[0] as keyof Args
}
}
if (!key || !options[key]) {
throw error(`Unknown option ${arg}`)