Wire freehire, Jobnet and Akademikernes Jobbank into the CLI, the Sources form, dupes and the docs

Provider names, the CLI's choices and the dupes rule's search hosts now come from readers.PROVIDERS, and the regions, work modes and remote words from the modules' REGIONS, MODES and REMOTE, read with getattr so main works before and after the readers merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-03 12:24:34 +02:00
1 parent 018a1ad895
commit 6e6e655203
16 files changed
+422 -39

No files matched your search

+24 -4
View File
@@ -46,8 +46,19 @@ if str(_ROOT) not in sys.path:
sys.path.insert(0, str(_ROOT))
def _ids(provider: str, table: str, lead: str) -> str:
"""`lead` and the `id label` pairs of a search reader's `REGIONS`, `MODES` or `REMOTE`
for a help text, or nothing when the reader is not loaded or has no such table."""
from app import jobs
pairs = ", ".join(f"{key or 'empty'} {label}".replace("%", "%%")
for key, label in jobs.sources.provider_table(provider, table).items())
return f"{lead}{pairs}" if pairs else ""
def build_parser() -> argparse.ArgumentParser:
from app.models import HAND_REASONS
from plugins import readers
parser = argparse.ArgumentParser(
prog="app", description="roledesk: a job-search engine on desk and the pipeline queue.")
@@ -128,17 +139,25 @@ def build_parser() -> argparse.ArgumentParser:
searches_sub = searches.add_subparsers(dest="action", required=True)
search_add = searches_sub.add_parser(
"add", help="run a search once, then save it for every pull (or update it)")
search_add.add_argument("provider", choices=["jobindex", "adzuna", "platsbanken"])
search_add.add_argument("provider", choices=list(readers.PROVIDERS))
search_add.add_argument("name", help='what to call it, e.g. "Copenhagen backend"')
search_add.add_argument("--q", required=True,
help="the query, in the provider's own syntax")
search_add.add_argument("--area", type=int, default=0,
help="jobindex geoareaid: 1 Region Hovedstaden, 8 Aarhus")
search_add.add_argument("--country", default="",
help="adzuna country: gb, de, nl, fr, at, be, es, it, pl, ch")
help="adzuna country: gb, de, nl, fr, at, be, es, it, pl, ch; "
"freehire countries, comma-separated ISO codes: dk,se, "
"empty all")
search_add.add_argument("--where", default="", help="adzuna place, e.g. Berlin")
search_add.add_argument("--region", default="",
help="platsbanken län id: CaRE_1nn_cSU is Skåne, empty all of Sweden")
help="platsbanken län id: CaRE_1nn_cSU is Skåne, empty all of "
"Sweden" + _ids("jobnet", "REGIONS", "; jobnet region")
+ _ids("jobbank", "REGIONS", "; jobbank amt"))
search_add.add_argument("--remote", default="",
help="freehire work mode" + _ids("freehire", "MODES", ": ")
+ _ids("jobbank", "REMOTE", "; jobbank remote work: ")
+ ", empty any")
search_add.add_argument("--pages", type=int, default=0,
help="result pages per pull (default 5, at most 10)")
searches_sub.add_parser("list", help="every saved search and its open roles")
@@ -608,7 +627,8 @@ def add_search(config: config_mod.Config, store: Store, args: argparse.Namespace
try:
params = jobs.sources.search_params(args.provider, args.q, area=args.area,
country=args.country, where=args.where,
region=args.region, pages=args.pages)
region=args.region, remote=args.remote,
pages=args.pages)
sub, found, complete = jobs.sources.save_search(config, store, args.provider, args.name,
params)
except ValueError as exc: