Check for affirmative answer

This commit is contained in:
sentriz 2017-08-12 01:53:54 +01:00 committed by Kurtis Rader
parent 4cf480a1a5
commit 44ef6cc87f

View File

@ -105,8 +105,13 @@ function funced --description 'Edit function definition'
echo # add a line between the parse error and the prompt
set -l repeat
set -l prompt (_ 'Edit the file again\? [Y/n]')
read -p "echo $prompt\ " repeat
if not contains $repeat n N no NO No nO
read -p "echo $prompt\ " response
if test -z "$response"
or contains $response {Y,y}{E,e,}{S,s,}
continue
else if not contains $response {N,n}{O,o,}
echo "I don't understand '$response', assuming 'Yes'"
sleep 2
continue
end
echo (_ "Cancelled function editing")