[Linux] Extend rofi_command to include aliases and functions
This commit is contained in:
parent
de6fb432e1
commit
9496c2c103
@ -1,11 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env zsh
|
||||||
function get_all_commands {
|
|
||||||
IFS=:
|
get_all_executables () {
|
||||||
for exec_path in $PATH; do
|
for exec_path in $path; do
|
||||||
test -r "$exec_path" && \
|
test -r "$exec_path" && \
|
||||||
find "$exec_path" -maxdepth 1 -executable ! -type d -printf "%f\n"
|
find "$exec_path" -maxdepth 1 -executable ! -type d -printf "%f\n"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
selected=$(get_all_commands | rofi -dmenu -i)
|
get_all_functions () {
|
||||||
"$selected"
|
print -l ${(ok)functions}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_all_aliases () {
|
||||||
|
alias | cut -d = -f 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
selected=$({ get_all_executables; get_all_aliases; get_all_functions; } | rofi -dmenu -i -kb-custom-1 "Alt+c")
|
||||||
|
rofi_exit="$?"
|
||||||
|
args=""
|
||||||
|
case "$rofi_exit" in
|
||||||
|
1)
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
10)
|
||||||
|
args=$(echo "" | rofi -dmenu)
|
||||||
|
esac
|
||||||
|
eval "$selected $args"
|
||||||
|
Loading…
Reference in New Issue
Block a user