cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: interactive inputs using small width terminal result in multi line output

Open hslatman opened this issue 3 years ago • 1 comments

Steps to Reproduce

  • Set a small terminal width
  • Invoke an interactive command (e.g. step ssh config --team ... for a team that was stored before)
  • Enter interactive input

Your Environment

  • OS - macOS 12.0.1
  • step CLI Version - 0.20.0 (dev)

Expected Behavior

Prompt and input values are shown once on the screen

Actual Behavior

Prompt and input values are shown multiple times (observed 3 times)

See the below example output. The error seems to occur if the prompt is longer than the terminal width. In this case crt fell off to the next line. The issue may have something to do with how the prompt updates the yes/no icon when a value is provided.

 ✘ herman@zetix  ~/Development/cli   acme-attestation ±  go run cmd/step/main.go ssh config --team herman-test
✗ Would you like to overwrite /Users/herman/.step/authorities/ssh.herman-test/certs/root_ca.
✔ Would you like to overwrite /Users/herman/.step/authorities/ssh.herman-test/certs/root_ca.
✔ Would you like to overwrite /Users/herman/.step/authorities/ssh.herman-test/certs/root_ca.
✔ Would you like to overwrite /Users/herman/.step/authorities/ssh.herman-test/certs/root_ca.crt [y/n]: y
The root certificate has been saved in /Users/herman/.step/authorities/ssh.herman-test/certs/root_ca.crt.
✗ Would you like to overwrite /Users/herman/.step/authorities/ssh.herman-test/config/defaults.json [y/n]: █

Additional Context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

hslatman avatar Jul 05 '22 15:07 hslatman

We need to replace the ui package that we're using. We've already wrapped the methods that we use, so this should be straightforward once we pick a new package.

dopey avatar Jul 07 '22 19:07 dopey