From d81c5e5ffd727a4a0e00910b93eb17737d8f8193 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 1 Mar 2024 11:37:04 +0000 Subject: rewrite the print statements in a more concise and professional way --- src/backend/syncall.py | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'src/backend/syncall.py') diff --git a/src/backend/syncall.py b/src/backend/syncall.py index d6db8ff..42b0b9c 100644 --- a/src/backend/syncall.py +++ b/src/backend/syncall.py @@ -35,15 +35,15 @@ def start(gfx_ui=False): if is_online != 1: if gfx_ui: - print("\n\nNo internet connection; Aborting!\n") + print("\nNo internet connection detected. Aborting!\n") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getclr.bright_red + - "\n\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) + print( + f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}") sys.exit() else: if is_sane == 1: @@ -51,18 +51,16 @@ def start(gfx_ui=False): else: if gfx_ui: if "packages-next" in bhst_addr: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(stable)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(testing)") + print(f"\n\nThe active branch is '{actv_brch}' (stable)") + print(f"\n\nThe active binhost is '{bhst_addr}' (testing)") else: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(testing)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(stable)") + print(f"\n\nThe active branch is '{actv_brch}' (testing)") + print(f"\n\nThe active binhost is '{bhst_addr}' (stable)") + + print("\nInvalid configuration!") + print( + "\nUse the Sisyphus CLI command: 'sisyphus branch --help' for assistance; Aborting.\n") - print("\n\nInvalid configuration!") - print("\nUse 'sisyphus branch --help' for help\n") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) @@ -70,19 +68,18 @@ def start(gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: if "packages-next" in bhst_addr: - print(sisyphus.getclr.green + "\n\nActive branch:" + " " + - sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(stable)") - print(sisyphus.getclr.green + "\nActive binhost:" + " " + - sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(testing)") + print( + f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (stable){sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (testing){sisyphus.getclr.reset}") else: - print(sisyphus.getclr.green + "\n\nActive branch:" + " " + - sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(testing)") - print(sisyphus.getclr.green + "\nActive binhost:" + " " + - sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(stable)") + print( + f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (testing){sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (stable){sisyphus.getclr.reset}") - print(sisyphus.getclr.bright_red + - "\n\nInvalid configuration!" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "\nUse" + sisyphus.getclr.reset + " " + "'" + - "sisyphus branch --help" + "'" + " " + sisyphus.getclr.bright_yellow + "for help" + sisyphus.getclr.reset) - time.sleep(1) + print( + f"{sisyphus.getclr.bright_red}\nInvalid configuration!{sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.bright_yellow}\nUse{sisyphus.getclr.reset} 'sisyphus branch --help' for assistance; Aborting.\n") sys.exit() -- cgit v1.2.3