Skip to content

Commit

Permalink
add add menu
Browse files Browse the repository at this point in the history
  • Loading branch information
estella144 committed Apr 10, 2024
1 parent d278f31 commit 550c7da
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions gitinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def _get_git_log(num_commits: int) -> str:
return str(subprocess.check_output(['git', 'log', pretty_flag, n_flag]), 'utf-8')

def gitui_addmenu() -> None:
raise NotImplementedError
path = input("Please enter a pathspec to add to staged changes: ")
try:
subprocess.run(['git', 'add', path], check=True)
print(f"Successfully added {path}")
except subprocess.CalledProcessError as err:
print(f"Failed to add {path}: {err}")

def gitui_movemenu() -> None:
raise NotImplementedError
Expand Down Expand Up @@ -90,17 +95,17 @@ def gitui_workmenu() -> None:

while True:
choice = input(f"{_get_current_repo_name()} on {_get_current_branch()}> ").lower()
if choice == "A":
if choice == "a":
gitui_addmenu()
elif choice == "M":
elif choice == "m":
gitui_movemenu()
elif choice == "R":
elif choice == "r":
gitui_restoremenu()
elif choice == "C":
elif choice == "c":
gitui_commitmenu()
elif choice == "B":
elif choice == "b":
break
elif choice == "Q":
elif choice == "q":
quit()


Expand Down

0 comments on commit 550c7da

Please sign in to comment.