5 ms·
Percol: An interactive grep tool in your terminal
- agumonkey 12y agoLet's rewrite all major userspace tools this way, or maybe use emacs ? I don't know. ps: not sarcastic at all.
- kachnuv_ocasek 12y agoI agree with your second idea. I don't see how it's different from Vim or Emacs.
- agumonkey 12y agoIt's just a good idea that was never (AFAIK) done for shell only interactions. Often good to be able to have progressive enhancement (people not allowed to install emacs say).
- brianpgordon 12y agoWhat I was impressed by is git checkout $(git branch | percol) to select the branch name interactively from a menu. How would you do that in Vim or Emacs?
- 0x0 12y agoZsh completion with the menu style can do that, git checkout <tab> and you get a browseable list of branch names.
- agumonkey 12y agoor dmenu
- dhamidi 12y agoFunnily enough, I recently implemented something akin to percol: https://github.com/dhamidi/tmenu https://github.com/dhamidi/tmenu It actually tries to be dmenu for the terminal.
- agumonkey 12y agoGlorious, I was about to start a similar thing (in python though). Time to play with your toy. ps: I'd add a readline/inputrc alias for '| tmenu '
- dhamidi 12y agoWould you mind sharing what that alias would look like and do? I can only imagine it appending the string "| tmenu" to the current line, eventually pressing Return for the user as well.
- agumonkey 12y ago$ bind '"\C-L": "\| less -S \C-j"' Warning: seems like GNU readline isn't case sensitive so C-L === C-l thus, in this example, C-l default behavior (clear screen?) is overridden. I didn't RTFM so trust yourself.
- agumonkey 12y agoAlso, a redditor told me about slmenu (dmenu parody for shell) http://www.reddit.com/r/linux/comments/283ziw/tmenu_dmenu_for_ttyshell/ci7cat1 http://www.reddit.com/r/linux/comments/283ziw/tmenu_dmenu_fo...
- dhamidi 12y agoUpdate: the README now describes the available key bindings and gives more usage examples.
- 0x0 12y agoGoogle says it's an x11 app? I prefer something that works on random ssh connections and is more "inline" to the current command context
- agumonkey 12y agoHa what a moron I am. The funniest part is that I was ranting on #python about the need for a tui only version of that. ps: even funnier, someone just posted a personal project doing just that.
- chrismonsanto 12y ago> How would you do that in [...] Emacs? Use Magit, which is probably the best Git client anyway.
- dhamidi 12y agoRegarding Emacs: git ships with Emacs integration <https://github.com/git/git/tree/master/contrib/emacs> https://github.com/git/git/tree/master/contrib/emacs>. Note that most likely git.el is not on your load-path. After it is loaded, you can use M-x git-status to interactively stage, diff and commit files. In the git-status buffer you can checkout a branch with C-c C-o. If helm is installed, you'll get something similar to percol right in Emacs.
- felixr 12y agoCheck out vipe, which is included in Joey Hess' moreutils [1]. It lets you edit a pipe in vim. You can use it the same way as percol. [1] https://joeyh.name/code/moreutils/ https://joeyh.name/code/moreutils/
- natch 12y agoThe gif animation is ridiculously fast. Can't really see what's going on. If it's not needed, you could just delete it.
- rcthompson 12y agoThe gif animation is confusing to me because the shell appears to be extensively customized, so I can't tell what is percol and what is crazy zshell customization.
- nsxwolf 12y agoI found it to be not too fast once I started focusing on what was being input instead of the changes to the output.
- 0x0 12y agozsh already has a built in menu selection system that looks a lot like the animated .gif here. Check out "zstyle ':completion:*' menu select"
- rcthompson 12y agoI believe that is what is being shown. The tool is (I think) being demonstrated in a zshell with that feature (and probabaly countless others) turned on, so it is difficult to tell what is shell and what is percol. Or maybe not. The point is I don't know.
- morsch 12y agoI just tried it out in bash, it works pretty much the same way it does in the gif. This description of the functionality in the readme is succinct: percol - receives input lines from stdin or a file, - lists up the input lines, - waits for your input that filter/select the line(s), - and finally outputs the selected line(s) to stdout.
- lnkmails 12y agoYou made my day.
- jabagawee 12y agoReminds me of Gary Bernhardt's selecta [1]. [1] https://github.com/garybernhardt/selecta https://github.com/garybernhardt/selecta
- jkarni 12y agoI worked on a similar project: a tool that (primarily) tees it's stdin to your tty before you decide how to continue your pipe[1], which is a little more general, though it's admittedly less polished or nice. I think there's an interesting space in making the process of writing commands more interactive, though doing that really well will involve an intelligent solution to the problem of commands with side effects. [1] https://github.com/jkarni/extendp https://github.com/jkarni/extendp
- rawland 12y agoActually I downloaded https://github.com/hchbaw/auto-fu.zsh https://github.com/hchbaw/auto-fu.zsh after seeing this README.md.
- kroeber 12y agofzf [1] is another nice alternative to this. [1] https://github.com/junegunn/fzf https://github.com/junegunn/fzf