29 lines
717 B
Fish
29 lines
717 B
Fish
function prompt --description 'Opens a menu of a list of Strings and writes the result to stdout'
|
|
argparse h/help p/prompt=? placeholder=? mesg=? password -- $argv
|
|
or return
|
|
|
|
if set -ql _flag_help
|
|
echo "menu [-h|--help] [-p|--prompt=?] [--placeholder=?] [--mesg=?] [--password] [STRING ...]"
|
|
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
|
|
|
|
if set -ql _flag_mesg
|
|
set -a fuzzel_args "--mesg=$_flag_mesg"
|
|
end
|
|
|
|
if set -ql _flag_password
|
|
set -a fuzzel_args "--password"
|
|
end
|
|
|
|
string join -- \n $argv | fuzzel --dmenu --prompt-only='' $fuzzel_args
|
|
end
|