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 autocomplete fallback #137

Closed
wants to merge 1 commit into from

Conversation

elie-g
Copy link
Contributor

@elie-g elie-g commented Feb 18, 2019

Fixes #121

@lumio
Copy link
Collaborator

lumio commented Feb 18, 2019

Haha, I'm 2h too late with my PR

Just checked your code. It did not work with the following setup

const prompts = require( 'prompts' );

( async () => {
  const response = await prompts( {
    type: 'autocomplete',
    message: 'foo',
    name: 'auto',
    initial: 'val1',
    // fallback: () => 'val2',
    choices: [
      { title: 'Option 1', value: 'val1' },
      { title: 'Option 2', value: 'val2' },
    ],
  });
  console.log( response );
} )();

The values are also not selectable anylonger.

Tested it by linking the prompts with yarn link and using it in a test project with yarn link prompts.

@terkelg
Copy link
Owner

terkelg commented Feb 18, 2019

Awesome, thank you guys! This is a luxury problem. It sounds like #138 is a bit more robust right? On the other hand, it's a bit more code.

@lumio
Copy link
Collaborator

lumio commented Feb 18, 2019

@DrunkenPoney if you want, you could take parts of my PR to make yours work again.
With my changes at #138 I added string support for the initial value of autocomplete. Not sure if we really want that though.

In any case: @terkelg you decide 😄

@elie-g
Copy link
Contributor Author

elie-g commented Feb 19, 2019

@terkelg #138 is probably better. I did this at 2 AM and I was tired.

@elie-g elie-g closed this Feb 19, 2019
@elie-g elie-g deleted the autocomplete-fallback branch March 9, 2019 02:52
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.

None yet

3 participants