Refactor formatting in update.py for improved readability
This commit is contained in:
@@ -31,7 +31,9 @@ def help_message():
|
||||
" --full-speed, -F Upgrade packages and use all available cores for compilation. (Default: 8 cores)",
|
||||
)
|
||||
printfe("green", " --skip-check, -s Skip checking for dotfiles updates.")
|
||||
printfe("green", " --system, -S Update system packages (flatpak, brew, apt, etc.)")
|
||||
printfe(
|
||||
"green", " --system, -S Update system packages (flatpak, brew, apt, etc.)"
|
||||
)
|
||||
printfe("green", " --help, -h Display this help message.")
|
||||
return 0
|
||||
|
||||
@@ -246,10 +248,10 @@ def get_sudo_password_from_1password(username, hostname):
|
||||
def get_distro():
|
||||
"""Detect the Linux distribution."""
|
||||
try:
|
||||
with open('/etc/os-release', 'r') as f:
|
||||
with open("/etc/os-release", "r") as f:
|
||||
for line in f:
|
||||
if line.startswith('ID='):
|
||||
return line.split('=', 1)[1].strip().strip('"').lower()
|
||||
if line.startswith("ID="):
|
||||
return line.split("=", 1)[1].strip().strip('"').lower()
|
||||
except:
|
||||
return None
|
||||
|
||||
@@ -296,7 +298,9 @@ def update_system_packages(sudo_password):
|
||||
full_cmd = sudo_cmd + cmd
|
||||
printfe("cyan", f"Running: {' '.join(full_cmd)}")
|
||||
if sudo_password:
|
||||
result = subprocess.run(full_cmd, input=sudo_password + "\n", text=True, check=False)
|
||||
result = subprocess.run(
|
||||
full_cmd, input=sudo_password + "\n", text=True, check=False
|
||||
)
|
||||
else:
|
||||
result = subprocess.run(full_cmd, check=False)
|
||||
if result.returncode != 0:
|
||||
|
||||
Reference in New Issue
Block a user