Add fzf example [skip ci]

This commit is contained in:
Michiel Borkent 2020-11-17 11:12:26 +01:00
parent 51133263f2
commit 14f452a904
2 changed files with 22 additions and 1 deletions

View file

@ -355,5 +355,17 @@ See [cprop.clj](cprop.clj)
Example usage: Example usage:
```shell ```shell
cd ./examples && chmod +x cprop.clj && ./cprop.clj $ ( cd examples && bb cprop.clj )
```
### [fzf](fzf.clj)
Invoke [fzf](https://github.com/junegunn/fzf), a command line fuzzy finder, from babashka.
See [fzf.clj](fzf.clj)
Example usage:
``` shell
$ cat src/babashka/main.clj | bb examples/fzf.clj
``` ```

9
examples/fzf.clj Normal file
View file

@ -0,0 +1,9 @@
(require '[babashka.process :as p])
(defn fzf [s]
(let [proc (p/process ["fzf" "-m"]
{:in s :err :inherit
:out :string})]
(:out @proc)))
(fzf (slurp *in*))