Skip to main content

tlnw-get-file

tlnw-get-file is a small cross-platform Python CLI that retrieves a single file or folder from a Git repository by using sparse checkout and then moves it into a relative destination under the current working directory.

Installation

python -m pip install .

Usage

tlnw-get-file --git --repo https://github.com/owner/repo.git --source path/to/file.txt --dest output.txt

The CLI always supports these common options:

  • --help: show the current version, usage, and available options
  • --debug: enable debug logging
  • --version: print the current version

Version 0.2.0 requires --git mode.

Git mode

  • --repo must be an HTTPS repository URL.
  • --source must be a single relative file or folder path inside the repository.
  • --dest must be a relative path from the current working directory and must not contain .. path segments.
  • --merge is optional and accepts replace or discard when the resolved final destination path already exists.

If TLNW_GIT_ACCESS_TOKEN is set, the command injects it into the HTTPS clone URL by using x-access-token authentication. If the variable is absent, the repository is cloned as a public repository.

Destination behavior

  • If --dest points to an existing directory, the retrieved source is moved inside it.
  • If --dest ends with / or \, that directory is created and the retrieved source is moved inside it.
  • Otherwise, a file source is written to the exact destination file path.
  • Otherwise, a directory source is moved to the exact destination directory path, which allows renaming the retrieved folder.
  • --merge is evaluated only after the final destination path is resolved. If the resolved path does not exist, the move proceeds normally and any --merge value is ignored.
  • If the resolved final destination path already exists and --merge is omitted, the command fails.
  • --merge replace recursively applies the source onto the destination, overwriting conflicting files or folders while keeping destination-only entries.
  • --merge discard recursively applies only source paths that do not already exist, preserving conflicting destination files or folders.

Examples

Retrieve a file to a specific output filename:

tlnw-get-file --git --repo https://github.com/owner/repo.git --source docs/spec.md --dest specs/current.md

Retrieve a folder into a destination directory:

tlnw-get-file --git --repo https://github.com/owner/repo.git --source templates/api --dest vendor/

Recursively overwrite conflicting paths while keeping destination-only files:

tlnw-get-file --git --repo https://github.com/owner/repo.git --source templates/api --dest vendor/ --merge replace

Recursively keep conflicting destination paths and import only new source paths:

tlnw-get-file --git --repo https://github.com/owner/repo.git --source templates/api --dest vendor/ --merge discard

Enable debug logging:

tlnw-get-file --debug --git --repo https://github.com/owner/repo.git --source path/to/file.txt --dest output.txt

Development

python -m pip install -e .[dev]
python -m pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tlnw_get_file-0.2.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tlnw_get_file-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file tlnw_get_file-0.2.0.tar.gz.

File metadata

  • Download URL: tlnw_get_file-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tlnw_get_file-0.2.0.tar.gz
Algorithm Hash digest
SHA256 32ee358a0a5a22629a9c237990a3ca8efbe9da785677c1242264bf9cf95376ea
MD5 7d33cc9216fd2d75aba567ad70e021ff
BLAKE2b-256 3759a7b5867e84c0be4bb62a2d98d06f942fd534fefd406f62b41cceff42edd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tlnw_get_file-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on tellersnetwork/tlnw-get-file

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tlnw_get_file-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tlnw_get_file-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tlnw_get_file-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65f1ac896d09cc086950f960571f51060a6ea16d6c06fdf8ff88f855e3c3d7b4
MD5 376a90b510e3a62b9c80af4225bd9f3e
BLAKE2b-256 6df6bb5c215728984cf90263f9aaf347da7784b2cb7720843dfcd609ec101b85

See more details on using hashes here.

Provenance

The following attestation bundles were made for tlnw_get_file-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on tellersnetwork/tlnw-get-file

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page