bucket_helper.cli_argparse module
Bucket Helper — argparse-based command-line interface.
Thin wrapper around the pure functions in bucket_helper.main that
exposes the whole toolkit as subcommands under a single bucket-helper
entry point. Written with argparse from the standard library so
the CLI works out of the box on any Python install that has the package
installed — no extra dependency required.
Every subcommand reads credentials from --config (path to a JSON /
YAML file, or a folder holding one, or empty for env-only). Under the
hood we call bucket_helper.credentials(), so the same precedence
order (JSON → YAML → .env → environment) applies here as in the
library.
Subcommands
upload— send a local file to S3 (auto-key if omitted)download— fetch an S3 object to a local pathdelete— delete an S3 object (idempotent)exists— probe whether an S3 object exists (exit code 0/1)list— list keys under a prefix in the default bucketmake-bucket— create a bucket (no-op if it already exists)tempfile— generate a unique random key + public URL (no upload)strip-path— normalises3://bucket/keyinto the key part
Usage Example
>>> # bucket-helper upload --config s3_config.json --input local.txt --key folder/uploaded.txt
>>> # bucket-helper download --config s3_config.json --key folder/uploaded.txt --output local.txt
>>> # bucket-helper delete --config s3_config.json --key folder/uploaded.txt
>>> # bucket-helper exists --config s3_config.json --key folder/uploaded.txt
>>> # bucket-helper list --config s3_config.json --prefix folder/
>>> # bucket-helper make-bucket --config s3_config.json --bucket new-bucket
>>> # bucket-helper tempfile --config s3_config.json --ext json --prefix runs
>>> # bucket-helper strip-path --config s3_config.json --address s3://my-bucket/path/to/obj