Skip to content

Commit dc1483c

Browse files
feat: Fix validate function for text when value is empty with default value
1 parent 9fd94e2 commit dc1483c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/core/src/prompts/text.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@ export default class TextPrompt extends Prompt<string> {
3939
this.value = '';
4040
}
4141
});
42+
this.on('key', () => {
43+
if (!this.value) {
44+
this.value = opts.defaultValue;
45+
}
46+
});
4247
}
4348
}

0 commit comments

Comments
 (0)