mirror of
https://codeberg.org/james-smith-za/git-tidy-python.git
synced 2026-01-15 19:29:25 +02:00
refactor: Extract main block to main function
This commit is contained in:
parent
e740900475
commit
a0ce83fb72
1 changed files with 5 additions and 3 deletions
8
git-tidy
8
git-tidy
|
|
@ -125,9 +125,8 @@ def get_default_branch() -> str:
|
||||||
|
|
||||||
return branch_list[selection]
|
return branch_list[selection]
|
||||||
|
|
||||||
|
def main():
|
||||||
if __name__ == "__main__":
|
"""Main function."""
|
||||||
|
|
||||||
default_branch = get_default_branch()
|
default_branch = get_default_branch()
|
||||||
print(f"Switching to {default_branch}")
|
print(f"Switching to {default_branch}")
|
||||||
run(["git", "checkout", default_branch])
|
run(["git", "checkout", default_branch])
|
||||||
|
|
@ -156,3 +155,6 @@ if __name__ == "__main__":
|
||||||
for branch in merged_branches:
|
for branch in merged_branches:
|
||||||
if branch[0] != "*": # This time we want to explicitly exclude the checked-out branch.
|
if branch[0] != "*": # This time we want to explicitly exclude the checked-out branch.
|
||||||
subprocess.run(["git", "branch", "-d", branch.strip()], check=True)
|
subprocess.run(["git", "branch", "-d", branch.strip()], check=True)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue