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

ISSUE-3062: Updated the code to optionally pass custom validate_error… #3554

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

Conversation

vivekkeshore
Copy link

@vivekkeshore vivekkeshore commented Nov 8, 2024

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Issue - #3062

Updated the code to optionally pass custom validate_error_message while making Prompt, IntPrompt, FloatPrompt and Confirm ask method.

Example

    answer = Confirm.ask(
        "continue",
        console=console,
        stream=io.StringIO(INPUT),
        default=True,
        validate_error_message="[prompt.invalid]Per favore digita S o N",
    )
    validate_error_message = "Invalid Integer. Enter a valid integer"
    number = IntPrompt.ask(
        "Enter a number",
        console=console,
        stream=io.StringIO(INPUT),
        validate_error_message=validate_error_message,
    )

…_message while making Prompt, IntPrompt, FloatPrompt and Confirm ask method.
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