From f477f8d9f231eb719eb0505c34a99cc7b47959d6 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 7 Mar 2024 11:56:05 -0500 Subject: [PATCH] catch KeyboardInterrupt --- CMakeLists.txt | 2 +- commit.py | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f173b76..56333e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) include(cmake/color.cmake) -set(BLT_VERSION 0.14.0) +set(BLT_VERSION 0.14.1) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/commit.py b/commit.py index ed6bead..dca8d9c 100755 --- a/commit.py +++ b/commit.py @@ -62,18 +62,22 @@ def inc_patch(cmake_text): cmake_text = load_cmake() cmake_version = get_version(cmake_text)[0] print(f"Current Version: {cmake_version}") -type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") -if type.startswith('M'): - print("Selected major") - write_cmake(inc_major(cmake_text)) -elif type.startswith('m'): - print("Selected minor") - write_cmake(inc_minor(cmake_text)) -elif type.startswith('p') or type.startswith('P') or len(type) == 0: - print("Selected patch") - write_cmake(inc_patch(cmake_text)) +try: + type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") -subprocess.call(["git", "add", "*"]) -subprocess.call(["git", "commit"]) -subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) + if type.startswith('M'): + print("Selected major") + write_cmake(inc_major(cmake_text)) + elif type.startswith('m'): + print("Selected minor") + write_cmake(inc_minor(cmake_text)) + elif type.startswith('p') or type.startswith('P') or len(type) == 0: + print("Selected patch") + write_cmake(inc_patch(cmake_text)) + + subprocess.call(["git", "add", "*"]) + subprocess.call(["git", "commit"]) + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) +except KeyboardInterrupt: + print("\nCancelling!")