fpf-cli 1.6.13 → 1.6.15

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 +68 -5
  2. package/package.json +1 -1
package/fpf CHANGED
@@ -3,7 +3,7 @@
3
3
  set -euo pipefail
4
4
 
5
5
  SCRIPT_NAME="fpf"
6
- SCRIPT_VERSION="1.6.13"
6
+ SCRIPT_VERSION="1.6.15"
7
7
  TMP_ROOT="${TMPDIR:-/tmp}/fpf"
8
8
  SESSION_TMP_ROOT=""
9
9
  HELP_FILE=""
@@ -1114,16 +1114,79 @@ manager_installed_entries() {
1114
1114
  ;;
1115
1115
  npm)
1116
1116
  npm ls -g --depth=0 --parseable 2>/dev/null |
1117
- awk -F'/' 'NR > 1 { print $NF "\tglobal" }'
1117
+ awk '
1118
+ NR > 1 {
1119
+ line = $0
1120
+ gsub(/\r/, "", line)
1121
+ gsub(/\\/, "/", line)
1122
+
1123
+ n = split(line, parts, "/")
1124
+ if (n < 1) next
1125
+
1126
+ pkg = parts[n]
1127
+ if (pkg == "" && n > 1) pkg = parts[n - 1]
1128
+ if (pkg == "") next
1129
+
1130
+ if (n >= 2 && parts[n - 1] ~ /^@/) {
1131
+ pkg = parts[n - 1] "/" pkg
1132
+ }
1133
+
1134
+ print pkg "\tglobal"
1135
+ }
1136
+ '
1118
1137
  ;;
1119
1138
  bun)
1120
1139
  {
1121
1140
  if bun pm ls --global >/dev/null 2>&1; then
1122
1141
  bun pm ls --global 2>/dev/null |
1123
- awk 'NR > 1 && NF > 0 { print $1 "\tglobal" }'
1142
+ awk '
1143
+ NR > 1 {
1144
+ line = $0
1145
+ gsub(/\r/, "", line)
1146
+ sub(/^[[:space:]]*[^[:alnum:]@]*/, "", line)
1147
+ sub(/^[[:space:]]+/, "", line)
1148
+ sub(/[[:space:]]+$/, "", line)
1149
+
1150
+ if (line == "") next
1151
+ if (line ~ /[[:space:]]node_modules([[:space:]]|$)/) next
1152
+
1153
+ split(line, fields, /[[:space:]]+/)
1154
+ pkg = fields[1]
1155
+ if (pkg == "") next
1156
+
1157
+ pkg_copy = pkg
1158
+ at_count = gsub(/@/, "@", pkg_copy)
1159
+ if ((substr(pkg, 1, 1) == "@" && at_count >= 2) || (substr(pkg, 1, 1) != "@" && at_count >= 1)) {
1160
+ sub(/@[^@[:space:]]*$/, "", pkg)
1161
+ }
1162
+
1163
+ if (pkg != "") {
1164
+ print pkg "\tglobal"
1165
+ }
1166
+ }
1167
+ '
1124
1168
  elif command_exists npm; then
1125
1169
  npm ls -g --depth=0 --parseable 2>/dev/null |
1126
- awk -F'/' 'NR > 1 { print $NF "\tglobal" }'
1170
+ awk '
1171
+ NR > 1 {
1172
+ line = $0
1173
+ gsub(/\r/, "", line)
1174
+ gsub(/\\/, "/", line)
1175
+
1176
+ n = split(line, parts, "/")
1177
+ if (n < 1) next
1178
+
1179
+ pkg = parts[n]
1180
+ if (pkg == "" && n > 1) pkg = parts[n - 1]
1181
+ if (pkg == "") next
1182
+
1183
+ if (n >= 2 && parts[n - 1] ~ /^@/) {
1184
+ pkg = parts[n - 1] "/" pkg
1185
+ }
1186
+
1187
+ print pkg "\tglobal"
1188
+ }
1189
+ '
1127
1190
  fi
1128
1191
  } || true
1129
1192
  ;;
@@ -1524,7 +1587,7 @@ run_fuzzy_selector() {
1524
1587
  --marker='>>' \
1525
1588
  --prompt='Search> ' \
1526
1589
  --header="${header_line}" \
1527
- --info=inline-right \
1590
+ --info=inline \
1528
1591
  --margin="2%,1%,2%,1%" \
1529
1592
  --cycle \
1530
1593
  --tiebreak=begin,chunk,length \
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fpf-cli",
3
- "version": "1.6.13",
3
+ "version": "1.6.15",
4
4
  "description": "Cross-platform fuzzy package finder powered by fzf",
5
5
  "bin": {
6
6
  "fpf": "fpf"