inquirer-textual 0.3.0__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.github/workflows/release.yml +1 -1
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/PKG-INFO +3 -42
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/README.md +1 -38
- inquirer_textual-1.0.0/docs/examples/prompts/checkbox.gif +0 -0
- inquirer_textual-1.0.0/docs/faq.md +6 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/index.md +2 -11
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/prompt_checkbox.py +4 -3
- inquirer_textual-1.0.0/examples/prompt_multi.py +18 -0
- inquirer_textual-0.3.0/examples/prompt_editor.py → inquirer_textual-1.0.0/examples/prompt_number.py +1 -1
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/prompt_secret.py +2 -2
- inquirer_textual-1.0.0/examples/prompt_select.py +6 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/prompt_text.py +2 -2
- inquirer_textual-1.0.0/examples/shortcuts.py +7 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/InquirerApp.py +17 -23
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/Choice.py +0 -3
- inquirer_textual-1.0.0/inquirer_textual/common/ChoiceLabel.py +18 -0
- inquirer_textual-1.0.0/inquirer_textual/common/Result.py +15 -0
- inquirer_textual-1.0.0/inquirer_textual/prompts.py +76 -0
- inquirer_textual-1.0.0/inquirer_textual/version.py +1 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerCheckbox.py +13 -29
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerConfirm.py +5 -9
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerMulti.py +6 -7
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerNumber.py +9 -18
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerSecret.py +2 -2
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerSelect.py +5 -5
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerText.py +3 -7
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerWidget.py +2 -8
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/mkdocs.yml +0 -8
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/pyproject.toml +4 -18
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/test_InquirerApp.py +0 -1
- inquirer_textual-1.0.0/tests/widgets/test_InquirerCheckbox.py +31 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerConfirm.py +0 -12
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerMulti.py +31 -36
- inquirer_textual-1.0.0/tests/widgets/test_InquirerNumber.py +9 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerSecret.py +0 -12
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerSelect.py +1 -15
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerText.py +0 -14
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/uv.lock +399 -30
- inquirer_textual-0.3.0/docs/examples/prompts/checkbox.gif +0 -0
- inquirer_textual-0.3.0/docs/examples/prompts/editor.gif +0 -0
- inquirer_textual-0.3.0/docs/examples/prompts/editor.md +0 -11
- inquirer_textual-0.3.0/docs/examples/prompts/editor.tape +0 -17
- inquirer_textual-0.3.0/docs/examples/prompts/external.gif +0 -0
- inquirer_textual-0.3.0/docs/examples/prompts/external.md +0 -12
- inquirer_textual-0.3.0/docs/examples/prompts/external.tape +0 -24
- inquirer_textual-0.3.0/docs/examples/prompts/path.gif +0 -0
- inquirer_textual-0.3.0/docs/examples/prompts/path.md +0 -11
- inquirer_textual-0.3.0/docs/examples/prompts/path.tape +0 -10
- inquirer_textual-0.3.0/docs/examples/prompts/pattern.gif +0 -0
- inquirer_textual-0.3.0/docs/examples/prompts/pattern.md +0 -12
- inquirer_textual-0.3.0/docs/examples/prompts/pattern.tape +0 -12
- inquirer_textual-0.3.0/docs/faq.md +0 -11
- inquirer_textual-0.3.0/docs/getting-started/index.md +0 -39
- inquirer_textual-0.3.0/docs/getting-started/simple_multi_prompt.gif +0 -0
- inquirer_textual-0.3.0/docs/getting-started/simple_multi_prompt.py +0 -9
- inquirer_textual-0.3.0/docs/getting-started/simple_multi_prompt.tape +0 -14
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompt.gif +0 -0
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompt.py +0 -5
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompt.tape +0 -10
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompts.gif +0 -0
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompts.py +0 -6
- inquirer_textual-0.3.0/docs/getting-started/simple_text_prompts.tape +0 -14
- inquirer_textual-0.3.0/docs/reference/editor.md +0 -3
- inquirer_textual-0.3.0/docs/reference/path.md +0 -3
- inquirer_textual-0.3.0/docs/reference/pattern.md +0 -3
- inquirer_textual-0.3.0/examples/alternatives/inquirerpy/main.py +0 -34
- inquirer_textual-0.3.0/examples/alternatives/python-inquirer/main.py +0 -34
- inquirer_textual-0.3.0/examples/prompt_external.py +0 -51
- inquirer_textual-0.3.0/examples/prompt_multi.py +0 -18
- inquirer_textual-0.3.0/examples/prompt_number.py +0 -5
- inquirer_textual-0.3.0/examples/prompt_path.py +0 -6
- inquirer_textual-0.3.0/examples/prompt_pattern.py +0 -6
- inquirer_textual-0.3.0/examples/prompt_select.py +0 -6
- inquirer_textual-0.3.0/examples/shortcuts.py +0 -11
- inquirer_textual-0.3.0/inquirer_textual/common/AppConfig.py +0 -9
- inquirer_textual-0.3.0/inquirer_textual/common/ChoiceLabel.py +0 -27
- inquirer_textual-0.3.0/inquirer_textual/common/InquirerResult.py +0 -24
- inquirer_textual-0.3.0/inquirer_textual/common/StandardTheme.py +0 -10
- inquirer_textual-0.3.0/inquirer_textual/prompts.py +0 -88
- inquirer_textual-0.3.0/inquirer_textual/version.py +0 -1
- inquirer_textual-0.3.0/inquirer_textual/widgets/InquirerEditor.py +0 -72
- inquirer_textual-0.3.0/inquirer_textual/widgets/InquirerPath.py +0 -93
- inquirer_textual-0.3.0/inquirer_textual/widgets/InquirerPattern.py +0 -169
- inquirer_textual-0.3.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_with_pattern.svg +0 -151
- inquirer_textual-0.3.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_with_pointer.svg +0 -150
- inquirer_textual-0.3.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_without_pointer.svg +0 -150
- inquirer_textual-0.3.0/tests/common/test_ChoiceLabel.py +0 -37
- inquirer_textual-0.3.0/tests/widgets/__init__.py +0 -0
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot_select_value.svg +0 -151
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerEditor/test_snapshot.svg +0 -152
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerPath/test_snapshot.svg +0 -153
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerPath/test_snapshot_with_default_value.svg +0 -154
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerPath/test_validation_failure.svg +0 -154
- inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerPattern/test_snapshot_pattern_search.svg +0 -155
- inquirer_textual-0.3.0/tests/widgets/test_InquirerCheckbox.py +0 -62
- inquirer_textual-0.3.0/tests/widgets/test_InquirerEditor.py +0 -23
- inquirer_textual-0.3.0/tests/widgets/test_InquirerExternal.py +0 -35
- inquirer_textual-0.3.0/tests/widgets/test_InquirerNumber.py +0 -23
- inquirer_textual-0.3.0/tests/widgets/test_InquirerPath.py +0 -44
- inquirer_textual-0.3.0/tests/widgets/test_InquirerPattern.py +0 -52
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.capm.yml +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.github/dependabot.yml +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.github/workflows/code-analysis.yml +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.github/workflows/documentation.yml +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.github/workflows/main.yml +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/.gitignore +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/CHANGELOG.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/LICENSE +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/assets/favicon.ico +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/assets/logo-light.png +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/checkbox.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/checkbox.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.gif +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.tape +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/checkbox.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/confirm.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/multi.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/number.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/secret.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/select.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/docs/reference/text.md +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/app.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/app_header.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/app_shortcuts.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/prompt_confirm.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/examples/validator.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/__init__.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/ChoiceCheckboxLabel.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/InquirerHeader.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/PromptMessage.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/Shortcut.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/common/__init__.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/__init__.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/__init__.py +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/__snapshots__/test_InquirerApp/test_snapshot_shortcut.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/__snapshots__/test_InquirerApp/test_snapshot_shortcut_no_description.svg +0 -0
- {inquirer_textual-0.3.0/tests/common → inquirer_textual-1.0.0/tests/widgets}/__init__.py +0 -0
- /inquirer_textual-0.3.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot_select_items.svg → /inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot_custom_chars.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot_default_yes.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input_pick_default.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fourth_input.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_second_input.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_third_input.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerNumber/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSecret/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSecret/test_snapshot_hide_input.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_fullscreen.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_mandatory.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_not_mandatory.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerText/test_snapshot.svg +0 -0
- {inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerText/test_snapshot_with_default_value.svg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: inquirer-textual
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Inquirer based on Textual
|
|
5
5
|
Project-URL: Changelog, https://github.com/robvanderleek/inquirer-textual/blob/master/CHANGELOG.md
|
|
6
6
|
Project-URL: Documentation, https://robvanderleek.github.io/inquirer-textual/
|
|
@@ -9,9 +9,7 @@ Author-email: Rob van der Leek <robvanderleek@gmail.com>
|
|
|
9
9
|
License-Expression: GPL-3.0-or-later
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Requires-Python: <3.15,>=3.9
|
|
12
|
-
Requires-Dist: textual>=7.1
|
|
13
|
-
Provides-Extra: examples
|
|
14
|
-
Requires-Dist: textual-slider>=0.2.0; extra == 'examples'
|
|
12
|
+
Requires-Dist: textual>=6.7.1
|
|
15
13
|
Description-Content-Type: text/markdown
|
|
16
14
|
|
|
17
15
|
# Inquirer-Textual
|
|
@@ -38,20 +36,11 @@ Description-Content-Type: text/markdown
|
|
|
38
36
|
|
|
39
37
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
40
38
|
big. The goal of this Python library is to make user input simple for small
|
|
41
|
-
programs,
|
|
39
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
42
40
|
your program grows.
|
|
43
41
|
|
|
44
42
|
Read the [documentation here](https://robvanderleek.github.io/inquirer-textual/)
|
|
45
43
|
|
|
46
|
-
## Installation
|
|
47
|
-
|
|
48
|
-
Create and activate a virtual environment (for example with
|
|
49
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
pip install inquirer-textual
|
|
53
|
-
```
|
|
54
|
-
|
|
55
44
|
## Development
|
|
56
45
|
|
|
57
46
|
Add this library as an editable local dependency to another project using `uv`:
|
|
@@ -59,31 +48,3 @@ Add this library as an editable local dependency to another project using `uv`:
|
|
|
59
48
|
```shell
|
|
60
49
|
uv add --editable <path-to-inquirer-textual>
|
|
61
50
|
```
|
|
62
|
-
|
|
63
|
-
### Textual console
|
|
64
|
-
|
|
65
|
-
1. Open the Textual Development Console:
|
|
66
|
-
|
|
67
|
-
```shell
|
|
68
|
-
uv run textual console
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
2. Run application in development mode:
|
|
72
|
-
|
|
73
|
-
```shell
|
|
74
|
-
uv run textual run --dev examples/prompt_pattern.py
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Static documentation
|
|
78
|
-
|
|
79
|
-
Generating the static documentation:
|
|
80
|
-
|
|
81
|
-
```shell
|
|
82
|
-
uv run mkdocs build
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Viewing the static documentation:
|
|
86
|
-
|
|
87
|
-
```shell
|
|
88
|
-
uv run mkdocs serve
|
|
89
|
-
```
|
|
@@ -22,20 +22,11 @@
|
|
|
22
22
|
|
|
23
23
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
24
24
|
big. The goal of this Python library is to make user input simple for small
|
|
25
|
-
programs,
|
|
25
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
26
26
|
your program grows.
|
|
27
27
|
|
|
28
28
|
Read the [documentation here](https://robvanderleek.github.io/inquirer-textual/)
|
|
29
29
|
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
Create and activate a virtual environment (for example with
|
|
33
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
34
|
-
|
|
35
|
-
```shell
|
|
36
|
-
pip install inquirer-textual
|
|
37
|
-
```
|
|
38
|
-
|
|
39
30
|
## Development
|
|
40
31
|
|
|
41
32
|
Add this library as an editable local dependency to another project using `uv`:
|
|
@@ -43,31 +34,3 @@ Add this library as an editable local dependency to another project using `uv`:
|
|
|
43
34
|
```shell
|
|
44
35
|
uv add --editable <path-to-inquirer-textual>
|
|
45
36
|
```
|
|
46
|
-
|
|
47
|
-
### Textual console
|
|
48
|
-
|
|
49
|
-
1. Open the Textual Development Console:
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
uv run textual console
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2. Run application in development mode:
|
|
56
|
-
|
|
57
|
-
```shell
|
|
58
|
-
uv run textual run --dev examples/prompt_pattern.py
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Static documentation
|
|
62
|
-
|
|
63
|
-
Generating the static documentation:
|
|
64
|
-
|
|
65
|
-
```shell
|
|
66
|
-
uv run mkdocs build
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Viewing the static documentation:
|
|
70
|
-
|
|
71
|
-
```shell
|
|
72
|
-
uv run mkdocs serve
|
|
73
|
-
```
|
|
Binary file
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## About
|
|
25
25
|
|
|
26
26
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
27
27
|
big. The goal of this Python library is to make user input simple for small
|
|
28
|
-
programs,
|
|
28
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
29
29
|
your program grows.
|
|
30
30
|
|
|
31
31
|
This library is based on the sophisticated
|
|
@@ -47,15 +47,6 @@ With `uv` you can run the example out of the box:
|
|
|
47
47
|
uv run --with inquirer-textual checkbox.py
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
Create and activate a virtual environment (for example with
|
|
53
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
54
|
-
|
|
55
|
-
```shell
|
|
56
|
-
pip install inquirer-textual
|
|
57
|
-
```
|
|
58
|
-
|
|
59
50
|
## Key features and design principles
|
|
60
51
|
|
|
61
52
|
* **Keep simple things simple**: High-level prompts API for getting user input
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from inquirer_textual import prompts
|
|
2
2
|
|
|
3
3
|
if __name__ == '__main__':
|
|
4
|
-
|
|
5
|
-
'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
|
|
4
|
+
answer = prompts.checkbox("Planets:", choices=[
|
|
5
|
+
'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
|
|
6
|
+
'Uranus', 'Neptune'
|
|
6
7
|
])
|
|
7
|
-
print(
|
|
8
|
+
print(answer)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from inquirer_textual import prompts
|
|
2
|
+
from inquirer_textual.widgets.InquirerCheckbox import InquirerCheckbox
|
|
3
|
+
from inquirer_textual.widgets.InquirerConfirm import InquirerConfirm
|
|
4
|
+
from inquirer_textual.widgets.InquirerNumber import InquirerNumber
|
|
5
|
+
from inquirer_textual.widgets.InquirerSecret import InquirerSecret
|
|
6
|
+
from inquirer_textual.widgets.InquirerText import InquirerText
|
|
7
|
+
from inquirer_textual.widgets.InquirerSelect import InquirerSelect
|
|
8
|
+
|
|
9
|
+
if __name__ == '__main__':
|
|
10
|
+
text_widget = InquirerText('Name:')
|
|
11
|
+
password_widget = InquirerSecret('Password:')
|
|
12
|
+
number_widget = InquirerNumber('Memory:')
|
|
13
|
+
confirm_widget = InquirerConfirm('Proceed?')
|
|
14
|
+
select_widget = InquirerSelect('Planet?', ['Earth', 'Mars', 'Venus'], default='Mars')
|
|
15
|
+
checkbox_widget = InquirerCheckbox("People?", choices=['Alice', 'Bob', 'Charlie'])
|
|
16
|
+
answer = prompts.multi(
|
|
17
|
+
[text_widget, password_widget, number_widget, confirm_widget, select_widget, checkbox_widget])
|
|
18
|
+
print(answer)
|
|
@@ -10,15 +10,14 @@ from textual.binding import Binding, BindingsMap
|
|
|
10
10
|
from textual.widgets import Footer
|
|
11
11
|
|
|
12
12
|
from inquirer_textual.common.InquirerHeader import InquirerHeader
|
|
13
|
-
from inquirer_textual.common.
|
|
13
|
+
from inquirer_textual.common.Result import Result
|
|
14
14
|
from inquirer_textual.common.Shortcut import Shortcut
|
|
15
|
-
from inquirer_textual.common.StandardTheme import StandardTheme
|
|
16
15
|
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
17
16
|
|
|
18
17
|
T = TypeVar('T')
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
class InquirerApp(App[
|
|
20
|
+
class InquirerApp(App[Result[T]], inherit_bindings=False): # type: ignore[call-arg]
|
|
22
21
|
CSS = """
|
|
23
22
|
App {
|
|
24
23
|
background: black;
|
|
@@ -41,7 +40,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
41
40
|
self.shortcuts: list[Shortcut] | None = None
|
|
42
41
|
self.header: str | list[str] | None = None
|
|
43
42
|
self.show_footer: bool = False
|
|
44
|
-
self.result:
|
|
43
|
+
self.result: Result[T] | None = None
|
|
45
44
|
self.result_ready: Event | None = None
|
|
46
45
|
self.inquiry_func: Callable[[InquirerApp[T]], None] | None = None
|
|
47
46
|
self.inquiry_func_stop: bool = False
|
|
@@ -64,24 +63,21 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
64
63
|
if self.inquiry_func:
|
|
65
64
|
self.inquiry_func(self)
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
def action_shortcut(self, command: str):
|
|
68
67
|
value = self.widget.current_value() if self.widget else None
|
|
69
|
-
|
|
68
|
+
self._handle_result(command, value)
|
|
70
69
|
|
|
71
70
|
async def action_quit(self):
|
|
72
|
-
|
|
71
|
+
self._handle_result('quit', None)
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
def on_inquirer_widget_submit(self, event: InquirerWidget.Submit) -> None:
|
|
74
|
+
self._handle_result(event.command, event.value)
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
def _handle_result(self, command: str | None, value: Any | None):
|
|
78
77
|
if self.result_ready is not None:
|
|
79
|
-
self.result =
|
|
80
|
-
command)
|
|
78
|
+
self.result = Result(command, value) # type: ignore[arg-type]
|
|
81
79
|
self.result_ready.set()
|
|
82
80
|
else:
|
|
83
|
-
if self.widget:
|
|
84
|
-
await self.widget.set_selected_value(value)
|
|
85
81
|
self.call_after_refresh(lambda: self._terminate(command, value))
|
|
86
82
|
|
|
87
83
|
def _terminate(self, command: str | None = None, value: Any | None = None):
|
|
@@ -89,9 +85,9 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
89
85
|
if self.result_ready:
|
|
90
86
|
self.result_ready.set()
|
|
91
87
|
if command is not None:
|
|
92
|
-
self.app.exit(
|
|
88
|
+
self.app.exit(Result(command, value))
|
|
93
89
|
else:
|
|
94
|
-
self.exit(
|
|
90
|
+
self.exit(value)
|
|
95
91
|
|
|
96
92
|
def compose(self) -> ComposeResult:
|
|
97
93
|
if self.header is not None:
|
|
@@ -106,7 +102,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
106
102
|
if self.widget:
|
|
107
103
|
self.call_after_refresh(self.widget.focus)
|
|
108
104
|
|
|
109
|
-
def prompt(self, widget: InquirerWidget, shortcuts: list[Shortcut] | None = None) ->
|
|
105
|
+
def prompt(self, widget: InquirerWidget, shortcuts: list[Shortcut] | None = None) -> Result[T]:
|
|
110
106
|
if shortcuts:
|
|
111
107
|
self.shortcuts = shortcuts
|
|
112
108
|
self.show_footer = True
|
|
@@ -139,7 +135,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
139
135
|
auto_pilot: AutopilotCallbackType | None = None,
|
|
140
136
|
loop: AbstractEventLoop | None = None,
|
|
141
137
|
inquiry_func: Callable[[InquirerApp[T]], None] | None = None,
|
|
142
|
-
) ->
|
|
138
|
+
) -> Result[T]:
|
|
143
139
|
if not self.inquiry_func:
|
|
144
140
|
self.inquiry_func = inquiry_func
|
|
145
141
|
return super().run(
|
|
@@ -154,9 +150,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
154
150
|
|
|
155
151
|
def get_theme_variable_defaults(self) -> dict[str, str]:
|
|
156
152
|
return {
|
|
157
|
-
'
|
|
158
|
-
'
|
|
159
|
-
'
|
|
160
|
-
'select-list-item-highlight-foreground': StandardTheme.select_list_item_highlight_foreground,
|
|
161
|
-
'select-question-mark': StandardTheme.select_question_mark,
|
|
153
|
+
'select-question-mark': '#e5c07b',
|
|
154
|
+
'select-list-item-highlight-foreground': '#61afef',
|
|
155
|
+
'input-color': '#98c379'
|
|
162
156
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from textual.widgets import Label
|
|
4
|
+
|
|
5
|
+
from inquirer_textual.common.Choice import Choice
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChoiceLabel(Label):
|
|
9
|
+
def __init__(self, item: str | Choice):
|
|
10
|
+
super().__init__(f' {item if isinstance(item, str) else item.name}')
|
|
11
|
+
self._text = item if isinstance(item, str) else item.name
|
|
12
|
+
self.item = item
|
|
13
|
+
|
|
14
|
+
def add_pointer(self):
|
|
15
|
+
self.update(f'\u276f {self._text}')
|
|
16
|
+
|
|
17
|
+
def remove_pointer(self):
|
|
18
|
+
self.update(f' {self._text}')
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TypeVar, Generic
|
|
5
|
+
|
|
6
|
+
T = TypeVar('T')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Result(Generic[T]):
|
|
11
|
+
command: str | None
|
|
12
|
+
value: T
|
|
13
|
+
|
|
14
|
+
def __str__(self):
|
|
15
|
+
return str(self.value)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from typing import Any, Iterable
|
|
2
|
+
|
|
3
|
+
from textual.validation import Validator
|
|
4
|
+
|
|
5
|
+
from inquirer_textual.InquirerApp import InquirerApp
|
|
6
|
+
from inquirer_textual.common.Choice import Choice
|
|
7
|
+
from inquirer_textual.common.Result import Result
|
|
8
|
+
from inquirer_textual.common.Shortcut import Shortcut
|
|
9
|
+
from inquirer_textual.widgets.InquirerCheckbox import InquirerCheckbox
|
|
10
|
+
from inquirer_textual.widgets.InquirerConfirm import InquirerConfirm
|
|
11
|
+
from inquirer_textual.widgets.InquirerMulti import InquirerMulti
|
|
12
|
+
from inquirer_textual.widgets.InquirerNumber import InquirerNumber
|
|
13
|
+
from inquirer_textual.widgets.InquirerSecret import InquirerSecret
|
|
14
|
+
from inquirer_textual.widgets.InquirerSelect import InquirerSelect
|
|
15
|
+
from inquirer_textual.widgets.InquirerText import InquirerText
|
|
16
|
+
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def text(message: str, shortcuts: list[Shortcut] | None = None,
|
|
20
|
+
validators: Validator | Iterable[Validator] | None = None) -> Result[str]:
|
|
21
|
+
app: InquirerApp[str] = InquirerApp()
|
|
22
|
+
app.widget = InquirerText(message, validators=validators)
|
|
23
|
+
app.shortcuts = shortcuts
|
|
24
|
+
app.show_footer = bool(shortcuts)
|
|
25
|
+
return app.run(inline=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def secret(message: str, shortcuts: list[Shortcut] | None = None) -> Result[str]:
|
|
29
|
+
app: InquirerApp[str] = InquirerApp()
|
|
30
|
+
app.widget = InquirerSecret(message)
|
|
31
|
+
app.shortcuts = shortcuts
|
|
32
|
+
app.show_footer = bool(shortcuts)
|
|
33
|
+
return app.run(inline=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def number(message: str, shortcuts: list[Shortcut] | None = None) -> Result[int]:
|
|
37
|
+
app: InquirerApp[int] = InquirerApp()
|
|
38
|
+
app.widget = InquirerNumber(message)
|
|
39
|
+
app.shortcuts = shortcuts
|
|
40
|
+
app.show_footer = bool(shortcuts)
|
|
41
|
+
return app.run(inline=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def confirm(message: str, shortcuts: list[Shortcut] | None = None, default: bool = False, mandatory: bool = True) -> \
|
|
45
|
+
Result[bool]:
|
|
46
|
+
app: InquirerApp[bool] = InquirerApp()
|
|
47
|
+
app.widget = InquirerConfirm(message, default=default, mandatory=mandatory)
|
|
48
|
+
app.shortcuts = shortcuts
|
|
49
|
+
app.show_footer = bool(shortcuts)
|
|
50
|
+
return app.run(inline=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def select(message: str, choices: list[str | Choice], shortcuts: list[Shortcut] | None = None,
|
|
54
|
+
default: str | Choice | None = None, mandatory: bool = True) -> Result[str | Choice]:
|
|
55
|
+
app: InquirerApp[str | Choice] = InquirerApp()
|
|
56
|
+
app.widget = InquirerSelect(message, choices, default, mandatory)
|
|
57
|
+
app.shortcuts = shortcuts
|
|
58
|
+
app.show_footer = bool(shortcuts)
|
|
59
|
+
return app.run(inline=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def checkbox(message: str, choices: list[str | Choice], shortcuts: list[Shortcut] | None = None,
|
|
63
|
+
enabled: list[str | Choice] | None = None) -> Result[list[str | Choice]]:
|
|
64
|
+
app: InquirerApp[list[str | Choice]] = InquirerApp()
|
|
65
|
+
app.widget = InquirerCheckbox(message, choices, enabled)
|
|
66
|
+
app.shortcuts = shortcuts
|
|
67
|
+
app.show_footer = bool(shortcuts)
|
|
68
|
+
return app.run(inline=True)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def multi(widgets: list[InquirerWidget], shortcuts: list[Shortcut] | None = None) -> Result[list[Any]]:
|
|
72
|
+
app: InquirerApp[list[Any]] = InquirerApp()
|
|
73
|
+
app.widget = InquirerMulti(widgets)
|
|
74
|
+
app.shortcuts = shortcuts
|
|
75
|
+
app.show_footer = bool(shortcuts)
|
|
76
|
+
return app.run(inline=True)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "1.0.0"
|
{inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerCheckbox.py
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from textual.app import ComposeResult
|
|
4
|
-
from textual.containers import VerticalGroup
|
|
5
|
-
from textual.widgets import ListItem, ListView
|
|
4
|
+
from textual.containers import VerticalGroup
|
|
5
|
+
from textual.widgets import ListItem, ListView
|
|
6
6
|
from typing_extensions import Self
|
|
7
7
|
|
|
8
8
|
from inquirer_textual.common.Choice import Choice
|
|
@@ -27,25 +27,20 @@ class InquirerCheckbox(InquirerWidget):
|
|
|
27
27
|
("space", "toggle_selected", "Toggle selection"),
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
-
def __init__(self, message: str, choices: list[str | Choice],
|
|
31
|
-
enabled: list[str | Choice] | None = None, mandatory: bool = False):
|
|
30
|
+
def __init__(self, message: str, choices: list[str | Choice], enabled: list[str | Choice] | None = None):
|
|
32
31
|
"""
|
|
33
32
|
Args:
|
|
34
33
|
message (str): The prompt message to display.
|
|
35
34
|
choices (list[str | Choice]): A list of choices to present to the user.
|
|
36
|
-
name (str | None): The name of the input field.
|
|
37
35
|
enabled (list[str | Choice] | None): A list of choices that should be pre-selected.
|
|
38
|
-
mandatory (bool): Whether at least one selection is mandatory.
|
|
39
36
|
"""
|
|
40
|
-
super().__init__(
|
|
37
|
+
super().__init__()
|
|
41
38
|
self.message = message
|
|
42
39
|
self.choices = choices
|
|
43
40
|
self.enabled = enabled
|
|
44
41
|
self.list_view: ListView | None = None
|
|
45
42
|
self.selected_label: ChoiceCheckboxLabel | None = None
|
|
46
43
|
self.selected_item: str | Choice | None = None
|
|
47
|
-
self.selected_value: list[str | Choice] | None = None
|
|
48
|
-
self.show_selected_value: bool = False
|
|
49
44
|
|
|
50
45
|
def on_mount(self):
|
|
51
46
|
self.styles.height = min(10, len(self.choices) + 1)
|
|
@@ -60,7 +55,7 @@ class InquirerCheckbox(InquirerWidget):
|
|
|
60
55
|
self.selected_item = label.item
|
|
61
56
|
|
|
62
57
|
def on_list_view_selected(self, _: ListView.Selected) -> None:
|
|
63
|
-
self.
|
|
58
|
+
self.post_message(InquirerWidget.Submit(self.current_value()))
|
|
64
59
|
|
|
65
60
|
def focus(self, scroll_visible: bool = True) -> Self:
|
|
66
61
|
if self.list_view:
|
|
@@ -72,23 +67,12 @@ class InquirerCheckbox(InquirerWidget):
|
|
|
72
67
|
labels = self.query(ChoiceCheckboxLabel)
|
|
73
68
|
return [label.item for label in labels if label.checked]
|
|
74
69
|
|
|
75
|
-
async def set_selected_value(self, value: list[str | Choice]) -> None:
|
|
76
|
-
self.selected_value = value
|
|
77
|
-
self.styles.height = 1
|
|
78
|
-
self.show_selected_value = True
|
|
79
|
-
await self.recompose()
|
|
80
|
-
|
|
81
70
|
def compose(self) -> ComposeResult:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
list_item = ListItem(ChoiceCheckboxLabel(choice))
|
|
91
|
-
items.append(list_item)
|
|
92
|
-
self.list_view = ListView(*items, id='inquirer-checkbox-list-view')
|
|
93
|
-
yield PromptMessage(self.message)
|
|
94
|
-
yield self.list_view
|
|
71
|
+
with VerticalGroup():
|
|
72
|
+
items: list[ListItem] = []
|
|
73
|
+
for idx, choice in enumerate(self.choices):
|
|
74
|
+
list_item = ListItem(ChoiceCheckboxLabel(choice))
|
|
75
|
+
items.append(list_item)
|
|
76
|
+
self.list_view = ListView(*items, id='inquirer-checkbox-list-view')
|
|
77
|
+
yield PromptMessage(self.message)
|
|
78
|
+
yield self.list_view
|
{inquirer_textual-0.3.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerConfirm.py
RENAMED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
2
|
+
from inquirer_textual.common.PromptMessage import PromptMessage
|
|
3
3
|
from textual import events
|
|
4
4
|
from textual.app import ComposeResult
|
|
5
5
|
from textual.containers import HorizontalGroup
|
|
6
6
|
from textual.widgets import Label
|
|
7
7
|
|
|
8
|
-
from inquirer_textual.common.PromptMessage import PromptMessage
|
|
9
|
-
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
10
|
-
|
|
11
8
|
|
|
12
9
|
class InquirerConfirm(InquirerWidget):
|
|
13
10
|
"""A confirmation prompt that allows the user to confirm or reject."""
|
|
@@ -19,18 +16,17 @@ class InquirerConfirm(InquirerWidget):
|
|
|
19
16
|
"""
|
|
20
17
|
can_focus = True
|
|
21
18
|
|
|
22
|
-
def __init__(self, message: str, confirm_character: str = 'y', reject_character: str = 'n',
|
|
23
|
-
|
|
19
|
+
def __init__(self, message: str, confirm_character: str = 'y', reject_character: str = 'n', default=False,
|
|
20
|
+
mandatory: bool = True):
|
|
24
21
|
"""
|
|
25
22
|
Args:
|
|
26
23
|
message (str): The prompt message to display.
|
|
27
24
|
confirm_character (str): The character to use for confirmation.
|
|
28
25
|
reject_character (str): The character to use for rejection.
|
|
29
|
-
name (str | None): The name of the prompt.
|
|
30
26
|
default (bool): The default value if the user presses Enter without input.
|
|
31
27
|
mandatory (bool): Whether a response is mandatory.
|
|
32
28
|
"""
|
|
33
|
-
super().__init__(
|
|
29
|
+
super().__init__(mandatory)
|
|
34
30
|
if len(confirm_character) != 1 or len(reject_character) != 1:
|
|
35
31
|
raise ValueError("confirm_character and reject_character must be a single character")
|
|
36
32
|
if confirm_character.lower() == reject_character.lower():
|
|
@@ -15,7 +15,7 @@ class InquirerMulti(InquirerWidget):
|
|
|
15
15
|
}
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
def __init__(self, widgets: list[
|
|
18
|
+
def __init__(self, widgets: list[InquirerWidget]) -> None:
|
|
19
19
|
"""
|
|
20
20
|
Args:
|
|
21
21
|
widgets (list[InquirerWidget]): A list of InquirerWidget instances to present in sequence.
|
|
@@ -23,25 +23,24 @@ class InquirerMulti(InquirerWidget):
|
|
|
23
23
|
super().__init__()
|
|
24
24
|
self.widgets = widgets
|
|
25
25
|
self._current_widget_index = 0
|
|
26
|
-
self.
|
|
26
|
+
self._return_values: list[Any] = []
|
|
27
27
|
|
|
28
28
|
def on_mount(self):
|
|
29
29
|
self.query_one(ContentSwitcher).current = f'widget-{self._current_widget_index}'
|
|
30
30
|
self.query_one(ContentSwitcher).visible_content.focus()
|
|
31
31
|
|
|
32
32
|
def on_inquirer_widget_submit(self, message: InquirerWidget.Submit) -> None:
|
|
33
|
-
|
|
34
|
-
self._return_values_dict[current_widget[0]] = message.value
|
|
33
|
+
self._return_values.append(message.value)
|
|
35
34
|
self._current_widget_index += 1
|
|
36
35
|
if self._current_widget_index < len(self.widgets):
|
|
37
36
|
message.stop()
|
|
38
37
|
self.query_one(ContentSwitcher).current = f'widget-{self._current_widget_index}'
|
|
39
38
|
self.query_one(ContentSwitcher).visible_content.focus()
|
|
40
39
|
else:
|
|
41
|
-
message.value = self.
|
|
40
|
+
message.value = self._return_values
|
|
42
41
|
|
|
43
42
|
def compose(self) -> ComposeResult:
|
|
44
43
|
with ContentSwitcher(initial=f'widget-{self._current_widget_index}'):
|
|
45
44
|
for idx, widget in enumerate(self.widgets):
|
|
46
|
-
widget
|
|
47
|
-
yield widget
|
|
45
|
+
widget.id = f'widget-{idx}'
|
|
46
|
+
yield widget
|