refactor: improve user prompts and handle new project creation

This commit is contained in:
Paul Gauthier 2024-08-28 10:37:15 -07:00 committed by Paul Gauthier (aider)
parent 9e0db1fad0
commit c9458e461f

View file

@ -33,10 +33,10 @@ def setup_git_home(io):
while True: while True:
choice = io.prompt_ask( choice = io.prompt_ask(
"Enter the number of the repository you want to work on, or 'n' for a new project: " "Enter the number of the repository you want to work on, or ENTER for a new project: "
) )
if choice.lower() == "n": if not choice.strip():
break break
try: try:
@ -48,9 +48,10 @@ def setup_git_home(io):
except ValueError: except ValueError:
io.tool_error("Please enter a valid number or 'n'") io.tool_error("Please enter a valid number or 'n'")
project_name = io.user_input("Enter a name for your new project: ") project_name = io.user_input("Enter a name for your new project directory: ")
new_dir = home / project_name new_dir = home / project_name
new_dir.mkdir(exist_ok=True) new_dir.mkdir(exist_ok=True)
os.chdir(new_dir)
return str(new_dir) return str(new_dir)