m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Add GET endpoints for getting the state of the finder

* GET / (or GET /current)
* GET /query
This commit is contained in:
Junegunn Choi
2022-12-25 16:27:02 +09:00
parent de0da86bd7
commit 750b2a6313
6 changed files with 66 additions and 22 deletions

View File

@@ -722,14 +722,22 @@ e.g. \fBfzf --multi | fzf --sync\fR
.RE
.TP
.B "--listen=HTTP_PORT"
Start HTTP server on the given port to receive actions via POST requests.
Start HTTP server on the given port. It allows external processes to send
actions to perform via POST method, or retrieve the current state of the
finder.
e.g.
\fB# Start HTTP server on port 6266
fzf --listen 6266
# Send action to the server
curl -XPOST localhost:6266 -d 'reload(seq 100)+change-prompt(hundred> )'
# Send action to the server via POST method
curl localhost:6266 -d 'reload(seq 100)+change-prompt(hundred> )'
# Retrieve the current item
curl localhost:6266
# Retrieve the query string
curl localhost:6266/query
\fR
The port number is exported as \fB$FZF_LISTEN_PORT\fR on the child processes.