Skip to content

inquirer_console v1.0.5

Choose a tag to compare

@eusen eusen released this 31 Mar 06:10
· 8 commits to master since this release

Release Notes

Release Date: 2024-03-31

✨ New Features

  • Improved Module Export Mechanism:
    • All prompt types (Input, Confirm, Select, Checkbox, Password, Text) are now directly mounted on the global inquirer instance
    • Users can now access all prompt types directly via inquirer.Input, inquirer.Select, etc.
    • Simplified import syntax, enhancing code readability and ease of use

🔧 Improvements

  • API Experience Optimization:
    • Unified the way prompt types are referenced, making the API more intuitive
    • Maintained backward compatibility, supporting both call styles (direct class import and access through the inquirer instance)

📚 Usage Examples

Using the global inquirer instance:

from inquirer_console import inquirer

# Using prompt types mounted on the inquirer instance
name = inquirer.Input(
    message="What is your name?",
    validate=lambda val: True if val else "Name cannot be empty!"
).prompt()

# Chain calls remain unchanged
answers = inquirer.prompt([
    {
        'type': 'input',
        'name': 'name',
        'message': 'What is your name?'
    },
    {
        'type': 'list',
        'name': 'favorite_lang',
        'message': 'What is your favorite programming language?',
        'choices': ['Python', 'JavaScript', 'Rust']
    }
])

🔄 Compatibility Notes

This version is fully backward compatible with v1.0.1, requiring no changes to existing code. The new export mechanism is purely to provide a more flexible usage experience.

We recommend prioritizing the use of prompt types mounted on the inquirer instance in new projects for a more concise import experience.