-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Load more/append to list #1487
Comments
Hi, thanks for the question. This isn't a feature supported in any versions - it might be through a plugin, but I don't see one documented. As is, I think this would be better suited for a custom prompt. I feel pagination APIs would add a large surface to the core; and I'm not yet convinced of how wide the need for this is. I'm happy to document a custom prompt in the readme plugins. |
Yea, i am looking at making a custom prompt, but I'm confused by the docs/existing plugins. None of them seem to be written i the same manner, and I can't figure out what I need to do for the older version of inquirer. The docs seem to suggest they are for @inquirer/prompts and not the old version. Would you happen to have a boilerplate custom prompt for the old version that I can look at? |
If you update to If you don't update inquirer, I'd still recommend doing it this way. But then you mix the standalone prompt function you create and There's no documentation for the old class style plugins - these were all hacked together hacking into internal APIs. |
With @inquirer/prompts, how do you do ask multiple questions? In the legacy version, it was I might be able to upgrade, as the custom prompt I want to write would replace |
So the new API really wants to simplify flow controls. The flow utilities were useful when launching in Node 4. At that time there was no promises, etc. Now it's not useful. What I do today is basically: const name = await input();
const age = await number();
const parentalApproval = age < 18 ? await confirm() : true; |
Lovely I thought as much. Will definitely give the new version a go and try a custom prompt! |
@SBoudrias hmm, so i have tried creating a custom prompt, and to be perfectly honest, it's super difficult trying to figure it out from the existing prompts and the docs, which are very confusing, with no examples. Do you have any better documentation on how to create a prompt? |
Not as of now, the documentation is a bit raw I'll admit - it's not yet been a focus area. Are you somewhat familiar with React hooks? That would go a long way understanding the APIs. |
I'm not sadly. I'm pure backend 😂 |
I might start there then 😄 https://react.dev/reference/react/hooks - |
Took some time after work to write quite a bit more documentation on the patterns to create custom prompts. I'd appreciate feedback from your experience. |
Using the older version of Inquirer, is there a way to load a list, and have a way to append to the list?
EG I pull list data from an external API, but just the first page, and the list shows a "more" option which loads and appends page 2 etc etc
The text was updated successfully, but these errors were encountered: