dotfiles/.config/fish/functions/prompt.fish

30 lines
717 B
Fish
Raw Normal View History

2026-01-28 00:57:01 +01:00
function prompt --description 'Opens a menu of a list of Strings and writes the result to stdout'
2026-03-08 23:06:13 +01:00
argparse h/help p/prompt=? placeholder=? mesg=? password -- $argv
2026-01-28 00:57:01 +01:00
or return
if set -ql _flag_help
2026-03-08 23:06:13 +01:00
echo "menu [-h|--help] [-p|--prompt=?] [--placeholder=?] [--mesg=?] [--password] [STRING ...]"
2026-01-28 00:57:01 +01:00
return 0
end
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
2026-03-08 23:06:13 +01:00
if set -ql _flag_mesg
set -a fuzzel_args "--mesg=$_flag_mesg"
end
2026-01-28 00:57:01 +01:00
if set -ql _flag_password
2026-03-08 23:06:13 +01:00
set -a fuzzel_args "--password"
2026-01-28 00:57:01 +01:00
end
2026-03-08 23:06:13 +01:00
string join -- \n $argv | fuzzel --dmenu --prompt-only='' $fuzzel_args
2026-01-28 00:57:01 +01:00
end