podcast_helper.cli module

Podcast Helper — command-line interface.

The package’s one command line: every public function reachable as a subcommand under podcast-helper. Built with click, so bash / zsh completion (click.shell_completion), colored --help and nested groups come for free. Installed as the podcast-helper entry point in pyproject.toml.

Design notes

  • Subcommand names and flag names match the FastAPI / MCP surfaces, so a recipe written for one door transposes to the others by copy-paste.

  • Flags are long options (--url / --output / …) rather than click positionals: the HTTP surface names its fields the same way, and the symmetry is worth more than the few saved keystrokes.

  • A library exception is caught by the main() entry point (not click’s own error handling, which only special-cases ClickException/Abort) and printed as a clean Error: ... line + exit 1, instead of a raw Python traceback.

Usage Example

>>> #   podcast-helper feed    --url https://feeds.npr.org/510289/podcast.xml
>>> #   podcast-helper latest  --url https://feeds.npr.org/510289/podcast.xml --json
>>> #   podcast-helper stream  --url ep.mp3 --output ep.wav --sample-rate 16000
>>> #   podcast-helper record  --url https://feeds.npr.org/510289/podcast.xml --output ep.mp3
>>> #   podcast-helper probe   --url https://youtu.be/dQw4w9WgXcQ

Author

Warith Harchaoui, Ph.D. — https://linkedin.com/in/warith-harchaoui/

podcast_helper.cli.main()[source]

Console entry point (podcast-helper).

click’s own main() only special-cases ClickException/Abort (and a broken pipe); a plain library exception would otherwise propagate as a raw Python traceback instead of a clean CLI error. This wraps the whole invocation and translates that last case into a one-line stderr message + exit 1 — click’s own control flow (usage errors, --help, an explicit sys.exit in a subcommand) already raises SystemExit, a BaseException this does not catch, so it passes through untouched.

Return type:

None