1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
# inquirer
````{attention}
This document is irrelevant if you intend to use the {ref}`index:Classic Syntax (PyInquirer)`.
```{seealso}
{ref}`pages/prompt:prompt`
```
````
This page documents the usage of `inquirer`.
```{eval-rst}
.. automodule:: InquirerPy.inquirer
:noindex:
```
An example using `inquirer` which incorporate multiple different types of prompts:

```{eval-rst}
.. literalinclude :: ../../examples/inquirer.py
:language: python
```
```{important}
The `inquirer` module serves as an entry point to each prompt classes. Refer to
individual prompt documentation for prompt specific usage.
```
## Synchronous execution
Each prompt contains a function `execute` to start the prompt.
```{code-block} python
from InquirerPy import inquirer
def main():
result = inquirer.text(message="Name:").execute()
if __name__ == "__main__":
main()
```
## Asynchronous execution
Each prompt contains a function `execute_async` to start the prompt asynchronously.
```{code-block} python
import asyncio
from InquirerPy import inquirer
async def main():
result = await inquirer.text(message="Name:").execute_async()
if __name__ == "__main__":
asyncio.run(main())
```
|