diff --git a/pfetch b/pfetch index 12e019b..0ee1717 100755 --- a/pfetch +++ b/pfetch @@ -79,6 +79,12 @@ log() { : $((info_height+=1)) } +# Simple function to avoid '>/dev/null' spam. +# This checks to see if a command is in '$PATH'. +has() { + command -v "$1" >/dev/null +} + get_title() { # Username is retrieved by first checking '$USER' with a fallback # to the 'whoami' command. @@ -110,6 +116,8 @@ get_os() { case $os in Linux*) + has lsb_release && distro=$(lsb_release -sd) + # Disable warning about shellcheck not being able # to read '/etc/os-release'. This is fine. # shellcheck source=/dev/null @@ -117,8 +125,8 @@ get_os() { # Special cases for distributions which don't follow. # the '/etc/os-release' "standard". - command -v crux >/dev/null && distro=$(crux) - command -v guix >/dev/null && distro='Guix System' + has crux && distro=$(crux) + has guix && distro='Guix System' ;; Darwin*) @@ -214,10 +222,6 @@ get_uptime() { } get_pkgs() { - # Simple function to avoid '>/dev/null' spam. - # This checks to see if a command is in '$PATH'. - has() { command -v "$1" >/dev/null; } - # This works by first checking for which package managers are # isntalled and finally by printing each package manager's # package list with each package one per line.