Skip to content

Commit b136f38

Browse files
committed
demo-core prompt: Remove failure case, add comment
All tests still pass, as the `return 1` case wasn't reachable given that the call to `@go.prompt_for_yes_or_no` was supplied with a default value.
1 parent 1513428 commit b136f38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libexec/demo-core.d/prompt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ _@go.prompt_demo() {
2323
@go.printf 'Nice to meet you, %s!\n' "$name"
2424

2525
if @go.prompt_for_yes_or_no 'Do you have a quest?' 'yes'; then
26-
# Default value applies if input is empty.
27-
if ! @go.prompt_for_input 'quest' $'What is your quest?\n' "$quest"; then
28-
return 1
29-
fi
26+
# Default value applies if input is empty. Since there is a default, this
27+
# won't return an error on no input.
28+
@go.prompt_for_input 'quest' $'What is your quest?\n' "$quest"
3029
elif ! @go.prompt_for_yes_or_no "Might I suggest: $quest" 'yes'; then
3130
@go.printf 'OK, no quest. Suit yourself!\n'
3231
return 1

0 commit comments

Comments
 (0)