Updated README, refs #1

This commit is contained in:
Simon Willison
2024-04-07 22:35:27 -07:00
parent 4407ac519b
commit df5f89e8c9

View File

@@ -13,15 +13,16 @@ Install this tool using `pip`:
```bash
pip install files-to-prompt
```
## Usage
To use `files-to-prompt`, provide the path to the directory you want to process:
To use `files-to-prompt`, provide the path to one or more files or directories you want to process:
```bash
files-to-prompt path/to/directory
files-to-prompt path/to/file_or_directory [path/to/another/file_or_directory ...]
```
This will output the contents of every file in the directory and its subdirectories, with each file preceded by its relative path and separated by `---`.
This will output the contents of every file, with each file preceded by its relative path and separated by `---`.
### Options
@@ -35,6 +36,11 @@ This will output the contents of every file in the directory and its subdirector
files-to-prompt path/to/directory --ignore-gitignore
```
- `--ignore <pattern>`: Specify one or more patterns to ignore. Can be used multiple times.
```bash
files-to-prompt path/to/directory --ignore "*.log" --ignore "temp*"
```
### Example
Suppose you have a directory structure like this:
@@ -44,6 +50,7 @@ my_directory/
├── file1.txt
├── file2.txt
├── .hidden_file.txt
├── temp.log
└── subdirectory/
└── file3.txt
```
@@ -74,19 +81,41 @@ Contents of .hidden_file.txt
---
...
```
If you run `files-to-prompt my_directory --ignore "*.log"`, the output will exclude `temp.log`:
```
my_directory/file1.txt
---
Contents of file1.txt
---
my_directory/file2.txt
---
Contents of file2.txt
---
my_directory/subdirectory/file3.txt
---
Contents of file3.txt
---
```
## Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
```bash
cd files-to-prompt
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```
```