pier-cli / pier

A Linux script management CLI written in Rust
MIT License
535 stars 33 forks source link

:feature-request: add fuzzy search menu bolow #68

Open sl5net opened 4 years ago

sl5net commented 4 years ago

may its a bit different concept. i possible please add to your to-do-list: add fuzzy search menu bolow. i tried to do something with https://github.com/sl5net/Lintalist4Linux thanks

Plommonsorbet commented 3 years ago

Hey,

Thanks for the suggestion this is something we would like to add to Pier, just haven't decided which route to go down for what kinda interface.

Here's a few two examples that I've been using if that helps you out:

Emacs (requires ivy, s.el, dash.el)

(defun pier-list-function ()
  (s-lines (shell-command-to-string "pier ls -q")))

(defun pier-run-action (alias)
  (shell-command
   (format "pier run %s"
       (shell-quote-argument
        (substring alias 0 (string-match-p " " alias))))))

(defun pier-list-ivy ()
  (interactive)
  (ivy-read "Run pier script: " (pier-list-function)
        :action 'pier-run-action))

Shell version, requires fzf

pier-fzy () {
    pier ls -q | fzf --bind='enter:execute(pier show {})+abort,ctrl-e:execute(pier edit {}),ctrl-r:execute(pier run {} | less)'
}
CHNB128 commented 3 years ago

Enough example of using pier with fzf. You can added this to your alias. Hope this will be helpful.

pier_fzf() {
  pier $(pier list | awk NR\>2 | fzf | awk '{print $1}')
}