docs: 📜 Small Updates in prep

This commit is contained in:
2025-09-02 18:45:00 +01:00
parent 17f33dfdd8
commit f8816b1da6
4 changed files with 162 additions and 94 deletions
+43 -8
View File
@@ -1,12 +1,47 @@
from rich import print, pretty
from rich import print
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.progress import Progress, SpinnerColumn, BarColumn, track
from rich.markdown import Markdown
from rich.syntax import Syntax
from rich.live import Live
from rich.prompt import Prompt
def main():
print("Hello from devin!")
print("[italic red]Hello[/italic red] World!", locals())
print(["Rich and pretty", True])
print(Panel.fit("[bold yellow]Hi, I'm a Panel", border_style="red"))
import random
import time
console = Console()
if __name__ == "__main__":
main()
def ask_name() -> str:
"""Ask for a name and keep asking until it's not empty."""
while True:
name = Prompt.ask("[bold cyan]What is your name?[/]")
if name.strip():
return name.strip()
console.print("[red]Name cannot be empty![/]", style="bold")
def ask_age() -> int:
"""Ask for age and validate it's a positive integer."""
while True:
age_str = Prompt.ask("[bold cyan]How old are you?[/]")
try:
age = int(age_str)
if age <= 0:
raise ValueError
return age
except ValueError:
console.print("[red]Please enter a valid positive integer.[/]", style="bold")
name = ask_name()
age = ask_age()
panel_narrow = Panel(
f"[bold green]Your Name is: {name}[/bold green]\n"
f"[blue]And you are {age} Years Old.[/blue]",
title="About You",
subtitle="The info you gave",
expand=False,
)
console.print(panel_narrow)