diff --git a/README.md b/README.md index 782758a..d733fe8 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,16 @@ To get started with `gpt-repository-loader`, follow these steps: 1. Ensure you have Python 3 installed on your system. 2. Clone or download the `gpt-repository-loader` repository. 3. Navigate to the repository's root directory in your terminal. -4. Run `gpt-repository-loader` with the following command: +4. Install the dependencies `pip install -r requirements.txt` +5. Run `gpt-repository-loader` with the following command: ```bash - python gpt_repository_loader.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt] + python gpt_repository_loader.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt] [-c] ``` - Replace `/path/to/git/repository` with the path to the Git repository you want to process. Optionally, you can specify a preamble file with -p or an output file with -o. If not specified, the default output file will be named output.txt in the current directory. + Replace `/path/to/git/repository` with the path to the Git repository you want to process. Optionally, you can specify a preamble file with -p or an output file with -o. If not specified, the default output file will be named output.txt in the current directory. -c optionally copies the content to the clipboard. -5. The tool will generate an output.txt file containing the text representation of the repository. You can now use this file as input for AI language models or other text-based processing tasks. + +6. The tool will generate an output.txt file containing the text representation of the repository. You can now use this file as input for AI language models or other text-based processing tasks. ## Running Tests diff --git a/gpt_repository_loader.py b/gpt_repository_loader.py index 57279f5..3387dda 100755 --- a/gpt_repository_loader.py +++ b/gpt_repository_loader.py @@ -3,6 +3,7 @@ import os import sys import fnmatch +import pyperclip def get_ignore_list(ignore_file_path): ignore_list = [] @@ -71,4 +72,10 @@ def process_repository(repo_path, ignore_list, output_file): with open(output_file_path, 'a') as output_file: output_file.write("--END--") print(f"Repository contents written to {output_file_path}.") - \ No newline at end of file + + # Copy the output to the clipboard if the -c flag is provided + if "-c" in sys.argv: + with open('output.txt', 'r') as output_file: + clipboard_contents = output_file.read() + pyperclip.copy(clipboard_contents) + print("Repository contents copied to clipboard.") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2069479 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyperclip \ No newline at end of file