1
0
Fork 0
mirror of https://codeberg.org/Mo8it/dotfiles.git synced 2024-10-17 20:52:40 +00:00

Fancy press to exit

This commit is contained in:
Mo 2022-06-16 22:21:33 +02:00
parent f6f3244e54
commit 65dc8d158d

View file

@ -20,7 +20,7 @@ def cap_live_lines(command, **kwargs):
def press_to_exit(): def press_to_exit():
getpass("Exit") getpass("\n<<-<>===EXIT===<>->>")
def update_rpm_ostree(): def update_rpm_ostree():
@ -40,6 +40,13 @@ def update_flatpak():
press_to_exit() press_to_exit()
def update_cargo():
lines = cap_live_lines("cargo install-update -a")
if "no packages need updating" not in lines[-2].lower():
press_to_exit()
def update_pipx(): def update_pipx():
lines = cap_live_lines("pipx upgrade-all --include-injected") lines = cap_live_lines("pipx upgrade-all --include-injected")
@ -51,24 +58,17 @@ def update_nvim():
run('nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"') run('nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"')
def update_cargo():
lines = cap_live_lines("cargo install-update -a")
if "no packages need updating" not in lines[-2].lower():
press_to_exit()
def main(input): def main(input):
if input == "rpm-ostree": if input == "rpm-ostree":
update_rpm_ostree() update_rpm_ostree()
elif input == "flatpak": elif input == "flatpak":
update_flatpak() update_flatpak()
elif input == "nvim":
update_nvim()
elif input == "cargo": elif input == "cargo":
update_cargo() update_cargo()
elif input == "pipx": elif input == "pipx":
update_pipx() update_pipx()
elif input == "nvim":
update_nvim()
else: else:
print(f"Input {input} not valid!") print(f"Input {input} not valid!")