fpf-cli 1.6.26 → 1.6.27

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 (3) hide show
  1. package/README.md +5 -0
  2. package/fpf +118 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -30,6 +30,9 @@ fpf -R
30
30
 
31
31
  # Update packages
32
32
  fpf -U
33
+
34
+ # Refresh package catalogs only
35
+ fpf --refresh
33
36
  ```
34
37
 
35
38
  By default, `fpf` auto-detects your package manager.
@@ -70,6 +73,7 @@ Live reload is enabled by default, with a minimum query length and debounce to r
70
73
  - `-l, --list-installed` list installed packages
71
74
  - `-R, --remove` remove selected packages
72
75
  - `-U, --update` run update/upgrade flow
76
+ - `--refresh` refresh package catalogs only
73
77
  - `-v, --version` print version and exit
74
78
  - `-h, --help` show help
75
79
 
@@ -88,6 +92,7 @@ Installed packages are marked with `*` in the result list.
88
92
  - Requires: `bash` + `fzf`
89
93
  - If `fzf` is missing, `fpf` auto-installs it using a compatible detected manager.
90
94
  - Root managers (`apt`, `dnf`, `pacman`, `zypper`, `emerge`, `snap`) use `sudo` when needed.
95
+ - If Flatpak is detected and Flathub is missing, `fpf` attempts `flatpak remote-add --if-not-exists --user flathub ...` automatically.
91
96
  - `FPF_DYNAMIC_RELOAD`: `always` (default), `single`, or `never`
92
97
  - Live reload uses `change:reload` by default for reliability (`ctrl-r` uses the same reload command).
93
98
  - Set `FPF_DYNAMIC_RELOAD_TRANSPORT=ipc` to opt into `--listen` + IPC query notifications on supported `fzf` builds.
package/fpf CHANGED
@@ -3,7 +3,7 @@
3
3
  set -euo pipefail
4
4
 
5
5
  SCRIPT_NAME="fpf"
6
- SCRIPT_VERSION="1.6.26"
6
+ SCRIPT_VERSION="1.6.27"
7
7
  TMP_ROOT="${TMPDIR:-/tmp}/fpf"
8
8
  SESSION_TMP_ROOT=""
9
9
  HELP_FILE=""
@@ -834,6 +834,50 @@ flatpak_has_any_remotes() {
834
834
  return 1
835
835
  }
836
836
 
837
+ flatpak_has_flathub_remote() {
838
+ if ! manager_command_ready flatpak; then
839
+ return 1
840
+ fi
841
+
842
+ if flatpak remotes --columns=name 2>/dev/null | awk '{
843
+ name=tolower($1)
844
+ if (name == "flathub") {
845
+ found=1
846
+ exit
847
+ }
848
+ } END { exit (found ? 0 : 1) }'; then
849
+ return 0
850
+ fi
851
+
852
+ if flatpak remote-list --columns=name 2>/dev/null | awk '{
853
+ name=tolower($1)
854
+ if (name == "flathub") {
855
+ found=1
856
+ exit
857
+ }
858
+ } END { exit (found ? 0 : 1) }'; then
859
+ return 0
860
+ fi
861
+
862
+ return 1
863
+ }
864
+
865
+ ensure_flatpak_flathub_remote() {
866
+ if ! manager_command_ready flatpak; then
867
+ return 1
868
+ fi
869
+
870
+ if flatpak_has_flathub_remote; then
871
+ return 0
872
+ fi
873
+
874
+ flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo 2>/dev/null ||
875
+ run_as_root flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo 2>/dev/null ||
876
+ return 1
877
+
878
+ flatpak_has_flathub_remote
879
+ }
880
+
837
881
  winget_has_default_source() {
838
882
  if ! manager_command_ready winget; then
839
883
  return 1
@@ -909,7 +953,10 @@ manager_no_query_setup_message() {
909
953
 
910
954
  case "${manager}" in
911
955
  flatpak)
912
- if ! flatpak_has_any_remotes; then
956
+ if ! flatpak_has_flathub_remote; then
957
+ ensure_flatpak_flathub_remote >/dev/null 2>&1 || true
958
+ fi
959
+ if ! flatpak_has_flathub_remote; then
913
960
  printf "%s" "Flatpak has no remotes configured. Add Flathub with: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo"
914
961
  return 0
915
962
  fi
@@ -1269,6 +1316,7 @@ Action options:
1269
1316
  -l, --list-installed Fuzzy-search installed packages and show details
1270
1317
  -R, --remove Fuzzy-search installed packages and remove selected
1271
1318
  -U, --update Run manager update/upgrade flow
1319
+ --refresh Refresh manager package catalogs only
1272
1320
  -v, --version Print version and exit
1273
1321
  -h, --help Show this help
1274
1322
 
@@ -1343,6 +1391,9 @@ parse_args() {
1343
1391
  -U|--update)
1344
1392
  ACTION="update"
1345
1393
  ;;
1394
+ --refresh)
1395
+ ACTION="refresh"
1396
+ ;;
1346
1397
  --feed-search)
1347
1398
  ACTION="feed-search"
1348
1399
  ;;
@@ -1877,6 +1928,7 @@ manager_search_entries_uncached() {
1877
1928
  '
1878
1929
  ;;
1879
1930
  flatpak)
1931
+ ensure_flatpak_flathub_remote >/dev/null 2>&1 || true
1880
1932
  if [[ -z "${effective_query}" ]]; then
1881
1933
  {
1882
1934
  flatpak remote-ls --app --columns=application,description flathub 2>/dev/null ||
@@ -2791,6 +2843,53 @@ manager_update() {
2791
2843
  esac
2792
2844
  }
2793
2845
 
2846
+ manager_refresh() {
2847
+ local manager="$1"
2848
+
2849
+ case "${manager}" in
2850
+ apt)
2851
+ run_as_root apt-get update
2852
+ ;;
2853
+ dnf)
2854
+ run_as_root dnf makecache
2855
+ ;;
2856
+ pacman)
2857
+ run_as_root pacman -Sy
2858
+ ;;
2859
+ zypper)
2860
+ run_as_root zypper --non-interactive refresh
2861
+ ;;
2862
+ emerge)
2863
+ run_as_root emerge --sync
2864
+ ;;
2865
+ brew)
2866
+ brew update
2867
+ ;;
2868
+ winget)
2869
+ winget source update --name winget --accept-source-agreements --disable-interactivity
2870
+ ;;
2871
+ choco)
2872
+ choco source list --limit-output >/dev/null
2873
+ ;;
2874
+ scoop)
2875
+ scoop update
2876
+ ;;
2877
+ snap)
2878
+ run_as_root snap refresh --list
2879
+ ;;
2880
+ flatpak)
2881
+ ensure_flatpak_flathub_remote >/dev/null 2>&1 || true
2882
+ flatpak update -y --appstream --user 2>/dev/null || run_as_root flatpak update -y --appstream
2883
+ ;;
2884
+ npm)
2885
+ npm cache verify
2886
+ ;;
2887
+ bun)
2888
+ bun pm cache >/dev/null
2889
+ ;;
2890
+ esac
2891
+ }
2892
+
2794
2893
  confirm_action() {
2795
2894
  local prompt="$1"
2796
2895
  local reply=""
@@ -2854,11 +2953,13 @@ run_fuzzy_selector() {
2854
2953
  fzf_args+=(--listen=0)
2855
2954
  fzf_args+=(--bind="change:execute-silent:${reload_ipc_cmd}")
2856
2955
  if [[ -n "${reload_cmd}" ]]; then
2857
- fzf_args+=(--bind="ctrl-r:reload:${reload_cmd}")
2956
+ fzf_args+=(--bind="ctrl-r:change-prompt(Loading> )+reload:${reload_cmd}")
2957
+ fzf_args+=(--bind="result:change-prompt(Search> )")
2858
2958
  fi
2859
2959
  elif [[ -n "${reload_cmd}" ]]; then
2860
- fzf_args+=(--bind="change:reload:${reload_cmd}")
2861
- fzf_args+=(--bind="ctrl-r:reload:${reload_cmd}")
2960
+ fzf_args+=(--bind="change:change-prompt(Loading> )+reload:${reload_cmd}")
2961
+ fzf_args+=(--bind="ctrl-r:change-prompt(Loading> )+reload:${reload_cmd}")
2962
+ fzf_args+=(--bind="result:change-prompt(Search> )")
2862
2963
  fi
2863
2964
 
2864
2965
  if [[ -n "${fzf_shell}" ]]; then
@@ -2985,6 +3086,18 @@ main() {
2985
3086
  exit 0
2986
3087
  fi
2987
3088
 
3089
+ if [[ "${ACTION}" == "refresh" ]]; then
3090
+ if confirm_action "Refresh package catalogs for ${manager_display}?"; then
3091
+ for manager in "${managers[@]-}"; do
3092
+ log "Refreshing catalogs with $(manager_label "${manager}")"
3093
+ manager_refresh "${manager}"
3094
+ done
3095
+ else
3096
+ log "Refresh canceled"
3097
+ fi
3098
+ exit 0
3099
+ fi
3100
+
2988
3101
  local display_file
2989
3102
  display_file="$(mktemp "${SESSION_TMP_ROOT}/display.XXXXXX")"
2990
3103
  : >"${display_file}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fpf-cli",
3
- "version": "1.6.26",
3
+ "version": "1.6.27",
4
4
  "description": "Cross-platform fuzzy package finder powered by fzf",
5
5
  "bin": {
6
6
  "fpf": "fpf"