Add rofi example [skip ci] (#651)

Rofi is a linux modal menu for fuzzy filtering, with a similar UX to
Alfred or Spotlight on OSX.

Borrows quite directly from the fzf example.
This commit is contained in:
Russell Matney 2020-11-17 11:54:02 -05:00 committed by GitHub
parent 14f452a904
commit 8da8b3ffb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -369,3 +369,15 @@ Example usage:
``` shell
$ cat src/babashka/main.clj | bb examples/fzf.clj
```
### [rofi](rofi.clj)
Invoke [rofi](https://github.com/davatorium/rofi), a type-to-filter menu on linux, from babashka.
See [rofi.clj](rofi.clj)
Example usage:
``` shell
$ cat src/babashka/main.clj | bb examples/rofi.clj
```

12
examples/rofi.clj Normal file
View file

@ -0,0 +1,12 @@
(require '[babashka.process :as p])
(defn rofi [s]
(let [proc (p/process
["rofi" "-i" "-dmenu" "-mesg" "Select" "-sync" "-p" "*"]
{:in s :err :inherit
:out :string})]
(:out @proc)))
(rofi (slurp *in*))
;; `echo "hi\nthere\nclj" | bb examples/rofi.clj`