podcast_helper.cli_click module

Podcast Helper — click-based command-line interface.

Twin of podcast_helper.cli_argparse: same public surface (identical subcommand names, identical flag semantics), but implemented with click so users who already have a click-native shell setup (bash / zsh completion via click.shell_completion, colored --help, nested command groups) can plug it in without friction. Installed as the podcast-helper-click entry point in pyproject.toml.

Design notes

  • Subcommands mirror podcast-helper (the argparse twin) so both CLIs can be introspected identically by higher layers (FastAPI).

  • Flags reuse the argparse names (--url / --output / …) rather than a more idiomatic click positional style — consistency across the two CLIs beats micro-idiomaticity here.

  • 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-click feed    --url https://feeds.npr.org/510289/podcast.xml
>>> #   podcast-helper-click latest  --url https://feeds.npr.org/510289/podcast.xml --json
>>> #   podcast-helper-click stream  --url ep.mp3 --output ep.wav --sample-rate 16000
>>> #   podcast-helper-click record  --url https://feeds.npr.org/510289/podcast.xml --output ep.mp3
>>> #   podcast-helper-click probe   --url https://youtu.be/dQw4w9WgXcQ

Author

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

podcast_helper.cli_click.main()[source]

Console entry point (podcast-helper-click).

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