bullet_train
bullet_train copied to clipboard
`bin/configure` behaves differently for y/n questions when ENTER is pressed (without answering y or n)
I noticed that bin/configure
is not consistent when simply pressing ENTER for yes/no questions.
For example, from code:
input = ask "Try proceeding with Node #{actual_node} anyway? [y/n]"
if input.downcase[0] == "n"
exit
end
Here, if user types anything other than n
, it is considered as "YES".
Here, however, is completely opposite:
skip_github = ask "Continue setting up with GitHub? [y/n]"
if skip_github.downcase[0] == "y"
# ...
If user types anything other than y
, it is considered as-if he typed n
.
What I've seen in some other CLI tools is that the default answer is uppercased.
So instead of:
input = ask "Try proceeding with Node #{actual_node} anyway? [y/n]"
it would be:
input = ask "Try proceeding with Node #{actual_node} anyway? [Y/n]"
And instead of:
skip_github = ask "Continue setting up with GitHub? [y/n]"
it would be:
skip_github = ask "Continue setting up with GitHub? [y/N]"
One added benefit of switching to this convention is that we don't have to change a single line of code of functionality. Everything will continue working like it's been working, but it will be clearer to end user what happens if he simply presses ENTER (what's the default that will happen).
This still doesn't account for user typing in Y
and then that being interpreted as "NO", but I think the Y/n
and y/N
is a good first step in the right direction.