summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-05-22 21:56:26 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-05-22 21:57:04 +0900
commitd18c0bf6948b4707684fe77631aff26a17cbc4fa (patch)
tree6f822ee88f967504d30b0e569d2f3ba8f8841709 /man
parent4e3f9854e67f70f17eba8fd6c480cbe9ca1a6cee (diff)
downloadfzf-d18c0bf6948b4707684fe77631aff26a17cbc4fa.tar.gz
[man] Add GET endpoint example
Diffstat (limited to 'man')
-rw-r--r--man/man1/fzf.123
1 files changed, 18 insertions, 5 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index c822ed42..d41fa170 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -1108,11 +1108,6 @@ e.g.
# Send action to the server
curl \-XPOST localhost:6266 \-d 'reload(seq 100)+change\-prompt(hundred> )'
- # Get program state in JSON format (experimental)
- # * Make sure NOT to access this endpoint from execute/transform actions
- # as it will result in a timeout
- curl localhost:6266
-
# Start HTTP server on port 6266 with remote connections allowed
# * Listening on non-localhost address requires using an API key
export FZF_API_KEY="$(head \-c 32 /dev/urandom | base64)"
@@ -1123,6 +1118,24 @@ e.g.
# Choose port automatically and export it as $FZF_PORT to the child process
fzf \-\-listen \-\-bind 'start:execute\-silent:echo $FZF_PORT > /tmp/fzf\-port'
+
+ # Get program state in JSON format (experimental)
+ # - GET Parameters:
+ # - limit: number of items to return (default: 100)
+ # - offset: number of items to skip (default: 0)
+ curl localhost:6266
+
+ # Automatically select items with .txt extension
+ fzf \-\-multi \-\-sync \-\-listen \-\-bind 'load:transform:
+ pos=1
+ curl \-s localhost:$FZF_PORT?limit=1000 | jq \-r .matches[].text | while read \-r text; do
+ if [[ $text =~ \\.txt$ ]]; then
+ echo \-n "+pos($pos)+select"
+ fi
+ pos=$((pos + 1))
+ done
+ echo +first
+ '
\fR
.SS DIRECTORY TRAVERSAL