InquirerPy icon indicating copy to clipboard operation
InquirerPy copied to clipboard

Default Values in text() Prompts

Open Xevion opened this issue 1 year ago • 2 comments

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.

Xevion avatar May 19 '23 14:05 Xevion

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).

brody4hire avatar Jan 16 '24 05:01 brody4hire

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.

Xevion avatar Jan 16 '24 06:01 Xevion