From cc11917a3227c7fee2a755c0be498421a28c15f6 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 22 Feb 2023 06:13:46 -0600 Subject: [PATCH] update default password mask --- .changeset/mean-pots-check.md | 5 +++++ examples/basic/index.ts | 1 - packages/prompts/src/index.ts | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/mean-pots-check.md diff --git a/.changeset/mean-pots-check.md b/.changeset/mean-pots-check.md new file mode 100644 index 00000000..404ddc1d --- /dev/null +++ b/.changeset/mean-pots-check.md @@ -0,0 +1,5 @@ +--- +'@clack/prompts': patch +--- + +Update default `password` mask diff --git a/examples/basic/index.ts b/examples/basic/index.ts index d6bbcfe5..8af7a7a3 100644 --- a/examples/basic/index.ts +++ b/examples/basic/index.ts @@ -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.'; diff --git a/packages/prompts/src/index.ts b/packages/prompts/src/index.ts index 5d0fa5a7..ca08cf3d 100644 --- a/packages/prompts/src/index.ts +++ b/packages/prompts/src/index.ts @@ -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('╮', '+'); @@ -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;