Ask user for package install

This commit is contained in:
ItsDrike 2020-10-22 19:37:47 +02:00
parent 4e28223284
commit 86317465ce
No known key found for this signature in database
GPG key ID: F4E8FF4F6AC7F3B4
2 changed files with 12 additions and 2 deletions

View file

@ -2,9 +2,19 @@ import os
import sys import sys
from src.packages import install_packages from src.packages import install_packages
from src.util.user import Input, Print
if os.geteuid() != 0: if os.geteuid() != 0:
sys.exit("Please run this program as root user") sys.exit("Please run this program as root user")
def main():
if Input.yes_no("Do you wish to perform package install (from `packages.yaml`)?"):
install_packages() install_packages()
try:
main()
except KeyboardInterrupt:
Print.err("User cancelled (KeyboardInterrupt)")

View file

@ -18,7 +18,7 @@ class Print:
def err(text: str) -> None: def err(text: str) -> None:
"""Print syntax for error""" """Print syntax for error"""
print(f"{Color.RED} !! {text}{Color.RESET}") print(f"\n{Color.RED} !! {text}{Color.RESET}")
def cancel(text: str) -> None: def cancel(text: str) -> None:
"""Print syntax for cancellation""" """Print syntax for cancellation"""