dotfiles/.config/fish/functions/menu.fish

26 lines
600 B
Fish
Raw Normal View History

2025-12-30 22:04:10 +01:00
function menu --description 'Opens a menu of a list of Strings and writes the result to stdout'
2026-01-28 00:57:01 +01:00
argparse h/help p/prompt=? index -- $argv
2025-12-30 22:04:10 +01:00
or return
if set -ql _flag_help
2026-01-28 00:57:01 +01:00
echo "menu [-h|--help] [-p|--prompt=?] [--placeholder] [--index] [STRING ...]"
2025-12-30 22:04:10 +01:00
return 0
end
2026-01-28 00:57:01 +01:00
set fuzzel_args
if set -ql _flag_prompt
set -a fuzzel_args "--prompt=$_flag_prompt"
end
if set -ql _flag_placeholder
set -a fuzzel_args "--placeholder=$_flag_placeholder"
end
if set -ql _flag_index
set -a fuzzel_args "--index"
end
2026-03-26 23:10:37 +01:00
string unescape (string join -- \n $argv) | fuzzel --dmenu $fuzzel_args
2025-12-30 22:04:10 +01:00
end