fpf-cli 1.6.36 → 1.6.37
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/README.md +1 -1
- package/fpf +59 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ Installed packages are marked with `*` in the result list.
|
|
|
98
98
|
- `FPF_DYNAMIC_RELOAD`: `always` (default), `single`, or `never`
|
|
99
99
|
- Live reload uses `change:reload` by default for reliability (`ctrl-r` uses the same reload command).
|
|
100
100
|
- Set `FPF_DYNAMIC_RELOAD_TRANSPORT=ipc` to opt into `--listen` + IPC query notifications on supported `fzf` builds.
|
|
101
|
-
- Startup now shows a
|
|
101
|
+
- Startup now shows a DynamicProgress-style pre-search bar with concurrent per-manager task text + elapsed time.
|
|
102
102
|
- Set `FPF_LOADING_INDICATOR=0` to disable the pre-search loading indicator.
|
|
103
103
|
- `FPF_RELOAD_MIN_CHARS`: minimum query length before live reload (default `2`)
|
|
104
104
|
- `FPF_RELOAD_DEBOUNCE`: reload debounce seconds (default `0.12`)
|
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.37"
|
|
7
7
|
TMP_ROOT="${TMPDIR:-/tmp}/fpf"
|
|
8
8
|
SESSION_TMP_ROOT=""
|
|
9
9
|
HELP_FILE=""
|
|
@@ -98,23 +98,49 @@ loading_progress_mark_done() {
|
|
|
98
98
|
loading_progress_mark_state "${manager}" "done" "${detail}"
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
loading_progress_repeat_char() {
|
|
102
|
+
local count="$1"
|
|
103
|
+
local char="$2"
|
|
104
|
+
local chunk=""
|
|
105
|
+
|
|
106
|
+
if ! [[ "${count}" =~ ^[0-9]+$ ]] || [[ "${count}" -le 0 ]]; then
|
|
107
|
+
return 0
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
printf -v chunk "%*s" "${count}" ""
|
|
111
|
+
printf "%s" "${chunk// /${char}}"
|
|
112
|
+
}
|
|
113
|
+
|
|
101
114
|
loading_progress_snapshot() {
|
|
102
115
|
local status_file=""
|
|
103
116
|
local manager=""
|
|
104
117
|
local status=""
|
|
105
118
|
local detail=""
|
|
119
|
+
local bar_width="${FPF_LOADING_BAR_WIDTH:-26}"
|
|
106
120
|
local total=0
|
|
107
121
|
local done=0
|
|
108
122
|
local running=0
|
|
109
123
|
local queued=0
|
|
124
|
+
local progress_percent=0
|
|
125
|
+
local filled_width=0
|
|
126
|
+
local remaining_width=0
|
|
127
|
+
local bar=""
|
|
110
128
|
local -a active_details=()
|
|
111
|
-
local
|
|
129
|
+
local active_text=""
|
|
130
|
+
local phase_text=""
|
|
112
131
|
local idx
|
|
113
132
|
|
|
114
133
|
if [[ -z "${LOADING_PROGRESS_DIR}" || ! -d "${LOADING_PROGRESS_DIR}" ]]; then
|
|
115
134
|
return 0
|
|
116
135
|
fi
|
|
117
136
|
|
|
137
|
+
if ! [[ "${bar_width}" =~ ^[0-9]+$ ]] || [[ "${bar_width}" -lt 10 ]]; then
|
|
138
|
+
bar_width=26
|
|
139
|
+
fi
|
|
140
|
+
if [[ "${bar_width}" -gt 60 ]]; then
|
|
141
|
+
bar_width=60
|
|
142
|
+
fi
|
|
143
|
+
|
|
118
144
|
for status_file in "${LOADING_PROGRESS_DIR}"/*.status; do
|
|
119
145
|
[[ -f "${status_file}" ]] || continue
|
|
120
146
|
total=$((total + 1))
|
|
@@ -126,9 +152,7 @@ loading_progress_snapshot() {
|
|
|
126
152
|
;;
|
|
127
153
|
running)
|
|
128
154
|
running=$((running + 1))
|
|
129
|
-
|
|
130
|
-
active_details+=("$(manager_label "${manager}"): ${detail:-working}")
|
|
131
|
-
fi
|
|
155
|
+
active_details+=("$(manager_label "${manager}"): ${detail:-working}")
|
|
132
156
|
;;
|
|
133
157
|
*)
|
|
134
158
|
queued=$((queued + 1))
|
|
@@ -138,27 +162,34 @@ loading_progress_snapshot() {
|
|
|
138
162
|
|
|
139
163
|
[[ "${total}" -gt 0 ]] || return 0
|
|
140
164
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
active_display+=", "
|
|
165
|
+
progress_percent=$((done * 100 / total))
|
|
166
|
+
filled_width=$((done * bar_width / total))
|
|
167
|
+
if [[ "${done}" -ge "${total}" ]]; then
|
|
168
|
+
bar="$(loading_progress_repeat_char "${bar_width}" "=")"
|
|
169
|
+
else
|
|
170
|
+
remaining_width=$((bar_width - filled_width - 1))
|
|
171
|
+
bar="$(loading_progress_repeat_char "${filled_width}" "=")>"
|
|
172
|
+
if [[ "${remaining_width}" -gt 0 ]]; then
|
|
173
|
+
bar+=$(printf "%${remaining_width}s" "")
|
|
151
174
|
fi
|
|
152
|
-
active_display+="+$((running - ${#active_details[@]})) more"
|
|
153
175
|
fi
|
|
154
176
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
177
|
+
if [[ "${#active_details[@]}" -gt 0 ]]; then
|
|
178
|
+
active_text=""
|
|
179
|
+
for idx in "${!active_details[@]}"; do
|
|
180
|
+
if [[ -n "${active_text}" ]]; then
|
|
181
|
+
active_text+="; "
|
|
182
|
+
fi
|
|
183
|
+
active_text+="${active_details[$idx]}"
|
|
184
|
+
done
|
|
185
|
+
phase_text="active: ${active_text}"
|
|
186
|
+
elif [[ "${queued}" -gt 0 ]]; then
|
|
187
|
+
phase_text="starting queued managers (${queued} remaining)"
|
|
188
|
+
else
|
|
189
|
+
phase_text="finalizing combined results"
|
|
161
190
|
fi
|
|
191
|
+
|
|
192
|
+
printf "[%s] %3s%% (%s/%s) | %s" "${bar}" "${progress_percent}" "${done}" "${total}" "${phase_text}"
|
|
162
193
|
}
|
|
163
194
|
|
|
164
195
|
start_loading_indicator() {
|
|
@@ -172,8 +203,6 @@ start_loading_indicator() {
|
|
|
172
203
|
|
|
173
204
|
(
|
|
174
205
|
trap 'exit 0' TERM INT
|
|
175
|
-
local frames='|/-\'
|
|
176
|
-
local frame_index=0
|
|
177
206
|
local started_epoch
|
|
178
207
|
local elapsed_seconds=0
|
|
179
208
|
local snapshot=""
|
|
@@ -191,11 +220,10 @@ start_loading_indicator() {
|
|
|
191
220
|
|
|
192
221
|
snapshot="$(loading_progress_snapshot)"
|
|
193
222
|
if [[ -n "${snapshot}" ]]; then
|
|
194
|
-
printf "\r\033[2K%s
|
|
223
|
+
printf "\r\033[2K%s %s | elapsed: %ss" "${message}" "${snapshot}" "${elapsed_seconds}" >&2
|
|
195
224
|
else
|
|
196
|
-
printf "\r\033[2K%s [
|
|
225
|
+
printf "\r\033[2K%s [working] | elapsed: %ss" "${message}" "${elapsed_seconds}" >&2
|
|
197
226
|
fi
|
|
198
|
-
frame_index=$(((frame_index + 1) % 4))
|
|
199
227
|
sleep 0.1
|
|
200
228
|
done
|
|
201
229
|
) &
|
|
@@ -2921,7 +2949,7 @@ collect_search_display_rows() {
|
|
|
2921
2949
|
local local_source_file
|
|
2922
2950
|
local result_count=0
|
|
2923
2951
|
|
|
2924
|
-
loading_progress_mark_running "${manager}" "
|
|
2952
|
+
loading_progress_mark_running "${manager}" "querying package index"
|
|
2925
2953
|
local_source_file="$(mktemp "${SESSION_TMP_ROOT}/source.XXXXXX")"
|
|
2926
2954
|
manager_search_entries "${manager}" "${query}" >"${local_source_file}" || true
|
|
2927
2955
|
if [[ -s "${local_source_file}" ]]; then
|
|
@@ -2938,7 +2966,7 @@ collect_search_display_rows() {
|
|
|
2938
2966
|
if [[ -s "${part_file}" ]]; then
|
|
2939
2967
|
result_count="$(awk 'END { print NR + 0 }' "${part_file}")"
|
|
2940
2968
|
fi
|
|
2941
|
-
loading_progress_mark_done "${manager}" "${result_count}
|
|
2969
|
+
loading_progress_mark_done "${manager}" "${result_count} packages matched"
|
|
2942
2970
|
) &
|
|
2943
2971
|
gather_pids+=("$!")
|
|
2944
2972
|
done
|
|
@@ -2991,7 +3019,7 @@ collect_installed_display_rows() {
|
|
|
2991
3019
|
local local_source_file
|
|
2992
3020
|
local result_count=0
|
|
2993
3021
|
|
|
2994
|
-
loading_progress_mark_running "${manager}" "reading installed
|
|
3022
|
+
loading_progress_mark_running "${manager}" "reading installed package list"
|
|
2995
3023
|
local_source_file="$(mktemp "${SESSION_TMP_ROOT}/source.XXXXXX")"
|
|
2996
3024
|
manager_installed_entries "${manager}" >"${local_source_file}" || true
|
|
2997
3025
|
if [[ -s "${local_source_file}" ]]; then
|
|
@@ -3008,7 +3036,7 @@ collect_installed_display_rows() {
|
|
|
3008
3036
|
if [[ -s "${part_file}" ]]; then
|
|
3009
3037
|
result_count="$(awk 'END { print NR + 0 }' "${part_file}")"
|
|
3010
3038
|
fi
|
|
3011
|
-
loading_progress_mark_done "${manager}" "${result_count} installed
|
|
3039
|
+
loading_progress_mark_done "${manager}" "${result_count} installed packages"
|
|
3012
3040
|
) &
|
|
3013
3041
|
gather_pids+=("$!")
|
|
3014
3042
|
done
|