Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Respect TERM=dumb #457

Open
mislav opened this issue Oct 5, 2022 · 1 comment
Open

Respect TERM=dumb #457

mislav opened this issue Oct 5, 2022 · 1 comment

Comments

@mislav
Copy link
Collaborator

mislav commented Oct 5, 2022

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:

  • Input: just accept user input and allow input to be echoed to the terminal. If the prompt needs to ask again, do it on a new line.
  • Confirm: same as Input, but only accept "yes/no" answers or blank to confirm default.
  • Password: same as Input, but not sure if we can turn off terminal echoing, so password inputs might be visible on the terminal.
  • Multiline: not sure if we can support it? 🤔
  • Editor: easy to support
  • Select: print options with numeric indexes and ask person to input the number of their choice. But how to handle pagination? 🤔
  • MultiSelect: maybe like Select but allow comma-separated list of numbers?

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: #191
See also: #447 cli/cli#5721

@zimeg
Copy link
Contributor

zimeg commented Jan 29, 2023

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants