AlecAivazis / survey

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

Respect `TERM=dumb` #457

Open mislav opened 1 year ago

mislav commented 1 year ago

Terminal applications should assume that when TERM=dumb is set, the terminal has no color support, no cursor moving support, nor support for redrawing parts of the screen.

The width of the terminal is assumed to be 80 and text longer than that might wrap to the next line.

How Survey could support this:

Covering all of this is a lot of work and I'm not sure if it's even feasible. Opening this for thoughts/discussion.

Previously: https://github.com/AlecAivazis/survey/issues/191 See also: https://github.com/AlecAivazis/survey/issues/447 https://github.com/cli/cli/issues/5721

zimeg commented 1 year ago

Handling Input, Confirm, and Password in that manner seems sensible to me! Silencing the input for Password would be nice if allowed, but I'm also unsure that it is...

With Multiline, would it be possible to read lines similar to Input, but continue prompting for more input (with a blank prompt) until two empty lines are received? These lines could then be concatenated to form the response.

For Select and MultiSelect, I think the index-based approach makes sense. To support pagination, an empty input could then be used to print the next page? Another option is to ignore pagination altogether and display all options at once, but this may be problematic if scrolling is not allowed...

And I agree that this is a big tackle but think it would be good to support this! Happy to lend a hand here if we want to move this forward!