bucket_helper.cli_click module

Bucket Helper — click-based command-line interface.

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

Design notes

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

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

  • A library exception surfaces as a clean Error: ... line + exit 1 (see main()), not a raw traceback; click’s own control flow (usage errors, --help) is untouched.

Usage Example

>>> #   bucket-helper-click upload      --config settings.yaml --input local.txt --key folder/uploaded.txt
>>> #   bucket-helper-click download    --config settings.yaml --key folder/uploaded.txt --output local.txt
>>> #   bucket-helper-click list        --config settings.yaml --prefix folder/
>>> #   bucket-helper-click tempfile    --config settings.yaml --ext json --prefix runs

Author

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

bucket_helper.cli_click.main()[source]

Console entry point (bucket-helper-click).

Click’s own main() only special-cases ClickException/Abort (and a broken pipe); a plain library exception (a boto3 ClientError, the library’s own RuntimeError/ValueError, …) 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