File: rawlist.md

package info (click to toggle)
python-inquirerpy 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: python: 9,463; makefile: 15
file content (84 lines) | stat: -rw-r--r-- 1,703 bytes parent folder | download
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# rawlist

A prompt that displays a list of choices and can use index numbers as key jump shortcuts.

## Example

![demo](https://assets.kazhala.me/InquirerPy/rawlist.gif)

<details>
  <summary>Classic Syntax (PyInquirer)</summary>

```{eval-rst}
.. literalinclude :: ../../../examples/classic/rawlist.py
   :language: python
```

</details>

<details open>
  <summary>Alternate Syntax</summary>

```{eval-rst}
.. literalinclude :: ../../../examples/alternate/rawlist.py
   :language: python
```

</details>

## Choices

```{seealso}
{ref}`pages/dynamic:choices`
```

For this specific prompt, due to the shortcut being created is between 1-9, the total length of choices cannot exceed 10.

## Keybindings

```{seealso}
{ref}`pages/kb:Keybindings`
```

```{hint}
In addition to the keybindings mentioned below, keybindings are created for keys 1-9 to jump to the target index choices.
```

```{include} ../kb.md
:start-after: <!-- start kb -->
:end-before: <!-- end kb -->
```

```{include} ./list.md
:start-after: <!-- start list kb -->
:end-before: <!-- end list kb -->
```

```{include} ./list.md
:start-after: <!-- start list vi kb -->
:end-before: <!-- end list vi kb -->
```

## Multiple Selection

```{seealso}
{ref}`pages/prompts/list:Multiple Selection`
```

## Default Value

```{seealso}
{ref}`pages/prompts/list:Default Value`
```

The `default` parameter for rawlist can be three types of values:

- shortcut index (int): an {class}`int` value between 1-9 and the default value index choice will be highlighted.
- choice value (Any): default value could the value of one of the choices.

## Reference

```{eval-rst}
.. autoclass:: InquirerPy.prompts.rawlist.RawlistPrompt
    :noindex:
```