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

View file

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