AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.09k stars 355 forks source link

Extend editor prompt #176

Closed MarkusFreitag closed 5 years ago

MarkusFreitag commented 5 years ago

Currently I have the usecase that I would like to prefill the tempfile before it gets opened by the editor. I'm happy to create a PR for this feature, what do you think about it? @AlecAivazis

AlecAivazis commented 5 years ago

Hey @MarkusFreitag!

The Editor prompt has a field called AppendDefault which should do what you want if you set to true and set the Default value of the struct to the prefilled value.

MarkusFreitag commented 5 years ago

Ah very nice, thats exactly what I'm looking for. While testing this out I ran into another issue. My default is part of a textfile, so rendering it into the prompt results in an exploding prompt :sweat_smile: Maybe we could add a switch to turn that off?

MarkusFreitag commented 5 years ago

Which also already exists....so I will close this one :+1:

AlecAivazis commented 5 years ago

:D i was about to mention that. Lemme know if you run into any more problems!