Skip to content

Commit

Permalink
Merge pull request #4 from kiviktnm/pacman-color-always-as-default
Browse files Browse the repository at this point in the history
Set pacman output use colors by default
  • Loading branch information
kiviktnm committed Jul 6, 2024
2 parents 3b91577 + cf1ae2e commit eb2ad7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
14 changes: 9 additions & 5 deletions example/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,30 @@ def list_pkgs(self) -> list[str]:
def list_foreign_pkgs_versioned(self) -> list[str]:
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]:
return ["pacman", "-S", "--needed"] + pkgs
return ["pacman", "-S", "--color=always", "--needed"] + pkgs

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]:
return ["pacman", "-D", "--asexplicit"] + pkgs

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]:
return ["pacman", "-Sddp", pkg]

def upgrade(self) -> list[str]:
return ["pacman", "-Syu"]
return ["pacman", "-Syu", "--color=always"]

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]:
return ["systemctl", "enable"] + units
Expand Down
13 changes: 7 additions & 6 deletions src/decman/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ def install_pkgs(self, pkgs: list[str]) -> list[str]:
"""
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]:
"""
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]:
"""
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]:
"""
Running this command installs the given packages from pacman repositories.
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]:
"""
Expand All @@ -76,14 +77,14 @@ def upgrade(self) -> list[str]:
"""
Running this command upgrades all pacman packages.
"""
return ["pacman", "-Syu"]
return ["pacman", "-Syu", "--color=always"]

def remove(self, pkgs: list[str]) -> list[str]:
"""
Running this command removes the given packages and their dependencies
(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]:
"""
Expand Down

0 comments on commit eb2ad7b

Please sign in to comment.