fpf-cli 1.6.17 → 1.6.18

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 +31 -16
  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.17"
6
+ SCRIPT_VERSION="1.6.18"
7
7
  TMP_ROOT="${TMPDIR:-/tmp}/fpf"
8
8
  SESSION_TMP_ROOT=""
9
9
  HELP_FILE=""
@@ -2391,14 +2391,32 @@ fzf_supports_listen() {
2391
2391
 
2392
2392
  send_fzf_listen_action() {
2393
2393
  local action_payload="$1"
2394
- local port="${FZF_PORT:-}"
2394
+ local listen_target="${FZF_PORT:-}"
2395
2395
  local host="127.0.0.1"
2396
+ local port=""
2396
2397
  local payload_size
2397
2398
 
2398
- if ! [[ "${port}" =~ ^[0-9]+$ ]] || [[ "${port}" -le 0 || "${port}" -gt 65535 ]]; then
2399
+ if [[ "${listen_target}" =~ ^[0-9]+$ ]]; then
2400
+ port="${listen_target}"
2401
+ elif [[ "${listen_target}" =~ ^([^:]+):([0-9]+)$ ]]; then
2402
+ host="${BASH_REMATCH[1]}"
2403
+ port="${BASH_REMATCH[2]}"
2404
+ elif [[ "${listen_target}" =~ ^https?://([^:/]+):([0-9]+)$ ]]; then
2405
+ host="${BASH_REMATCH[1]}"
2406
+ port="${BASH_REMATCH[2]}"
2407
+ elif [[ "${listen_target}" =~ ^\[([^]]+)\]:([0-9]+)$ ]]; then
2408
+ host="${BASH_REMATCH[1]}"
2409
+ port="${BASH_REMATCH[2]}"
2410
+ fi
2411
+
2412
+ if [[ -z "${port}" ]] || ! [[ "${port}" =~ ^[0-9]+$ ]] || [[ "${port}" -le 0 || "${port}" -gt 65535 ]]; then
2399
2413
  return 1
2400
2414
  fi
2401
2415
 
2416
+ if [[ "${host}" == "0.0.0.0" || "${host}" == "*" ]]; then
2417
+ host="127.0.0.1"
2418
+ fi
2419
+
2402
2420
  payload_size="$(printf "%s" "${action_payload}" | wc -c | tr -d '[:space:]')"
2403
2421
 
2404
2422
  if command_exists curl; then
@@ -2471,6 +2489,7 @@ run_ipc_query_notify_action() {
2471
2489
  local fallback_file="${FPF_IPC_FALLBACK_FILE:-}"
2472
2490
  local min_chars="${FPF_RELOAD_MIN_CHARS:-2}"
2473
2491
  local target_manager=""
2492
+ local should_warm_bun=0
2474
2493
 
2475
2494
  if ! [[ "${min_chars}" =~ ^[0-9]+$ ]]; then
2476
2495
  min_chars=2
@@ -2493,23 +2512,19 @@ run_ipc_query_notify_action() {
2493
2512
  target_manager="bun"
2494
2513
  fi
2495
2514
 
2496
- if [[ "${target_manager}" != "bun" ]]; then
2497
- send_fzf_prompt_action "Search> " || true
2498
- return 0
2499
- fi
2500
-
2501
- if ! manager_command_ready bun; then
2502
- send_fzf_prompt_action "Search> " || true
2503
- return 0
2515
+ if [[ "${target_manager}" == "bun" ]] && manager_command_ready bun; then
2516
+ should_warm_bun=1
2504
2517
  fi
2505
2518
 
2506
2519
  send_fzf_prompt_action "Loading> " || true
2507
2520
 
2508
- FPF_IPC_MANAGER_OVERRIDE="${manager_override}" \
2509
- FPF_IPC_FALLBACK_FILE="${fallback_file}" \
2510
- manager_search_entries "bun" "${query}" >/dev/null 2>&1 || {
2511
- send_fzf_prompt_action "Search> " || true
2512
- }
2521
+ if [[ "${should_warm_bun}" -eq 1 ]]; then
2522
+ FPF_IPC_MANAGER_OVERRIDE="${manager_override}" \
2523
+ FPF_IPC_FALLBACK_FILE="${fallback_file}" \
2524
+ manager_search_entries "bun" "${query}" >/dev/null 2>&1 || true
2525
+ fi
2526
+
2527
+ run_ipc_reload_action "${query}" || send_fzf_prompt_action "Search> " || true
2513
2528
  }
2514
2529
 
2515
2530
  manager_install() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fpf-cli",
3
- "version": "1.6.17",
3
+ "version": "1.6.18",
4
4
  "description": "Cross-platform fuzzy package finder powered by fzf",
5
5
  "bin": {
6
6
  "fpf": "fpf"