Skip to content

Commit 1fab46a

Browse files
feat(@clack/core): allow tab completion for placeholders
1 parent ef7d414 commit 1fab46a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/src/prompts/prompt.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ export default class Prompt {
166166
if (char && (char.toLowerCase() === 'y' || char.toLowerCase() === 'n')) {
167167
this.emit('confirm', char.toLowerCase() === 'y');
168168
}
169+
if (char === '\t' && this.opts.placeholder) {
170+
if (!this.value) {
171+
this.rl.write(this.opts.placeholder);
172+
this.emit('value', this.opts.placeholder);
173+
}
174+
}
169175
if (char) {
170176
this.emit('key', char.toLowerCase());
171177
}

0 commit comments

Comments
 (0)