Skip to content

Commit

Permalink
feat(prompt): add hideDefault option (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Apr 6, 2022
1 parent 079b4ba commit dc460b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prompt/_generic_prompt.ts
Expand Up @@ -16,6 +16,7 @@ export interface GenericPromptKeys {
export interface GenericPromptOptions<T, V> {
message: string;
default?: T;
hideDefault?: boolean;
validate?: (value: V) => ValidateResult;
transform?: (value: V) => T | undefined;
hint?: string;
Expand Down Expand Up @@ -191,7 +192,9 @@ export abstract class GenericPrompt<

protected defaults(): string {
let defaultMessage = "";
if (typeof this.settings.default !== "undefined") {
if (
typeof this.settings.default !== "undefined" && !this.settings.hideDefault
) {
defaultMessage += dim(` (${this.format(this.settings.default)})`);
}
return defaultMessage;
Expand Down

0 comments on commit dc460b6

Please sign in to comment.