mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 16:46:24 +00:00
fix(portal-clis): accept full posting URLs in jobbank, jobdanmark, and jobnet detail commands (#430)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { defineCommand, option } from "@bunli/core"
|
||||
import { z } from "zod"
|
||||
import { fetchWithUA, parseJobPostingJsonLd, writeError, BASE_URL } from "../helpers.js"
|
||||
import { fetchWithUA, normalizeJobId, parseJobPostingJsonLd, writeError, BASE_URL } from "../helpers.js"
|
||||
|
||||
export const detail = defineCommand({
|
||||
name: "detail",
|
||||
@@ -13,12 +13,18 @@ export const detail = defineCommand({
|
||||
handler: async ({ positional, flags, signal }) => {
|
||||
if (signal.aborted) return
|
||||
|
||||
const id = positional[0]
|
||||
if (!id) {
|
||||
const rawId = positional[0]
|
||||
if (!rawId) {
|
||||
writeError("Job ID is required", "MISSING_REQUIRED")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const id = normalizeJobId(rawId)
|
||||
if (!id) {
|
||||
writeError(`Could not extract job ID from "${rawId}"`, "BAD_ID")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const url = `${BASE_URL}/job/${id}/`
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user