video_helper.cli_click module

Video Helper — click-based command-line interface.

Twin of video_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 video-helper-click entry point in pyproject.toml.

Design notes

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

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

  • A library exception is caught by main() (the console-script entry point) and printed as one clean Error: ... line + exit 1, instead of a raw Python traceback.

Usage Example

>>> #   video-helper-click validate      --input clip.mp4
>>> #   video-helper-click dimensions    --input clip.mp4
>>> #   video-helper-click convert       --input in.mov --output out.mp4 --width 640 --height 480
>>> #   video-helper-click chunk         --input in.mp4 --start 10 --end 20 --output cut.mp4
>>> #   video-helper-click extract-frames --input clip.mp4 --output-dir frames/ --frame-step 5
>>> #   video-helper-click extract-flow --input clip.mp4 --output clip-flow.mp4 --method dis

Author

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

video_helper.cli_click.main()[source]

Console entry point (video-helper-click).

Click’s own dispatch only special-cases ClickException/Abort (and a broken pipe); a plain library exception (e.g. from video_converter()) 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(1) in a subcommand) already raises SystemExit, a BaseException this does not catch, so it passes through untouched.

Return type:

None