Copy code in a folder for use with LLMs.
Aims to honor .gitignore and .dockerignore files and ignore all dev and non-text files.
Perfect for use with pbcopy or outputting to a text file.
-
libmagic
$ brew install libmagic
$ sudo apt-get install libmagic1
On Windows, you can install the
python-magic-bin
package which includes the necessary binaries.$ pip install python-magic-bin
Create a virtual environment, unless installing on host.
$ python3 -m venv venv && source venv/bin/activate
$ python -m venv venv && .\venv\Scripts\activate
Install requirements
$ pip install -r requirements.txt
Run. On macOS this works great in combination with pbcopy
# macOS/Linux
$ python file_enumerator.py ~/workspace/path/to/copy
# Windows
$ python file_enumerator.py C:\path\to\copy
If you do not provide a path to copy, the current directory will be used.
- Install the necessary requirements and python libraries as noted above.
- Alias the script. This can be added to your ~/.bashrc or ~/.zshrc file on macOS/Linux, or set up as a function in PowerShell on Windows.
$ alias file_enum='python /path/to/file_enumerator.py'
function file_enum {
python C:\path\to\file_enumerator.py $args
}