From 8d59c15e2aaf800a63e21a31781a2a6815302ec0 Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Fri, 17 Mar 2023 14:14:25 +0530 Subject: [PATCH 1/4] add copy to clipboard option --- gpt_repository_loader.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gpt_repository_loader.py b/gpt_repository_loader.py index 68c663d..b589fdf 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 = [] @@ -58,4 +59,11 @@ def process_repository(repo_path, ignore_list, output_file): with open('output.txt', 'a') as output_file: output_file.write("--END--") print("Repository contents written to output.txt.") + + # 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 From b094525c1869cb1c48fe2a88825e9cc075fc5fbd Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Fri, 17 Mar 2023 14:15:38 +0530 Subject: [PATCH 2/4] add requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt 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 From 494dfbe2f9f98c7dac3adfbeee4db39f0506f751 Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Tue, 21 Mar 2023 11:51:51 +0530 Subject: [PATCH 3/4] udpate readme with the clipboard option --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 782758a..fd3eb56 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,20 @@ 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] ``` 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. -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. + If you want to directly copy the content to clipboard, use `-c` flag + ```bash + python gpt_repository_loader.py /path/to/git/repository -c + ``` + +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 From f31a97943d717f1a1785470a835224f96c6f823e Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Tue, 21 Mar 2023 11:54:54 +0530 Subject: [PATCH 4/4] resolve merge conflict --- README.md | 8 ++------ gpt_repository_loader.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fd3eb56..d733fe8 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,10 @@ To get started with `gpt-repository-loader`, follow these steps: 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. - If you want to directly copy the content to clipboard, use `-c` flag - ```bash - python gpt_repository_loader.py /path/to/git/repository -c - ``` 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. diff --git a/gpt_repository_loader.py b/gpt_repository_loader.py index 4f39ec8..3387dda 100755 --- a/gpt_repository_loader.py +++ b/gpt_repository_loader.py @@ -71,7 +71,7 @@ def process_repository(repo_path, ignore_list, output_file): process_repository(repo_path, ignore_list, output_file) with open(output_file_path, 'a') as output_file: output_file.write("--END--") - print("Repository contents written to output.txt.") + print(f"Repository contents written to {output_file_path}.") # Copy the output to the clipboard if the -c flag is provided if "-c" in sys.argv: