fpf-cli 1.6.6 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/fpf +26 -23
  2. package/package.json +1 -1
package/fpf CHANGED
@@ -716,15 +716,15 @@ manager_search_entries() {
716
716
  /^Name[[:space:]]+Id[[:space:]]+/ { next }
717
717
  /^[-[:space:]]+$/ { next }
718
718
  {
719
+ line = $0
720
+ sub(/^[[:space:]]+/, "", line)
719
721
  pkg = ""
720
- desc = "-"
721
- if (NF >= 2) {
722
- pkg = $2
723
- } else if (NF >= 1) {
724
- pkg = $1
722
+ n = split(line, cols, /[[:space:]][[:space:]]+/)
723
+ if (n >= 2) {
724
+ pkg = cols[2]
725
725
  }
726
726
  if (pkg != "") {
727
- print pkg "\t" desc
727
+ print pkg "\t-"
728
728
  }
729
729
  }
730
730
  '
@@ -854,17 +854,20 @@ manager_installed_entries() {
854
854
  /^Name[[:space:]]+Id[[:space:]]+/ { next }
855
855
  /^[-[:space:]]+$/ { next }
856
856
  {
857
+ line = $0
858
+ sub(/^[[:space:]]+/, "", line)
859
+
857
860
  pkg = ""
858
861
  ver = "installed"
859
- if (NF >= 3) {
860
- pkg = $2
861
- ver = $3
862
- } else if (NF >= 2) {
863
- pkg = $1
864
- ver = $2
865
- } else if (NF >= 1) {
866
- pkg = $1
862
+
863
+ n = split(line, cols, /[[:space:]][[:space:]]+/)
864
+ if (n >= 2) {
865
+ pkg = cols[2]
866
+ }
867
+ if (n >= 3 && cols[3] != "") {
868
+ ver = cols[3]
867
869
  }
870
+
868
871
  if (pkg != "") {
869
872
  print pkg "\t" ver
870
873
  }
@@ -905,9 +908,6 @@ manager_installed_entries() {
905
908
  if bun pm ls --global >/dev/null 2>&1; then
906
909
  bun pm ls --global 2>/dev/null |
907
910
  awk 'NR > 1 && NF > 0 { print $1 "\tglobal" }'
908
- elif bun pm ls >/dev/null 2>&1; then
909
- bun pm ls 2>/dev/null |
910
- awk 'NR > 1 && NF > 0 { print $1 "\tglobal" }'
911
911
  elif command_exists npm; then
912
912
  npm ls -g --depth=0 --parseable 2>/dev/null |
913
913
  awk -F'/' 'NR > 1 { print $NF "\tglobal" }'
@@ -1107,7 +1107,10 @@ manager_install() {
1107
1107
  flatpak)
1108
1108
  local pkg
1109
1109
  for pkg in "$@"; do
1110
- flatpak install -y --user flathub "${pkg}" 2>/dev/null || flatpak install -y --user "${pkg}"
1110
+ flatpak install -y --user flathub "${pkg}" 2>/dev/null ||
1111
+ flatpak install -y --user "${pkg}" 2>/dev/null ||
1112
+ run_as_root flatpak install -y flathub "${pkg}" 2>/dev/null ||
1113
+ run_as_root flatpak install -y "${pkg}"
1111
1114
  done
1112
1115
  ;;
1113
1116
  npm)
@@ -1146,7 +1149,7 @@ manager_remove() {
1146
1149
  winget)
1147
1150
  local pkg
1148
1151
  for pkg in "$@"; do
1149
- winget uninstall --id "${pkg}" --exact --disable-interactivity
1152
+ winget uninstall --id "${pkg}" --exact --source winget --disable-interactivity
1150
1153
  done
1151
1154
  ;;
1152
1155
  choco)
@@ -1159,13 +1162,13 @@ manager_remove() {
1159
1162
  run_as_root snap remove "$@"
1160
1163
  ;;
1161
1164
  flatpak)
1162
- flatpak uninstall -y --user "$@"
1165
+ flatpak uninstall -y --user "$@" 2>/dev/null || run_as_root flatpak uninstall -y "$@"
1163
1166
  ;;
1164
1167
  npm)
1165
1168
  npm uninstall -g "$@"
1166
1169
  ;;
1167
1170
  bun)
1168
- bun remove --global "$@" 2>/dev/null || bun remove "$@"
1171
+ bun remove --global "$@"
1169
1172
  ;;
1170
1173
  esac
1171
1174
  }
@@ -1257,13 +1260,13 @@ manager_update() {
1257
1260
  run_as_root snap refresh
1258
1261
  ;;
1259
1262
  flatpak)
1260
- flatpak update -y --user
1263
+ flatpak update -y --user 2>/dev/null || run_as_root flatpak update -y
1261
1264
  ;;
1262
1265
  npm)
1263
1266
  npm update -g
1264
1267
  ;;
1265
1268
  bun)
1266
- bun update --global 2>/dev/null || bun update
1269
+ bun update --global
1267
1270
  ;;
1268
1271
  esac
1269
1272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fpf-cli",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "Cross-platform fuzzy package finder powered by fzf",
5
5
  "bin": {
6
6
  "fpf": "fpf"