-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Option name and value are reversed #1
Comments
Your issues are awesome! thank you. Well written and very clear, which makes it easy to act on and fix the problems described. again, thank you! I'm on it |
No problem. This one I thought I might have miscategorized. I went digging and I think part the issue is actually all the way down in prompt-choices, but I don't understand enough of the layers to trace it properly. In general it looks like Choice.prototype.render = function(idx, options) {
// ...
return this.value; And Object.defineProperty(Choice.prototype, 'line', {
// ...
set: function(line) {
if (typeof line === 'string') this.value = line; And up in Checkbox.prototype.renderAnswer = function() {
var keys = this.choices.checked.map(function(choice) {
return typeof choice === 'string' ? choice : choice.value; I'm sure you've got a better grasp than I do of the implications here, but it does look like this particular one is pretty pervasive. |
fwiw, I probably did this because we've been refactoring incrementally to get closer to using a redux-like stateless object for rendering. Soon, when I have enough time, I'll just refactor everything to do that at once. The APIs for Enquirer and prompts shouldn't change much if at all, but it will make it much easier to understand how the prompts work internally, how to customize them, and how to debug for stuff like this. |
The sample code in
README.md
shows how the displayed option string and the corresponding answer string can be different. But running the example seems to have the two strings reversed.For instance:
I would expect this to display as
Overwrite this one and all next
. But here is what I get when I run that sample:The text was updated successfully, but these errors were encountered: