Skip to content

Commit 90c03c6

Browse files
committed
Merge branch 'master' of https://github.com/petereon/beaupy into dependabot/pip/urllib3-2.0.7
2 parents 768ce2c + d1a65ac commit 90c03c6

File tree

9 files changed

+364
-254
lines changed

9 files changed

+364
-254
lines changed

APIDOC.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Creates a spinner which can be used to provide some user feedback during long pr
5151
- `refresh_per_second` _float, optional_ - Number of refreshes the spinner will do a second, this will affect
5252
the fluidity of the "animation". Defaults to 10.
5353
- `transient` _bool, optional_ - If the spinner will disappear after it's done, otherwise not. Defaults to True.
54-
54+
5555

5656
**Raises**:
5757

@@ -146,14 +146,14 @@ Function that prompts the user for written input
146146
the error will be reported onto the console. Defaults to True.
147147
- `raise_type_conversion_fail` _bool, optional_ - If True, invalid inputs will raise `rich.internals.ConversionError`, else
148148
the error will be reported onto the console. Defaults to True.
149-
149+
150150

151151
**Raises**:
152152

153153
- `ValidationError` - Raised if validation with provided validator fails
154154
- `ConversionError` - Raised if the value cannot be converted to provided type
155155
- `KeyboardInterrupt` - Raised when keyboard interrupt is encountered and Config.raise_on_interrupt is True
156-
156+
157157

158158
**Returns**:
159159

@@ -188,13 +188,13 @@ A prompt that allows selecting one option from a list of options
188188
- `return_index` _bool, optional_ - If `True`, `select` will return the index of selected element in options. Defaults to `False`.
189189
- `strict` _bool, optional_ - If empty `options` is provided and strict is `False`, None will be returned,
190190
if it's `True`, `ValueError` will be thrown. Defaults to False.
191-
191+
192192

193193
**Raises**:
194194

195-
- `ValueError` - Thrown if no `options` are povided and strict is `True`
195+
- `ValueError` - Thrown if no `options` are provided and strict is `True`
196196
- `KeyboardInterrupt` - Raised when keyboard interrupt is encountered and Config.raise_on_interrupt is True
197-
197+
198198

199199
**Returns**:
200200

@@ -238,12 +238,12 @@ A prompt that allows selecting multiple options from a list of options
238238
of ticked elements in options. Defaults to `False`.
239239
- `strict` _bool, optional_ - If empty `options` is provided and strict is `False`, None will be returned,
240240
if it's `True`, `ValueError` will be thrown. Defaults to False.
241-
241+
242242

243243
**Raises**:
244244

245245
- `KeyboardInterrupt` - Raised when keyboard interrupt is encountered and Config.raise_on_interrupt is True
246-
246+
247247

248248
**Returns**:
249249

@@ -278,14 +278,13 @@ A prompt that asks a question and offers two responses
278278
- `cursor` _str, optional_ - What character(s) to use as a cursor. Defaults to '> '.
279279
- `cursor_style` _str, optional_ - Rich friendly style for the cursor. Defaults to 'pink1'.
280280
- `char_prompt` _bool, optional_ - Print [Y/n] after the question. Defaults to True.
281-
281+
282282

283283
**Raises**:
284284

285285
- `KeyboardInterrupt` - Raised when keyboard interrupt is encountered and Config.raise_on_interrupt is True
286-
286+
287287

288288
**Returns**:
289289

290290
Optional[bool]
291-

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# BeauPy
22

3-
## :warning: __Beaupy is not accepting pull-requests at the moment as the code-base is getting migrated towards [`questo`](https://github.com/petereon/questo) shortly__.
4-
53
![beaupy](https://user-images.githubusercontent.com/47027005/185082011-cb588f57-d38f-42d8-8312-3981ae1bc479.png)
64

75
> A Python library of interactive CLI elements you have been looking for
@@ -34,7 +32,7 @@ BeauPy stands on the shoulders of giants. It is based on another library with wh
3432
| [`confirm`](https://petereon.github.io/beaupy/api/#confirm) | Prompt with a question and yes/no options |
3533
| [`prompt`](https://petereon.github.io/beaupy/api/#prompt) | Prompt that takes free input with optional validation, type conversion and input hiding |
3634

37-
TUI elements shown in the above gif are the result of the follwing code:
35+
TUI elements shown in the above gif are the result of the following code:
3836

3937
```python
4038
import time
@@ -57,8 +55,8 @@ if confirm("Will you take the ring to Mordor?"):
5755
# Choose one item from a list
5856
name = select(names, cursor="🢧", cursor_style="cyan")
5957
console.print(f"Alámenë, {name}")
60-
61-
58+
59+
6260
item_options = [
6361
"The One Ring",
6462
"Dagger",
@@ -68,44 +66,44 @@ if confirm("Will you take the ring to Mordor?"):
6866
console.print("What do you bring with you?")
6967
# Choose multiple options from a list
7068
items = select_multiple(item_options, tick_character='🎒', ticked_indices=[0], maximal_count=3)
71-
69+
7270
potato_count = 0
7371
if "Po-tae-toes" in items:
7472
# Prompt with type conversion and validation
7573
potato_count = prompt('How many potatoes?', target_type=int, validator=lambda count: count > 0)
76-
74+
7775
# Spinner to show while doing some work
7876
spinner = Spinner(DOTS, "Packing things...")
7977
spinner.start()
80-
78+
8179
time.sleep(2)
82-
80+
8381
spinner.stop()
8482
# Get input without showing it being typed
8583
if "friend" == prompt("Speak, [blue bold underline]friend[/blue bold underline], and enter", secure=True).lower():
86-
84+
8785
# Custom spinner animation
8886
spinner_animation = ['▉▉', '▌▐', ' ', '▌▐', '▉▉']
8987
spinner = Spinner(spinner_animation, "Opening the Door of Durin...")
9088
spinner.start()
91-
89+
9290
time.sleep(2)
93-
91+
9492
spinner.stop()
9593
else:
9694
spinner_animation = ['🐙🌊 ⚔️ ', '🐙 🌊 ⚔️ ', '🐙 🌊 ⚔️ ', '🐙 🌊 ⚔️ ', '🐙 🌊⚔️ ']
9795
spinner = Spinner(spinner_animation, "Getting attacked by an octopus...")
9896
spinner.start()
99-
97+
10098
time.sleep(2)
101-
99+
102100
spinner.stop()
103101

104102
if 'The One Ring' in items:
105103
console.print("[green]You throw The One Ring to a lava from an eagle![/green]")
106104
else:
107105
console.print("[red]You forgot the ring and brought Middle-Earth to its knees![/red]")
108-
console.print(f"And you brought {potato_count} taters!")
106+
console.print(f"And you brought {potato_count} taters!")
109107
```
110108

111109
For more information refer to [more examples](https://petereon.github.io/beaupy/examples/) or definitive, but much less exciting [API documentation](https://petereon.github.io/beaupy/api/)

0 commit comments

Comments
 (0)