clip-files copies.
Project description
Clip Files 📋📁
Introducing clip-files
- a simple yet useful command-line utility to gather files with a specific extension, format them with their full path, and copy their contents to your clipboard with a token count for GPT-4 usage!
Makes it simple to paste in your entire project into e.g., ChatGPT or Claude.ai, now that massive token limits are available.
[ToC] 📚
:star2: Features
- 📋 Collect files with a specific extension and copy their formatted contents to your clipboard.
- 📁 Prepend each file with
# File: full_path_here
for clarity. - 🧮 Calculate and display the total number of tokens used, compatible with GPT-4 tokenization.
- 🔄 Easily handle and process multiple files in various directories.
:books: Usage
To use clip-files
, simply provide the directory to search and the file extension you want to collect:
clip-files --help
Shows the help message:
usage: clip-files [-h] [--initial-file INITIAL_FILE]
[--files FILES [FILES ...]]
[folder] [extension]
Collect files with a specific extension or specific files, format them for
clipboard, and count tokens.
positional arguments:
folder The folder to search for files.
extension The file extension to look for (e.g., .py, .txt).
options:
-h, --help show this help message and exit
--initial-file INITIAL_FILE
A file containing initial instructions to prepend to
the clipboard content. Default is an empty string.
--files FILES [FILES ...]
Specific file paths to include (e.g., --files
path/to/file1.py path/to/file2.md). If not provided,
all files with the specified extension are included.
clip-files
will traverse the specified folder, gather files with the desired extension, format them with their paths, and copy the results to your clipboard along with the token count.
:hammer_and_wrench: Installation
To install clip-files
, use pip:
pip install clip-files
Alternatively, clone the repository:
git clone https://github.com/basnijholt/clip-files.git
cd clip-files
pip install .
Or download the script directly:
wget https://raw.githubusercontent.com/basnijholt/clip-files/main/clip_files.py
and run it using:
python clip_files.py --help
:bulb: Examples
- Collect all
.py
files in thesrc
directory:
clip-files src .py
- Collect
.txt
files indocuments
and count tokens:
clip-files documents .txt
For more examples and detailed usage instructions, refer to the documentation.
:file_folder: Supported File Types
clip-files
supports any file type as long as you provide the correct file extension. Common examples include:
.py
for Python files.txt
for text files.md
for Markdown files
:1234: Token Counting
clip-files
integrates with the tiktoken
library to calculate tokens as they would be counted in GPT-4. This helps in understanding the cost and feasibility of processing the collected text with GPT-4 models.
The script will display the total token count after copying the formatted content to the clipboard.
:heart: Support and Contributions
We welcome feedback and contributions! If you encounter any issues or have suggestions for improvements, please file an issue on our GitHub repository. Contributions via pull requests are also appreciated.
Happy collecting and clipping! 📋📁🎉
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 clip_files-0.1.0.tar.gz
.
File metadata
- Download URL: clip_files-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff411e43a44b1e82ca3e6a458bc58e27f9adce273c21460bb1ed9a52e2a3489b |
|
MD5 | 23b1b6eea14cc1c903bc48878dfe046d |
|
BLAKE2b-256 | b0561a9416a300ebf245b1fb11f34da77fef3328d4e2b2a3441f141a2e162b2e |
File details
Details for the file clip_files-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: clip_files-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5add386bf07808328ece700e4ddfa040031742bed4acde0cdc6f3555e5778cde |
|
MD5 | 2afba52f837f2db99e1572d0c382df93 |
|
BLAKE2b-256 | 516d830cc43add83e438beaf281c93e15882edde59861d6b8376548c1ad079b5 |