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

Changed choose method so it can now return a default item if none is spe... #41

Closed
wants to merge 4 commits into from
Closed

Conversation

Grigore147
Copy link

By default the first item is set as default, but another one can be set by adding ">" as it's prefix.
If is set an index higher than items count than again() is called.

Ex:
items = ['one', 'two', 'three', 'four', 'five']; // will return 'one' if none is specified
items = ['one', 'two', 'three', '>four', 'five']; // will return 'four' as default

@tj
Copy link
Owner

tj commented Jan 9, 2012

im down with defaults, adding a syntax to the string itself is kinda weird though, I would rather do something like:

program.choose(list, 2, function(i){
  console.log('you chose %d "%s"', i, list[i]);
  process.stdin.destroy();
});

@Grigore147
Copy link
Author

So what about an merge with last commit wich does what you described in preview comment??

@tj tj closed this in 2beb298 Jan 15, 2012
@lightsofapollo
Copy link

As of the latest npm version 0.5.2 this change is not included.

Any idea when you plan to push this feature?

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.

3 participants