mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-08 16:07:40 +00:00
fix(portal-clis): reject missing Danish option values before dispatch (#573)
* fix(portal-clis): reject missing Danish option values before dispatch The Bunli parser discards known bare options before schema validation, silently dropping filters or applying defaults. Extend the existing pre-dispatch guards across the four Danish portals while preserving built-in switches, valued and equals-form arguments, and existing unknown-flag errors. Actual CLI subprocess regressions deny and record every fetch to demonstrate that missing filters reach request construction on master. Valued-option and help controls keep accepted command forms covered without contacting any portal. * docs(changelog): record fix for #573
This commit is contained in:
1 parent
129367dbca
commit
060f2dbe78
9 files changed
+330
No files matched your search
@@ -61,6 +61,26 @@ if (invoked) {
|
||||
if (!knownShorts.has(flag)) rejectFlag(`-${flag}`)
|
||||
}
|
||||
}
|
||||
// Every declared portal option takes a value; only the built-in help and
|
||||
// version flags are switches. Bunli drops a bare known option before schema
|
||||
// validation, so an optional filter disappears or a default is used instead.
|
||||
// Check after unknown flags so negative tokens keep their existing error.
|
||||
for (let i = 1; i < argv.length; i++) {
|
||||
const token = argv[i]
|
||||
if (token === "--") break
|
||||
if (!token.startsWith("-") || token.includes("=")) continue
|
||||
const name = token.replace(/^-+/, "")
|
||||
const isOption = token.startsWith("--")
|
||||
? options[name] !== undefined
|
||||
: Object.values(options).some((o) => o?.short === name)
|
||||
if (!isOption) continue
|
||||
const next = argv[i + 1]
|
||||
if (next === undefined || next.startsWith("-")) {
|
||||
writeError(`option ${token} requires a value`, "BAD_ARG")
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await cli.run()
|
||||
Reference in new issue
Block a user