read_confirm reads user confirmation (yn) and returns status 0 or 1
function read_confirm --description 'Ask the user for confirmation' --argument prompt
if test -z "$prompt"
set prompt "Do you want to continue? [Y/n]: "
end
while true
read -l -P $prompt confirm
switch $confirm
case N n
return 1
case '' Y y
return 0
end
end
end