Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ __pycache__/
*.pyo
*.pyd

dist
build
# Output file
output.txt

Expand Down
4 changes: 3 additions & 1 deletion .gptignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ __pycache__/
.git/*
.gptignore
LICENSE
.github/*
.github/*
dist
build
1 change: 1 addition & 0 deletions gpt_repository_loader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .gpt_repository_loader import main
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import fnmatch
import pyperclip

def get_ignore_list(ignore_file_path):
ignore_list = []
Expand Down Expand Up @@ -30,7 +31,7 @@ def process_repository(repo_path, ignore_list, output_file):
output_file.write(f"{relative_file_path}\n")
output_file.write(f"{contents}\n")

if __name__ == "__main__":
def main():
if len(sys.argv) < 2:
print("Usage: python git_to_text.py /path/to/git/repository [-p /path/to/preamble.txt]")
sys.exit(1)
Expand Down Expand Up @@ -58,4 +59,13 @@ 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.")

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyperclip
37 changes: 37 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3

from setuptools import setup, find_packages

with open("README.md", "r") as fh:
long_description = fh.read()

setup(
name="gpt-repository-loader",
version="0.1.2",
author="Felvin",
author_email="[email protected]",
description="A utility to convert a Git repository into a text representation.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/felvin-search/gpt-repository-loader",
packages=find_packages(),
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
python_requires=">=3.6",
install_requires=["pyperclip"],
entry_points={
"console_scripts": [
"gpt-repository-loader=gpt_repository_loader:main",
],
},
)