bucket_helper.cli module

Bucket Helper — click-based command-line interface.

The one command-line surface, installed as the bucket-helper entry point. It used to be the optional twin of an argparse CLI, kept in lock-step by hand and reachable only under a -click suffix that named the parsing library rather than the interface; both are gone.

Design notes

  • Flags keep the names the argparse door used (--input / --key / …) rather than the more idiomatic click positional style: a spelling people already type is worth more than micro-idiomaticity.

  • Subcommand names are the ones the FastAPI surface introspects, so the two doors cannot answer differently.

  • 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 upload      --config settings.yaml --input local.txt --key folder/uploaded.txt
>>> #   bucket-helper download    --config settings.yaml --key folder/uploaded.txt --output local.txt
>>> #   bucket-helper list        --config settings.yaml --prefix folder/
>>> #   bucket-helper tempfile    --config settings.yaml --ext json --prefix runs

Author

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

bucket_helper.cli.main()[source]

Console entry point (bucket-helper).

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