mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-15 21:11:05 +02:00
feat(cli): accept both bare flags and legacy yes/no for --if-add-* args
Resolves PR #272 review #10/P5. The --if-add-node-id / -node-summary / -doc-description / -node-text args were store_true, which rejected the documented yes/no values and left default-on options impossible to disable from the CLI. They now use nargs='?' + const=True + a yes/no-coercing type: --if-add-node-id -> on --if-add-node-id no -> off (legacy form still works) (omitted) -> use the IndexConfig default README updated to the flag usage (noting the legacy `no` off-switch), and --if-add-node-text is now documented too. Decisions from the review: - #7 (api_key semantics): verified FALSE POSITIVE — 0.2.x is a cloud SDK whose api_key is a PageIndex cloud key (cloud_api.LegacyCloudAPI + docs.pageindex.ai/sdk), matching the new SDK. No change. - #11 (if_add_doc_description default True): kept intentionally (open mode). Claude-Session: https://claude.ai/code/session_01Kx5DgKbhK1N8autqXH8SmS
This commit is contained in:
parent
cf7f5ce9bf
commit
89132cb94c
3 changed files with 36 additions and 11 deletions
|
|
@ -128,3 +128,13 @@ def test_cloud_query_empty_collection_raises(monkeypatch):
|
|||
monkeypatch.setattr(backend, "_get_all_doc_ids", lambda col: [])
|
||||
with pytest.raises(ValueError, match="no documents"):
|
||||
backend.query("empty", "q") # doc_ids=None -> resolves to []
|
||||
|
||||
|
||||
# ── #10: CLI bool flags still parse legacy yes/no (a bare 'no' must be False) ──
|
||||
def test_cli_bool_coerces_legacy_yes_no():
|
||||
import run_pageindex
|
||||
|
||||
assert run_pageindex._cli_bool("no") is False # legacy off-switch
|
||||
assert run_pageindex._cli_bool("yes") is True
|
||||
assert run_pageindex._cli_bool("false") is False
|
||||
assert run_pageindex._cli_bool(True) is True # bare flag -> const=True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue