sftp_helper.cli_argparse module
SFTP Helper — argparse-based command-line interface.
Thin wrapper around the pure functions in sftp_helper.main that
exposes the whole toolkit as subcommands under a single sftp-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 accepts --config (path to a JSON/YAML file or a
directory containing one). When omitted, sftp_helper.credentials falls
back to environment variables / .env — same discovery order as the
library.
Subcommands
upload— upload a local file to the SFTP serverdownload— download a remote file to the local diskdelete— delete a remote fileexists— check whether a remote file exists (exit code 0/1)dir-exists— check whether a remote directory exists (exit code 0/1)mkdir— create a remote directory (mkdir -p semantics)normalize-path— normalize a remote path (leading ‘/’, no trailing ‘/’)strip-path— stripsftp://<host>prefix from an SFTP addresstempfile— reserve a unique remote path (no upload) and print itshow-credentials— print the resolved credentials (secret masked)
Usage Example
>>> # sftp-helper upload --config sftp_config.json --input local.txt --remote /uploads/local.txt
>>> # sftp-helper download --config sftp_config.json --remote /uploads/local.txt --output out.txt
>>> # sftp-helper delete --config sftp_config.json --remote /uploads/local.txt
>>> # sftp-helper exists --config sftp_config.json --remote /uploads/local.txt
>>> # sftp-helper dir-exists --config sftp_config.json --remote /uploads
>>> # sftp-helper mkdir --config sftp_config.json --remote /uploads/a/b/c
>>> # sftp-helper normalize-path --path //foo/bar/
>>> # sftp-helper strip-path --config sftp_config.json --address sftp://host/foo/bar
>>> # sftp-helper tempfile --config sftp_config.json --ext txt --subdir batch-42
>>> # sftp-helper show-credentials --config sftp_config.json