mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Accept return as a valid answer to 'Edit the file again?'
Also, check for affirmative answer so a random string isn't taken as a "yes" response.
This commit is contained in:
parent
058e23720f
commit
72173a93a7
1 changed files with 7 additions and 4 deletions
|
@ -105,10 +105,13 @@ function funced --description 'Edit function definition'
|
||||||
echo # add a line between the parse error and the prompt
|
echo # add a line between the parse error and the prompt
|
||||||
set -l repeat
|
set -l repeat
|
||||||
set -l prompt (_ 'Edit the file again\? [Y/n]')
|
set -l prompt (_ 'Edit the file again\? [Y/n]')
|
||||||
while test -z "$repeat"
|
read -p "echo $prompt\ " response
|
||||||
read -p "echo $prompt\ " repeat
|
if test -z "$response"
|
||||||
end
|
or contains $response {Y,y}{E,e,}{S,s,}
|
||||||
if not contains $repeat n N no NO No nO
|
continue
|
||||||
|
else if not contains $response {N,n}{O,o,}
|
||||||
|
echo "I don't understand '$response', assuming 'Yes'"
|
||||||
|
sleep 2
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
echo (_ "Cancelled function editing")
|
echo (_ "Cancelled function editing")
|
||||||
|
|
Loading…
Reference in a new issue