cronvel / terminal-kit

Terminal utilities for node.js
MIT License
3.1k stars 201 forks source link

.inputField() features: password and truncate #46

Open davidgatti opened 7 years ago

davidgatti commented 7 years ago

Hi @cronvel,

I just would like to say, epic work on the module, made my life definitely much easier :).

I would like to give you two suggestions for potential new features :) Basically two things the I missed while working with the module:

  1. A password field that will replace the characters with nothing, or * to hide the typed password
  2. truncate a long ass entry. For example if I have a very long API Key that wraps, it be nice if there was the possibility to say, show only max 10 characters and the rest will be hidden. For example:

Something like this. This way the UI won't brake :)

Other then that, super cool stuff :)

cronvel commented 7 years ago

@davidgatti Thanks for the praise! ;)

  1. For password, you can set the option echo to false. But that's right, it would be nice to be able to replace characters by * or whatever character instead.

  2. Are you still talking about .inputField() here?

cronvel commented 7 years ago

@davidgatti I screwed up my commit message and referenced the bad issue :s I just commited a version with a new option to .inputField(): echoChar, it solves your 1.

davidgatti commented 7 years ago

OK I will try your suggestion for Q1. About Q2 yes, I'm still referring to . inputField() :)

davidgatti commented 7 years ago

I see the Password support, it works fantastic! :D

davidgatti commented 7 years ago

Just a friendly ping, did you have a chance to think about the truncate capabilities? :)

cronvel commented 7 years ago

I will add this to my todo-list ;)

davidgatti commented 7 years ago

😍

joselevelsup commented 6 years ago

@davidgatti where do you see the password support?

cronvel commented 6 years ago

@joselevelsup Add echoChar: '*' to the options object, or whatever you want to be echoed instead of the user input.

cronvel commented 6 years ago

@joselevelsup Alternatively, use echo: false if you don't want anything to be displayed at all.