This command provides the features:
- Show an appropriate menu for input type.
- Choose an action from the menu.
- Only macOS so far.
$ go install github.com/nobeans/peco-actions@latest
usage: peco-actions [option]
options:
-h,--help show this usage
-v,--version display the version
-D,--debug display the version
--file actions for file path(s)
--process actions for a process id
--server actions for a host/IP-address
--git actions for a commit id
--docker-container actions for a docker container
--docker-image actions for a docker image
--generic actions for generic only using adhoc menu
eval_peco_action() {
local action="$*"
if [ -n "$action" ]; then
echo "$fg_bold[yellow]>> $fg_bold[cyan]$action$reset_color" >&2
# Add command history
print -s $action
# Run by eval to handle arguments including spaces correctly
# http://labs.opentone.co.jp/?p=5651
eval $action
fi
}
$ eval_peco_action $(ls -1 | peco-actions --file)
$ eval_peco_action $(ps | peco | awk '{ print $1 }' | peco-actions --process)
function eval_peco_action
set -l action "$argv"
[ -z "$action" ]; and return
set_color yellow
echo -n ">> " >&2
set_color cyan
echo "$action" >&2
set_color white
# Add command history
fish_add_history "$action"
# Run by eval to handle arguments including spaces correctly
eval $action
end
$ eval_peco_action (ls -1 | peco-actions --file)
$ eval_peco_action (ps | peco | awk '{ print $1 }' | peco-actions --process)