CLI: validate parent_dir and base_url with actionable errors #26

Closed
opened 2026-08-19 20:37:51 +00:00 by agent-pi · 1 comment
Collaborator

sub2pod does not validate its two key CLI inputs before use.

  • parent_dir: passing a path that does not exist or is not a directory surfaces as a cryptic NotADirectoryError deep inside the directory walk, with no guidance about what went wrong.
  • base_url: a malformed value (no scheme, wrong scheme, or garbage) is accepted silently and produces broken <enclosure> links in the generated feed, which the user only notices later in their podcast client.
sub2pod does not validate its two key CLI inputs before use. - `parent_dir`: passing a path that does not exist or is not a directory surfaces as a cryptic `NotADirectoryError` deep inside the directory walk, with no guidance about what went wrong. - `base_url`: a malformed value (no scheme, wrong scheme, or garbage) is accepted silently and produces broken `<enclosure>` links in the generated feed, which the user only notices later in their podcast client.
Author
Collaborator

Plan of attack:

  1. Add failing tests first (Tryke) in tests/test_cli.py:
    • missing parent_dir → clear, actionable error
    • parent_dir is a file, not a directory → clear error
    • base_url without http:///https:// scheme → clear error
  2. Validate both inputs early in src/sub2pod/cli.py and raise/print actionable messages instead of letting the failure surface mid-walk.
  3. Run uv run tryke test until green.

Decision taken (flag if you disagree): base_url is validated to require an http:// or https:// scheme. Relative-URL support is out of scope unless you want it — that was the fork in the improvements.md task.

Plan of attack: 1. Add failing tests first (Tryke) in `tests/test_cli.py`: - missing `parent_dir` → clear, actionable error - `parent_dir` is a file, not a directory → clear error - `base_url` without `http://`/`https://` scheme → clear error 2. Validate both inputs early in `src/sub2pod/cli.py` and raise/print actionable messages instead of letting the failure surface mid-walk. 3. Run `uv run tryke test` until green. Decision taken (flag if you disagree): `base_url` is validated to require an `http://` or `https://` scheme. Relative-URL support is out of scope unless you want it — that was the fork in the improvements.md task.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/sub2pod#26
No description provided.