fpf-cli 1.6.47 → 1.6.49
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.
- package/fpf +99 -38
- package/lib/fpf/manager-actions.sh +5 -0
- 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.
|
|
6
|
+
SCRIPT_VERSION="1.6.49"
|
|
7
7
|
TMP_ROOT="${TMPDIR:-/tmp}/fpf"
|
|
8
8
|
SESSION_TMP_ROOT=""
|
|
9
9
|
HELP_FILE=""
|
|
@@ -369,6 +369,16 @@ command_exists() {
|
|
|
369
369
|
command -v "$1" >/dev/null 2>&1
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
invocation_script_path() {
|
|
373
|
+
local script_path="${FPF_SELF_PATH:-${BASH_SOURCE[0]}}"
|
|
374
|
+
|
|
375
|
+
if [[ "${script_path}" != /* ]]; then
|
|
376
|
+
script_path="$(pwd)/${script_path}"
|
|
377
|
+
fi
|
|
378
|
+
|
|
379
|
+
printf "%s" "${script_path}"
|
|
380
|
+
}
|
|
381
|
+
|
|
372
382
|
resolve_script_dir() {
|
|
373
383
|
local script_path="${BASH_SOURCE[0]}"
|
|
374
384
|
local script_dir=""
|
|
@@ -1035,10 +1045,6 @@ start_bun_refresh_worker_async() {
|
|
|
1035
1045
|
local manager_override="$8"
|
|
1036
1046
|
local script_path="${BASH_SOURCE[0]}"
|
|
1037
1047
|
|
|
1038
|
-
if [[ "${script_path}" != /* ]]; then
|
|
1039
|
-
script_path="$(pwd)/${script_path}"
|
|
1040
|
-
fi
|
|
1041
|
-
|
|
1042
1048
|
FPF_BUN_REFRESH_FLAGS="${flags}" \
|
|
1043
1049
|
FPF_BUN_REFRESH_KEY="${key}" \
|
|
1044
1050
|
FPF_BUN_REFRESH_FINGERPRINT="${fingerprint}" \
|
|
@@ -2295,6 +2301,11 @@ rank_display_rows_by_query() {
|
|
|
2295
2301
|
local has_exact=0
|
|
2296
2302
|
local candidate
|
|
2297
2303
|
|
|
2304
|
+
if [[ "${FPF_USE_GO_DISPLAY_PIPELINE:-0}" == "1" && -n "${FPF_SELF_PATH:-}" && -x "${FPF_SELF_PATH}" ]]; then
|
|
2305
|
+
"${FPF_SELF_PATH}" --go-rank-display --go-query "${query}" --go-input "${input_file}"
|
|
2306
|
+
return $?
|
|
2307
|
+
fi
|
|
2308
|
+
|
|
2298
2309
|
[[ -n "${query}" ]] || return 0
|
|
2299
2310
|
|
|
2300
2311
|
while IFS= read -r candidate; do
|
|
@@ -2523,6 +2534,35 @@ manager_search_entries_uncached() {
|
|
|
2523
2534
|
esac
|
|
2524
2535
|
fi
|
|
2525
2536
|
|
|
2537
|
+
if [[ "${FPF_USE_GO_SEARCH_ENTRIES:-0}" == "1" && -n "${FPF_SELF_PATH:-}" && -x "${FPF_SELF_PATH}" ]]; then
|
|
2538
|
+
case "${manager}" in
|
|
2539
|
+
apt|brew)
|
|
2540
|
+
;;
|
|
2541
|
+
flatpak)
|
|
2542
|
+
if [[ -z "${query}" ]]; then
|
|
2543
|
+
:
|
|
2544
|
+
else
|
|
2545
|
+
"${FPF_SELF_PATH}" \
|
|
2546
|
+
--go-search-entries \
|
|
2547
|
+
--go-manager "${manager}" \
|
|
2548
|
+
--go-query "${effective_query}" \
|
|
2549
|
+
--go-limit "${effective_limit}" \
|
|
2550
|
+
--go-npm-search-limit "${npm_search_limit}"
|
|
2551
|
+
return 0
|
|
2552
|
+
fi
|
|
2553
|
+
;;
|
|
2554
|
+
*)
|
|
2555
|
+
"${FPF_SELF_PATH}" \
|
|
2556
|
+
--go-search-entries \
|
|
2557
|
+
--go-manager "${manager}" \
|
|
2558
|
+
--go-query "${effective_query}" \
|
|
2559
|
+
--go-limit "${effective_limit}" \
|
|
2560
|
+
--go-npm-search-limit "${npm_search_limit}"
|
|
2561
|
+
return 0
|
|
2562
|
+
;;
|
|
2563
|
+
esac
|
|
2564
|
+
fi
|
|
2565
|
+
|
|
2526
2566
|
case "${manager}" in
|
|
2527
2567
|
apt)
|
|
2528
2568
|
if search_entries_from_catalog_cache "${manager}" "${effective_query}"; then
|
|
@@ -2799,6 +2839,11 @@ manager_search_entries() {
|
|
|
2799
2839
|
manager_installed_entries() {
|
|
2800
2840
|
local manager="$1"
|
|
2801
2841
|
|
|
2842
|
+
if [[ "${FPF_USE_GO_INSTALLED_ENTRIES:-0}" == "1" && -n "${FPF_SELF_PATH:-}" && -x "${FPF_SELF_PATH}" ]]; then
|
|
2843
|
+
"${FPF_SELF_PATH}" --go-installed-entries --go-manager "${manager}"
|
|
2844
|
+
return $?
|
|
2845
|
+
fi
|
|
2846
|
+
|
|
2802
2847
|
case "${manager}" in
|
|
2803
2848
|
apt)
|
|
2804
2849
|
dpkg-query -W -f='${binary:Package}\t${Version}\n' 2>/dev/null
|
|
@@ -3184,6 +3229,11 @@ merge_search_display_rows() {
|
|
|
3184
3229
|
local source_file="$1"
|
|
3185
3230
|
local output_file="$2"
|
|
3186
3231
|
|
|
3232
|
+
if [[ "${FPF_USE_GO_DISPLAY_PIPELINE:-0}" == "1" && -n "${FPF_SELF_PATH:-}" && -x "${FPF_SELF_PATH}" ]]; then
|
|
3233
|
+
"${FPF_SELF_PATH}" --go-merge-display --go-source "${source_file}" --go-output "${output_file}"
|
|
3234
|
+
return $?
|
|
3235
|
+
fi
|
|
3236
|
+
|
|
3187
3237
|
if [[ ! -s "${source_file}" ]]; then
|
|
3188
3238
|
: >"${output_file}"
|
|
3189
3239
|
return
|
|
@@ -3343,56 +3393,44 @@ collect_installed_display_rows() {
|
|
|
3343
3393
|
build_dynamic_reload_command() {
|
|
3344
3394
|
local manager_override="$1"
|
|
3345
3395
|
local fallback_file="$2"
|
|
3346
|
-
local
|
|
3396
|
+
local manager_list_csv="${3:-}"
|
|
3397
|
+
local script_path="$(invocation_script_path)"
|
|
3347
3398
|
local bypass_query_cache="1"
|
|
3348
3399
|
|
|
3349
3400
|
bypass_query_cache="$(dynamic_reload_query_cache_bypass_value)"
|
|
3350
3401
|
|
|
3351
|
-
|
|
3352
|
-
script_path="$(pwd)/${script_path}"
|
|
3353
|
-
fi
|
|
3354
|
-
|
|
3355
|
-
printf 'FPF_SKIP_INSTALLED_MARKERS=1 FPF_BYPASS_QUERY_CACHE=%s FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_FALLBACK_FILE=%q %q --dynamic-reload -- "{q}"' "${bypass_query_cache}" "${manager_override}" "${fallback_file}" "${script_path}"
|
|
3402
|
+
printf 'FPF_SKIP_INSTALLED_MARKERS=1 FPF_BYPASS_QUERY_CACHE=%s FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_MANAGER_LIST=%q FPF_IPC_FALLBACK_FILE=%q %q --dynamic-reload -- "{q}"' "${bypass_query_cache}" "${manager_override}" "${manager_list_csv}" "${fallback_file}" "${script_path}"
|
|
3356
3403
|
}
|
|
3357
3404
|
|
|
3358
3405
|
build_dynamic_reload_command_for_query() {
|
|
3359
3406
|
local manager_override="$1"
|
|
3360
3407
|
local fallback_file="$2"
|
|
3361
|
-
local
|
|
3362
|
-
local
|
|
3408
|
+
local manager_list_csv="$3"
|
|
3409
|
+
local query_value="$4"
|
|
3410
|
+
local script_path="$(invocation_script_path)"
|
|
3363
3411
|
local bypass_query_cache="1"
|
|
3364
3412
|
|
|
3365
3413
|
bypass_query_cache="$(dynamic_reload_query_cache_bypass_value)"
|
|
3366
3414
|
|
|
3367
|
-
|
|
3368
|
-
script_path="$(pwd)/${script_path}"
|
|
3369
|
-
fi
|
|
3370
|
-
|
|
3371
|
-
printf 'FPF_SKIP_INSTALLED_MARKERS=1 FPF_BYPASS_QUERY_CACHE=%s FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_FALLBACK_FILE=%q %q --dynamic-reload -- %q' "${bypass_query_cache}" "${manager_override}" "${fallback_file}" "${script_path}" "${query_value}"
|
|
3415
|
+
printf 'FPF_SKIP_INSTALLED_MARKERS=1 FPF_BYPASS_QUERY_CACHE=%s FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_MANAGER_LIST=%q FPF_IPC_FALLBACK_FILE=%q %q --dynamic-reload -- %q' "${bypass_query_cache}" "${manager_override}" "${manager_list_csv}" "${fallback_file}" "${script_path}" "${query_value}"
|
|
3372
3416
|
}
|
|
3373
3417
|
|
|
3374
3418
|
build_dynamic_reload_ipc_command() {
|
|
3375
3419
|
local manager_override="$1"
|
|
3376
3420
|
local fallback_file="$2"
|
|
3377
|
-
local
|
|
3421
|
+
local manager_list_csv="${3:-}"
|
|
3422
|
+
local script_path="$(invocation_script_path)"
|
|
3378
3423
|
|
|
3379
|
-
|
|
3380
|
-
script_path="$(pwd)/${script_path}"
|
|
3381
|
-
fi
|
|
3382
|
-
|
|
3383
|
-
printf 'FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_FALLBACK_FILE=%q %q --ipc-reload -- "{q}"' "${manager_override}" "${fallback_file}" "${script_path}"
|
|
3424
|
+
printf 'FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_MANAGER_LIST=%q FPF_IPC_FALLBACK_FILE=%q %q --ipc-reload -- "{q}"' "${manager_override}" "${manager_list_csv}" "${fallback_file}" "${script_path}"
|
|
3384
3425
|
}
|
|
3385
3426
|
|
|
3386
3427
|
build_dynamic_query_notify_ipc_command() {
|
|
3387
3428
|
local manager_override="$1"
|
|
3388
3429
|
local fallback_file="$2"
|
|
3389
|
-
local
|
|
3390
|
-
|
|
3391
|
-
if [[ "${script_path}" != /* ]]; then
|
|
3392
|
-
script_path="$(pwd)/${script_path}"
|
|
3393
|
-
fi
|
|
3430
|
+
local manager_list_csv="${3:-}"
|
|
3431
|
+
local script_path="$(invocation_script_path)"
|
|
3394
3432
|
|
|
3395
|
-
printf 'FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_FALLBACK_FILE=%q %q --ipc-query-notify -- "{q}"' "${manager_override}" "${fallback_file}" "${script_path}"
|
|
3433
|
+
printf 'FPF_IPC_MANAGER_OVERRIDE=%q FPF_IPC_MANAGER_LIST=%q FPF_IPC_FALLBACK_FILE=%q %q --ipc-query-notify -- "{q}"' "${manager_override}" "${manager_list_csv}" "${fallback_file}" "${script_path}"
|
|
3396
3434
|
}
|
|
3397
3435
|
|
|
3398
3436
|
fzf_supports_listen() {
|
|
@@ -3497,11 +3535,15 @@ send_fzf_prompt_action() {
|
|
|
3497
3535
|
run_dynamic_reload_action() {
|
|
3498
3536
|
local query="$1"
|
|
3499
3537
|
local manager_override="${FPF_IPC_MANAGER_OVERRIDE:-}"
|
|
3538
|
+
local manager_list_csv="${FPF_IPC_MANAGER_LIST:-}"
|
|
3500
3539
|
local fallback_file="${FPF_IPC_FALLBACK_FILE:-}"
|
|
3501
3540
|
local min_chars="${FPF_RELOAD_MIN_CHARS:-2}"
|
|
3502
3541
|
local reload_debounce="${FPF_RELOAD_DEBOUNCE:-0.12}"
|
|
3503
3542
|
local output_file=""
|
|
3504
3543
|
local detected_manager=""
|
|
3544
|
+
local manager_seen=""
|
|
3545
|
+
local manager_entry=""
|
|
3546
|
+
local -a manager_list_entries=()
|
|
3505
3547
|
local -a managers=()
|
|
3506
3548
|
|
|
3507
3549
|
if [[ -z "${fallback_file}" || ! -r "${fallback_file}" ]]; then
|
|
@@ -3530,6 +3572,25 @@ run_dynamic_reload_action() {
|
|
|
3530
3572
|
return 0
|
|
3531
3573
|
fi
|
|
3532
3574
|
managers+=("${manager_override}")
|
|
3575
|
+
elif [[ -n "${manager_list_csv}" ]]; then
|
|
3576
|
+
IFS=',' read -r -a manager_list_entries <<<"${manager_list_csv}"
|
|
3577
|
+
for manager_entry in "${manager_list_entries[@]-}"; do
|
|
3578
|
+
manager_entry="$(trim_whitespace "${manager_entry}")"
|
|
3579
|
+
[[ -n "${manager_entry}" ]] || continue
|
|
3580
|
+
|
|
3581
|
+
detected_manager="$(normalize_manager "${manager_entry}")"
|
|
3582
|
+
if ! manager_supported "${detected_manager}" || ! manager_command_ready "${detected_manager}"; then
|
|
3583
|
+
continue
|
|
3584
|
+
fi
|
|
3585
|
+
|
|
3586
|
+
case " ${manager_seen} " in
|
|
3587
|
+
*" ${detected_manager} "*)
|
|
3588
|
+
continue
|
|
3589
|
+
;;
|
|
3590
|
+
esac
|
|
3591
|
+
manager_seen+=" ${detected_manager}"
|
|
3592
|
+
managers+=("${detected_manager}")
|
|
3593
|
+
done
|
|
3533
3594
|
else
|
|
3534
3595
|
while IFS= read -r detected_manager; do
|
|
3535
3596
|
[[ -n "${detected_manager}" ]] || continue
|
|
@@ -3559,6 +3620,7 @@ run_dynamic_reload_action() {
|
|
|
3559
3620
|
run_ipc_reload_action() {
|
|
3560
3621
|
local query="$1"
|
|
3561
3622
|
local manager_override="${FPF_IPC_MANAGER_OVERRIDE:-}"
|
|
3623
|
+
local manager_list_csv="${FPF_IPC_MANAGER_LIST:-}"
|
|
3562
3624
|
local fallback_file="${FPF_IPC_FALLBACK_FILE:-}"
|
|
3563
3625
|
local reload_command
|
|
3564
3626
|
local action_payload
|
|
@@ -3572,7 +3634,7 @@ run_ipc_reload_action() {
|
|
|
3572
3634
|
manager_supported "${manager_override}" || return 1
|
|
3573
3635
|
fi
|
|
3574
3636
|
|
|
3575
|
-
reload_command="$(build_dynamic_reload_command_for_query "${manager_override}" "${fallback_file}" "${query}")"
|
|
3637
|
+
reload_command="$(build_dynamic_reload_command_for_query "${manager_override}" "${fallback_file}" "${manager_list_csv}" "${query}")"
|
|
3576
3638
|
action_payload="change-prompt(Search> )+reload(${reload_command})"
|
|
3577
3639
|
send_fzf_listen_action "${action_payload}"
|
|
3578
3640
|
}
|
|
@@ -3688,17 +3750,13 @@ run_fuzzy_selector() {
|
|
|
3688
3750
|
local header_line="$3"
|
|
3689
3751
|
local reload_cmd="${4:-}"
|
|
3690
3752
|
local reload_ipc_cmd="${5:-}"
|
|
3691
|
-
local script_path="$
|
|
3753
|
+
local script_path="$(invocation_script_path)"
|
|
3692
3754
|
local quoted_script_path=""
|
|
3693
3755
|
local quoted_help_file=""
|
|
3694
3756
|
local quoted_kbinds_file=""
|
|
3695
3757
|
local preview_cmd
|
|
3696
3758
|
local fzf_shell
|
|
3697
3759
|
|
|
3698
|
-
if [[ "${script_path}" != /* ]]; then
|
|
3699
|
-
script_path="$(pwd)/${script_path}"
|
|
3700
|
-
fi
|
|
3701
|
-
|
|
3702
3760
|
printf -v quoted_script_path "%q" "${script_path}"
|
|
3703
3761
|
printf -v quoted_help_file "%q" "${HELP_FILE}"
|
|
3704
3762
|
printf -v quoted_kbinds_file "%q" "${KBINDS_FILE}"
|
|
@@ -3962,8 +4020,11 @@ main() {
|
|
|
3962
4020
|
local reload_cmd=""
|
|
3963
4021
|
local reload_ipc_cmd=""
|
|
3964
4022
|
local reload_fallback_file="${display_file}"
|
|
4023
|
+
local reload_manager_list=""
|
|
3965
4024
|
if [[ "${ACTION}" == "search" ]]; then
|
|
3966
4025
|
if dynamic_reload_enabled "${#managers[@]}"; then
|
|
4026
|
+
reload_manager_list="$(IFS=,; printf "%s" "${managers[*]-}")"
|
|
4027
|
+
|
|
3967
4028
|
if [[ -n "${query}" ]]; then
|
|
3968
4029
|
reload_fallback_file="$(mktemp "${SESSION_TMP_ROOT}/reload-fallback.XXXXXX")"
|
|
3969
4030
|
loading_progress_begin "${managers[@]-}"
|
|
@@ -3977,9 +4038,9 @@ main() {
|
|
|
3977
4038
|
fi
|
|
3978
4039
|
fi
|
|
3979
4040
|
|
|
3980
|
-
reload_cmd="$(build_dynamic_reload_command "${MANAGER_OVERRIDE}" "${reload_fallback_file}")"
|
|
4041
|
+
reload_cmd="$(build_dynamic_reload_command "${MANAGER_OVERRIDE}" "${reload_fallback_file}" "${reload_manager_list}")"
|
|
3981
4042
|
if dynamic_reload_use_ipc; then
|
|
3982
|
-
reload_ipc_cmd="$(build_dynamic_query_notify_ipc_command "${MANAGER_OVERRIDE}" "${reload_fallback_file}")"
|
|
4043
|
+
reload_ipc_cmd="$(build_dynamic_query_notify_ipc_command "${MANAGER_OVERRIDE}" "${reload_fallback_file}" "${reload_manager_list}")"
|
|
3983
4044
|
fi
|
|
3984
4045
|
fi
|
|
3985
4046
|
fi
|
|
@@ -5,6 +5,11 @@ manager_execute_action() {
|
|
|
5
5
|
local package=""
|
|
6
6
|
local pkg=""
|
|
7
7
|
|
|
8
|
+
if [[ "${FPF_USE_GO_MANAGER_ACTIONS:-0}" == "1" && -n "${FPF_SELF_PATH:-}" && -x "${FPF_SELF_PATH}" ]]; then
|
|
9
|
+
"${FPF_SELF_PATH}" --go-manager-action "${action}" --go-manager "${manager}" -- "$@"
|
|
10
|
+
return $?
|
|
11
|
+
fi
|
|
12
|
+
|
|
8
13
|
case "${manager}" in
|
|
9
14
|
apt)
|
|
10
15
|
case "${action}" in
|