Feat (password): add option to toggle password visibility
Implementation of the feature request idea #1330
Steps:
- [x] Add basic functionality to skip the transform function
- [x] Add option to show or hide the password
- [x] Add tests
- [ ] Add documentation
- [ ] Decide the shortcut to use
- [ ] Decide how to manage the UX
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
11bbb4b) 94.48% compared to head (ae62463) 94.54%. Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1334 +/- ##
==========================================
+ Coverage 94.48% 94.54% +0.06%
==========================================
Files 51 51
Lines 4457 4476 +19
Branches 775 780 +5
==========================================
+ Hits 4211 4232 +21
+ Misses 241 239 -2
Partials 5 5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I started implementing the feature request of #1330 I still have to add tests, and handle the UX
Moreover, we also need to decide how we should call the new options
@SBoudrias is there a way to test keyboard combinations, like CTRL + space?
is there a way to test keyboard combinations, like CTRL + space?
Not at the moment, we should definitively add it to the testing library though!
is there a way to test keyboard combinations, like CTRL + space?
Not at the moment, we should definitively add it to the testing library though!
I will look into this further, since I think is not that difficult to add to the library, and it would allow us to write tests for this new feature
is there a way to test keyboard combinations, like CTRL + space?
Not at the moment, we should definitively add it to the testing library though!
I will look into this further, since I think is not that difficult to add to the library, and it would allow us to write tests for this new feature
Quick update: to allow for testing keyboard combinations is relatively easy to implement. We just need to add to @inquirer/testing an additional event, which exposes all the parameters a 'keypress' event supports
export interface Key {
name?: string | undefined;
ctrl?: boolean | undefined;
meta?: boolean | undefined;
shift?: boolean | undefined;
}
We just need to decide whether to implement a new function, modify the current keypress without a breaking change or modify it with a breaking change. I would say it would be better to implement a new function or to modify the keypress function without introducing a breaking change, since the option of passing keyboard combinations/shortcuts is less used than passing normal key presses
Separating the rewrite from the new feature was the right choice!
I'm still experimenting with ideas on how to implement this feature but I have not yet found something which works consistently between different terminals
I think that if we want to ship this feature, in the end we need to find a shortcut which works on most of them and accept that in some environments it won't work as expected
If only there was a way to get which keyboard shortcuts are available in a give environment...