Skip to content

Commit

Permalink
Merge pull request #4 from heroesofcode/improvement/repo_path
Browse files Browse the repository at this point in the history
Save path on configs.txt
  • Loading branch information
pedrohfp authored Jun 5, 2024
2 parents 66c0af8 + 1693308 commit f471223
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
myenv/
reports/
config.txt
.DS_Store
27 changes: 26 additions & 1 deletion pullpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

GEMINI_AI_TOKEN = "AIzaSyA3Ilt0P2jPuADTcIWzUvIKxZC6-P9jS6Q"

CONFIG_FILE = "config.txt"

def get_diff(repo_path):
"""
Calculate and print the differences (diff) between the current branch and the main branch of a Git repository.
Expand Down Expand Up @@ -245,8 +247,31 @@ def process_api_calls(api_call_queue):
"""
)

def get_repo_path():
# Check if the config file exists
if os.path.exists(CONFIG_FILE):
with open(CONFIG_FILE, "r") as file:
saved_path = file.readline().strip()
if saved_path:
# Ask the user if they want to use the saved path
user_input = input(f"Use the saved path '{saved_path}'? (Press Enter to accept or type a new path): ").strip()
if user_input:
repo_path = user_input
else:
repo_path = saved_path
else:
repo_path = input("Please enter the path to your Git repository: ").strip()
else:
repo_path = input("Please enter the path to your Git repository: ").strip()

# Save the new path (if it was changed or entered for the first time)
with open(CONFIG_FILE, "w") as file:
file.write(repo_path)

return repo_path

# Request the repository path from the user
repo_path = input("Please enter the path to your Git repository: ")
repo_path = get_repo_path()

# Calculate and get the diff between the target and current branches
get_diff(repo_path)

0 comments on commit f471223

Please sign in to comment.