gather directory contents into a single file
Project description
shlep
shlep
lets you package your directory's content in a format that can be easily passed to ChatGPT. This is especially
useful when using the code interpreter plugin!
It automatically excludes files that match what's in your .gitignore
file, as well as any additional exclude patterns you provide.
Installation
You can install shlep
from PyPI, but the recommended installation for the CLI is through pipx.
pipx install shlep
Features
- Supports various output formats: JSON, CSV, and plain text
- Excludes files and directories matching patterns in your
.gitignore
file - Allows you to provide additional exclude patterns
- Can write output to a file or print it to stdout
Demo
https://github.com/knowsuchagency/shlep/assets/11974795/ebfdae55-35f2-4edc-b0cb-089d2f99a7ca
Usage
shlep
can be used as a command-line tool or programmatically in your Python code.
Command-line usage
usage: shlep [-h] [-o OUTPUT_FILE] [-i INDENT] [-e EXCLUDE] [-f {json,csv,plaintext}] directory
Gather directory contents into a single output.
positional arguments:
directory The directory to analyze.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output-file OUTPUT_FILE
The output file to generate. If not specified, output is printed to stdout.
-i INDENT, --indent INDENT
The number of spaces to use for indentation in the output JSON.
-e EXCLUDE, --exclude EXCLUDE
Additional files or directories to exclude.
-f {json,csv,plaintext}, --format {json,csv,plaintext}
The output format. Can be 'json', 'csv', or 'plaintext'. Default is 'json'.
Programmatically in Python
from shlep import shlep
directory = "path/to/your/directory"
indent = 2
additional_excludes = [".env", "node_modules/"]
output_format = "json"
output_file = "output.json"
shlep(directory, indent, additional_excludes, output_format, output_file)
License
This project is licensed under the Apache License 2.0. You can find the full license text in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shlep-3.2.0.tar.gz
.
File metadata
- Download URL: shlep-3.2.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.6.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38dc6436339ab3508af7026e12b69856dce471be95eb4d5a6193a190641e48f7 |
|
MD5 | e324fe047c99fbded61364c00e0ce788 |
|
BLAKE2b-256 | 69782f6d483c6c77c6b0453f55272402121ec107a2d6d61066b833c89b69c96c |
File details
Details for the file shlep-3.2.0-py3-none-any.whl
.
File metadata
- Download URL: shlep-3.2.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.6.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 680dcd25d5aa07e4b405217d55ca1b3d4beac7afd049601c466bd4bb01601ece |
|
MD5 | 8c55e4dfe5bdca3825af89a000039ccb |
|
BLAKE2b-256 | b51ba76dff8964860158368a487a18e6cc44580e0191b4687eb58d2305afaeb2 |