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

Remove default suffix for prompts #21

Closed
passy opened this issue Jun 11, 2013 · 12 comments
Closed

Remove default suffix for prompts #21

passy opened this issue Jun 11, 2013 · 12 comments

Comments

@passy
Copy link

passy commented Jun 11, 2013

I'd like to discuss whether the a default suffix for prompts is helpful. generator-generator for example has a lot of its prompts in form of a question, so there's no need to append a colon:

screenshot from 2013-06-11 21 46 40

I would like to know what others think about this. :)

@SBoudrias
Copy link
Owner

@sindresorhus
Copy link
Contributor

I agree, I see no use in having a default suffix.

@stephenplusplus
Copy link

I like either removing the : or

if (!promptMessage.match(/[?|:]$/)) {
  promptMessage += type === 'confirm' ? '?' : ':';
}

Because:

prompt({
  type: 'confirm',
  message: 'Would you like to proceed'
}, function(){});

would be:

[?] Would you like to proceed (Y/n)

but it might look better:

[?] Would you like to proceed? (Y/n)

@robwierzbowski
Copy link

I think a user needs to know what they'll get if they press enter. Currently the jekyllrb generator grabs a user's name, email, and github user name from the .gitconfig, and gives a prompt like:

Your email: ([email protected])

Without a default, how does I know that:

Your email:

on enter will insert my email that includes my painfully long last name?

@SBoudrias
Copy link
Owner

@stephenplusplus suggestion make sense, if there's no suffix in the prompt already, we can add a default one.

I think it'll be a pretty edge case if a user don't want to use any prefix. (And I think this edge case would be better served with #18 functionnality)

@robwierzbowski
Copy link

Ha, sorry, by "default suffix" I thought we were talking about the (default option) indicator. Yeah, the colon, definitely removable.

@passy
Copy link
Author

passy commented Jun 11, 2013

@robwierzbowski Sorry, I should have been clearer in the original comment. I definitely do not want to remove those. :)

@passy
Copy link
Author

passy commented Jun 12, 2013

Another thing to add: I didn't find the part in the code for this, but if you do not provide a custom message and Inquirer generates one for you, it capitalizes the name and adds another colon, so you get two at the prompt.

@SBoudrias
Copy link
Owner

@passy I'm not sure I follow here, if you don't enter a message, Inquirer print [?] undefined:

I forced default parameter with errors messages on the lastest master to prevent weird issue and error messages. Although, I'd like to hear back from you on this bug as I believe you made a typo?

@passy
Copy link
Author

passy commented Jun 13, 2013

Interesting! I guess I just overlooked some piece of code in the generator that was responsible for dynamically creating the message. Sorry for the confusion. :)

@SBoudrias
Copy link
Owner

Now suffix only happens if the last character of the message parameter is a letter.

I tough about just removing the suffix; but that was problematic as the input could be directly glued to the message (could always add a space, but that's just throwing the ball around). So there's no big logic, but there's a safe fallback if the message haven't been suffixed by the user. Anyhow, user will have to checkout their prompt logic and adjust somehow.

I'll release this change with next 0.1.10 - not sure when, but shouldn't be too far off.

@passy
Copy link
Author

passy commented Jun 16, 2013

@SBoudrias Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants