From 44ef6cc87f03ae35a16587daeba39a9c01f74e45 Mon Sep 17 00:00:00 2001 From: sentriz Date: Sat, 12 Aug 2017 01:53:54 +0100 Subject: [PATCH] Check for affirmative answer --- share/functions/funced.fish | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/share/functions/funced.fish b/share/functions/funced.fish index a889a42c9..e8e05a72a 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -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")