Skip to content

Commit

Permalink
update default password mask
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Feb 22, 2023
1 parent 6609d01 commit cc11917
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-pots-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clack/prompts': patch
---

Update default `password` mask
1 change: 0 additions & 1 deletion examples/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ async function main() {
password: () =>
p.password({
message: 'Provide a password',
mask: '🧹',
validate: (value) => {
if (!value) return 'Please enter a password.';
if (value.length < 5) return 'Password should have at least 5 characters.';
Expand Down
3 changes: 2 additions & 1 deletion packages/prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const S_RADIO_INACTIVE = s('○', ' ');
const S_CHECKBOX_ACTIVE = s('◻', '[•]');
const S_CHECKBOX_SELECTED = s('◼', '[+]');
const S_CHECKBOX_INACTIVE = s('◻', '[ ]');
const S_PASSWORD_MASK = s('▪', '•');

const S_BAR_H = s('─', '-');
const S_CORNER_TOP_RIGHT = s('╮', '+');
Expand Down Expand Up @@ -97,7 +98,7 @@ export interface PasswordOptions {
export const password = (opts: PasswordOptions) => {
return new PasswordPrompt({
validate: opts.validate,
mask: opts.mask,
mask: opts.mask ?? S_PASSWORD_MASK,
render() {
const title = `${color.gray(S_BAR)}\n${symbol(this.state)} ${opts.message}\n`;
const value = this.valueWithCursor;
Expand Down

0 comments on commit cc11917

Please sign in to comment.