From 5d9b77c9b03fce5d350da1583182ccc4619777b9 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Sat, 26 Dec 2020 22:34:54 -0800 Subject: [PATCH 1/5] neofetch: Strengthen scoop/choco app reporting --- neofetch | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 62b82ea4..ae9e19d4 100755 --- a/neofetch +++ b/neofetch @@ -1634,12 +1634,25 @@ get_packages() { MSYS*) has pacman && tot pacman -Qq --color never ;; esac - # Scoop environment throws errors if `tot scoop list` is used - has scoop && pkgs_h=1 dir ~/scoop/apps/* && ((packages-=1)) + ProgramData=$(cygpath --folder 0x0023 2>/dev/null) + if [[ -z $ProgramData ]]; then + mount=$(awk '/^C:/ {print $2}' /proc/mounts 2>/dev/null) + ProgramData=${ProgramData:-${c_mount:-/cygdrive/c}/ProgramData} + fi - # Count chocolatey packages. - [[ -d /cygdrive/c/ProgramData/chocolatey/lib ]] && \ - dir /cygdrive/c/ProgramData/chocolatey/lib/* + # Scoop environment throws errors if `tot scoop list` is used + has scoop && { + sdir=$(cygpath "${SCOOP}" 2>/dev/null) + sdir=${sdir:-~/scoop} + pkgs_h=1 dir ${sdir}/apps/* && ((packages-=1)) + manager=scoop-global + sdir=$(cygpath "${SCOOP_GLOBAL}" 2>/dev/null) + sdir=${sdir:-$ProgramData/scoop} + dir ${sdir}/apps/* + } + + # Count chocolatey packages. + has choco && dir $ProgramData/chocolatey/lib/* ;; Haiku) From 4917191cdb3c2edad38c925fa06b8df26210e260 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Sat, 26 Dec 2020 23:13:41 -0800 Subject: [PATCH 2/5] Fix typo --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index ae9e19d4..d8ce0562 100755 --- a/neofetch +++ b/neofetch @@ -1637,7 +1637,7 @@ get_packages() { ProgramData=$(cygpath --folder 0x0023 2>/dev/null) if [[ -z $ProgramData ]]; then mount=$(awk '/^C:/ {print $2}' /proc/mounts 2>/dev/null) - ProgramData=${ProgramData:-${c_mount:-/cygdrive/c}/ProgramData} + ProgramData=${ProgramData:-${mount:-/cygdrive/c}/ProgramData} fi # Scoop environment throws errors if `tot scoop list` is used From 0f5a3295227ade3c4923b63368439d1d6c6770e3 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Sat, 30 Jan 2021 09:48:07 -0800 Subject: [PATCH 3/5] Quiet spurious shellcheck issues --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d8ce0562..fb355d4f 100755 --- a/neofetch +++ b/neofetch @@ -1635,12 +1635,13 @@ get_packages() { esac ProgramData=$(cygpath --folder 0x0023 2>/dev/null) - if [[ -z $ProgramData ]]; then + if [[ -z "$ProgramData" ]]; then mount=$(awk '/^C:/ {print $2}' /proc/mounts 2>/dev/null) ProgramData=${ProgramData:-${mount:-/cygdrive/c}/ProgramData} fi # Scoop environment throws errors if `tot scoop list` is used + # shellcheck disable=SC2086 has scoop && { sdir=$(cygpath "${SCOOP}" 2>/dev/null) sdir=${sdir:-~/scoop} @@ -1652,6 +1653,7 @@ get_packages() { } # Count chocolatey packages. + # shellcheck disable=SC2086 has choco && dir $ProgramData/chocolatey/lib/* ;; From ef29fa6e57478402bb0a3410d372864e6c928479 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Wed, 30 Jun 2021 23:18:11 -0700 Subject: [PATCH 4/5] Fix shellcheck errors --- neofetch | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index 9bf558df..d79acc7a 100755 --- a/neofetch +++ b/neofetch @@ -1664,24 +1664,22 @@ get_packages() { ProgramData=$(cygpath --folder 0x0023 2>/dev/null) if [[ -z "$ProgramData" ]]; then mount=$(awk '/^C:\s/ {print $2}' /proc/mounts 2>/dev/null) - ProgramData="${ProgramData:-${mount:-/cygdrive/c}/ProgramData}" + ProgramData="${mount:-/cygdrive/c}/ProgramData" fi # Scoop environment throws errors if `tot scoop list` is used - # shellcheck disable=SC2086 has scoop && { sdir=$(cygpath "${SCOOP}" 2>/dev/null) sdir="${sdir:-~/scoop}" - pkgs_h=1 dir ${sdir}/apps/* && ((packages-=1)) + pkgs_h=1 dir "${sdir}/apps/*" && ((packages-=1)) manager=scoop-global sdir=$(cygpath "${SCOOP_GLOBAL}" 2>/dev/null) sdir="${sdir:-$ProgramData/scoop}" - dir ${sdir}/apps/* + dir "${sdir}/apps/*" } # Count chocolatey packages. - # shellcheck disable=SC2086 - has choco && dir $ProgramData/chocolatey/lib/* + has choco && dir "$ProgramData/chocolatey/lib/*" ;; Haiku) From 6b43063ca13b5dbb2599032abd3917e0174d7ab8 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Fri, 16 Jul 2021 07:19:58 -0700 Subject: [PATCH 5/5] Fix for directories with spaces --- neofetch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index d79acc7a..23bf97c6 100755 --- a/neofetch +++ b/neofetch @@ -1669,17 +1669,17 @@ get_packages() { # Scoop environment throws errors if `tot scoop list` is used has scoop && { - sdir=$(cygpath "${SCOOP}" 2>/dev/null) - sdir="${sdir:-~/scoop}" - pkgs_h=1 dir "${sdir}/apps/*" && ((packages-=1)) + sdir=$(cygpath "$SCOOP" 2>/dev/null) + sdir="${sdir:-$HOME/scoop}" + pkgs_h=1 dir "$sdir"/apps/* && ((packages-=1)) manager=scoop-global - sdir=$(cygpath "${SCOOP_GLOBAL}" 2>/dev/null) + sdir=$(cygpath "$SCOOP_GLOBAL" 2>/dev/null) sdir="${sdir:-$ProgramData/scoop}" - dir "${sdir}/apps/*" + dir "$sdir"/apps/* } # Count chocolatey packages. - has choco && dir "$ProgramData/chocolatey/lib/*" + has choco && dir "$ProgramData"/chocolatey/lib/* ;; Haiku)