Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@clack/core,@clack/prompts): Adding a new warn state to the validate method #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hcl-z
Copy link

@hcl-z hcl-z commented Jun 20, 2024

At present, validate method can only return a string, and can only indicate a state (error state), but sometimes you may just want to remind the user of some precautions rather than directly preventing the user to continue to execute the programme, so I modified the type of return of validate method.

export type ValidateType = ((value: any) => ({ status: 'error' | 'warn', message: string } | void));

The error and warn states are triggered in the same way, the difference between the two is that the terminal won't stop the user from continuing after the warn is triggered, you just need to press Enter again to pass the current option.

2024-06-20.22.35.38.mov

@hcl-z hcl-z changed the title feat: Adding a new warn state to the validate method feat(@clack/core,@clack/prompt): Adding a new warn state to the validate method Jun 20, 2024
@hcl-z hcl-z changed the title feat(@clack/core,@clack/prompt): Adding a new warn state to the validate method feat(@clack/core,@clack/prompts): Adding a new warn state to the validate method Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant