smallstep / cli

🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
https://smallstep.com/cli
Apache License 2.0
3.66k stars 255 forks source link

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

Open hslatman opened 2 years ago

hslatman commented 2 years ago

Steps to Reproduce

Your Environment

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

dopey commented 2 years ago

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.