Skip to content

Commit

Permalink
Updated README, refs #1
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Apr 8, 2024
1 parent 4407ac5 commit df5f89e
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -44,6 +50,7 @@ my_directory/
├── file1.txt
├── file2.txt
├── .hidden_file.txt
├── temp.log
└── subdirectory/
└── file3.txt
```
Expand Down Expand Up @@ -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
```
```

0 comments on commit df5f89e

Please sign in to comment.