Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scripts): confirm script should default to Y #321

Merged
merged 1 commit into from
Aug 10, 2024
Merged

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Aug 10, 2024

The confirm helper function used in our build scripts prints "[Y/n]", which suggests that "yes" is the default option. However, if you press enter, it just says "invalid input" and retries, which is not what it claims to do. This commit fixes that.

For example, a test script like:

#!/usr/bin/env bash

source scripts/_util.sh

if confirm "test"; then
    echo "ok you confirmed"
else
    echo "you didn't confirm"
fi

will now default to "yes" if you just press enter:

$ ./test/sh
test [Y/n]
ok you confirmed

The `confirm` helper function used in our build scripts prints "[Y/n]",
which suggests that "yes" is the default option. However, if you press
enter, it just says "invalid input" and retries, which is not what it
claims to do. This commit fixes that.

For example, a test script like:

```bash
#!/usr/bin/env bash

source scripts/_util.sh

if confirm "test"; then
    echo "ok you confirmed"
else
    echo "you didn't confirm"
fi
```

will now default to "yes" if you just press enter:
```console
~ ./test/sh
test [Y/n]
ok you confirmed
```
@hawkw hawkw requested a review from spookyvision August 10, 2024 16:07
@hawkw hawkw merged commit a6ba1c3 into main Aug 10, 2024
10 checks passed
@hawkw hawkw deleted the eliza/fix-confirm branch August 10, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant