Few years ago I stumbled upon fpp, a nice utility that would scan its input looking for possible pathnames, and present you with a terminal UI to select which ones to open / send to an external command; in a nut-shell, the urlview for local files.

Wouldn't it be nice if there was a similar program that could guess which command to run next, by looking at its input? For example, you pipe git log -n ...'s output into it, and it would output a bunch of "git show $sha1", "git show $sha2", "git show $sha3" lines (one per log entry); or you pipe into it ps aux's output, and it would ask you which process to kill.

enters cb..


Configure your .cgrc:
(cg:define-guesser git-l-git-show
    ("^([a-f0-9]{7,10}) (.*)" (commit rest))
  (format NIL "git show '~a' # ~a" commit rest))
Run a command:
> git l
224d33a Fix some copy-pasta
6fb3f7b Add support for multi item selection
56c332c Do not specify sbcl full path
Pipe its output into cg to see command guesses...
> g l | cg
git show '224d33a' # Fix some copy-pasta
git show '6fb3f7b' # Add support for multi item selection
git show '56c332c' # Do not specify sbcl full path
...or into cg-fzf to be able to select and run one of the suggestions:
> g l | cg-fzf
# you select the first suggestion
# `bash -c "git show '224d33a' # Fix some copy-pasta"` is run