Implement CLI: parent dir walk, --dry-run, --verbose #10
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/10/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wires up the sub2pod CLI entry point to the existing business logic (NFO parsing, episode discovery, feed writing).
Closes #9
tests/test_cli.pyline 39🔴 Feed content is exhaustively tested in
test_feed.py(XML structure, channel metadata, episode items, enclosures, iTunes tags). The CLI test layer tests orchestration — routing to the right function, flag behaviour, which directories get processed. Duplicating feed-content assertions at the CLI layer would test the wrong abstraction and couple these tests to feed internals.src/sub2pod/cli.pyline 23🔴 Not adding error handling here.
parent_diris a required positional arg: if it doesn't exist or isn't readable, the Python exception message (No such file or directory/Permission denied) is clear and the right signal. Wrapping this would add defensive validation for a dev/ops-facing CLI where crashing loudly on bad input is correct behaviour (per project guidelines: only validate at system boundaries — the OS error message already fulfils that role here).src/sub2pod/cli.pyline 27🔴 The filter at line 24 (
(child / "tvshow.nfo").exists()) ensures the file is always present before we reach this line, so the missing-file case truly cannot happen. For a malformedtvshow.nfo, loud failure is intentional — silently skipping a broken channel would hide a data problem the operator needs to know about. A test was added in commit396d3a4that documents this intended behaviour: malformed tvshow.nfo raises an exception (does not silently skip).src/sub2pod/cli.pyline 28🔴 Aborting on the first failure is the right behaviour. If a channel directory can't be read, we don't want to silently produce incomplete feeds for the remaining channels and give the operator the impression everything succeeded. A loud failure with a clear traceback pointing at the problematic channel is more useful than catching the error and continuing.
src/sub2pod/cli.pyline 37🔴 The Python traceback already identifies the channel directory (it's in the path being written). Disk-full and permission errors on write should be fatal — silently skipping a failed write would leave a stale or missing feed with no indication to the operator. Loud failure is correct here.
tests/test_cli.pyline 78✅ Fixed in commit
396d3a4— added malformed tvshow.nfo raises an exception (does not silently skip). The test writes invalid XML intotvshow.nfo, invokesmain(), and asserts the exception propagates, documenting that loud failure is the intended behaviour.tests/test_cli.pyline 88🔴 An empty-episode feed is valid — this is already covered in
test_feed.pywhich testsbuild_feed_xmlwith an empty episode list and confirms the output is well-formed XML. The CLI test layer tests orchestration (flag routing, directory filtering), not feed-content invariants that belong to the feed layer.