kazhala / InquirerPy

:snake: Python port of Inquirer.js (A collection of common interactive command-line user interfaces)
https://inquirerpy.readthedocs.io
MIT License
350 stars 20 forks source link

Default Values in text() Prompts #64

Open Xevion opened 1 year ago

Xevion commented 1 year ago

I'm interested in getting a default value inserted into a text prompt such that the user can hit enter, or 'modify' the default prompt immediately.

For example, given the prompt Enter the uBoot directory, and without entering anything, /boot/uboot could be passed in as the 'default' input for the user. I am not talking about the default output when the user doesn't enter anything themselves - I am talking about the stateful default answer that is filled in.

? Enter the uBoot directory  /boot/uboot

The user could then clear it, edit it, etc. I am creating "menus" for editing values and it would be more helpful to be able to pass in this so that users could exit without having to re-type the value just so they could keep whatever existed before.

brodycj commented 7 months ago

This is already supported though pretty badly documented; and I recommend using filepath for this kind of input (could use some better documentation as well).

Xevion commented 7 months ago

This is already supported though pretty badly documented; and I recommend using filepath for this kind of input (could use some better documentation as well).

Unfortunately, the filepath being given isn't actually real at the time of configuration. It's not a real filesystem that you can query or navigate. Only later does the path entered become relevant.