Merge pull request #4 from kiviktnm/pacman-color-always-as-default

Set pacman output use colors by default
This commit is contained in:
Kivi Kaitaniemi
2024-07-06 18:45:52 +03:00
committed by GitHub
2 changed files with 16 additions and 11 deletions
+9 -5
View File
@@ -180,26 +180,30 @@ class MyCommands(decman.config.Commands):
def list_foreign_pkgs_versioned(self) -> list[str]: def list_foreign_pkgs_versioned(self) -> list[str]:
return ["pacman", "-Qm", "--color=never"] return ["pacman", "-Qm", "--color=never"]
# --color=always is used in many commands since --color=auto results in no color.
# It seems a sensible default for me, since decman already uses color and it can't be disabled.
def install_pkgs(self, pkgs: list[str]) -> list[str]: def install_pkgs(self, pkgs: list[str]) -> list[str]:
return ["pacman", "-S", "--needed"] + pkgs return ["pacman", "-S", "--color=always", "--needed"] + pkgs
def install_files(self, pkg_files: list[str]) -> list[str]: def install_files(self, pkg_files: list[str]) -> list[str]:
return ["pacman", "-U", "--asdeps"] + pkg_files return ["pacman", "-U", "--color=always", "--asdeps"] + pkg_files
def set_as_explicitly_installed(self, pkgs: list[str]) -> list[str]: def set_as_explicitly_installed(self, pkgs: list[str]) -> list[str]:
return ["pacman", "-D", "--asexplicit"] + pkgs return ["pacman", "-D", "--asexplicit"] + pkgs
def install_deps(self, deps: list[str]) -> list[str]: def install_deps(self, deps: list[str]) -> list[str]:
return ["pacman", "-S", "--needed", "--asdeps"] + deps return ["pacman", "-S", "--color=always", "--needed", "--asdeps"
] + deps
def is_installable(self, pkg: str) -> list[str]: def is_installable(self, pkg: str) -> list[str]:
return ["pacman", "-Sddp", pkg] return ["pacman", "-Sddp", pkg]
def upgrade(self) -> list[str]: def upgrade(self) -> list[str]:
return ["pacman", "-Syu"] return ["pacman", "-Syu", "--color=always"]
def remove(self, pkgs: list[str]) -> list[str]: def remove(self, pkgs: list[str]) -> list[str]:
return ["pacman", "-Rs"] + pkgs return ["pacman", "-Rs", "--color=always"] + pkgs
def enable_units(self, units: list[str]) -> list[str]: def enable_units(self, units: list[str]) -> list[str]:
return ["systemctl", "enable"] + units return ["systemctl", "enable"] + units
+7 -6
View File
@@ -45,26 +45,27 @@ class Commands:
""" """
Running this command installs the given packages from pacman repositories. Running this command installs the given packages from pacman repositories.
""" """
return ["pacman", "-S", "--needed"] + pkgs return ["pacman", "-S", "--color=always", "--needed"] + pkgs
def install_files(self, pkg_files: list[str]) -> list[str]: def install_files(self, pkg_files: list[str]) -> list[str]:
""" """
Running this command installs the given packages files. Running this command installs the given packages files.
""" """
return ["pacman", "-U", "--asdeps"] + pkg_files return ["pacman", "-U", "--color=always", "--asdeps"] + pkg_files
def set_as_explicitly_installed(self, pkgs: list[str]) -> list[str]: def set_as_explicitly_installed(self, pkgs: list[str]) -> list[str]:
""" """
Running this command installs sets the given as explicitly installed. Running this command installs sets the given as explicitly installed.
""" """
return ["pacman", "-D", "--asexplicit"] + pkgs return ["pacman", "-D", "--color=always", "--asexplicit"] + pkgs
def install_deps(self, deps: list[str]) -> list[str]: def install_deps(self, deps: list[str]) -> list[str]:
""" """
Running this command installs the given packages from pacman repositories. Running this command installs the given packages from pacman repositories.
The packages are installed as dependencies. The packages are installed as dependencies.
""" """
return ["pacman", "-S", "--needed", "--asdeps"] + deps return ["pacman", "-S", "--color=always", "--needed", "--asdeps"
] + deps
def is_installable(self, pkg: str) -> list[str]: def is_installable(self, pkg: str) -> list[str]:
""" """
@@ -76,14 +77,14 @@ class Commands:
""" """
Running this command upgrades all pacman packages. Running this command upgrades all pacman packages.
""" """
return ["pacman", "-Syu"] return ["pacman", "-Syu", "--color=always"]
def remove(self, pkgs: list[str]) -> list[str]: def remove(self, pkgs: list[str]) -> list[str]:
""" """
Running this command removes the given packages and their dependencies Running this command removes the given packages and their dependencies
(that aren't required by other packages). (that aren't required by other packages).
""" """
return ["pacman", "-Rs"] + pkgs return ["pacman", "-Rs", "--color=always"] + pkgs
def enable_units(self, units: list[str]) -> list[str]: def enable_units(self, units: list[str]) -> list[str]:
""" """