diff --git a/examples/menu.py b/examples/menu.py index 53d5dca..22d3b62 100644 --- a/examples/menu.py +++ b/examples/menu.py @@ -1,3 +1,4 @@ +import sys import random from typing import List from rich_toolkit import RichToolkit @@ -56,6 +57,10 @@ def get_options() -> List[Option]: app.print_title("Launch sequence initiated.", tag="astro") app.print_line() + if not app.confirm("Do you want to continue?"): + app.print("Launch aborted.") + sys.exit(0) + app.ask( "Where should we create your new project?", tag="dir", diff --git a/pyproject.toml b/pyproject.toml index 7af6c8a..9900172 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "rich-toolkit" -version = "0.14.8" +version = "0.14.9" description = "Rich toolkit for building command-line applications" readme = "README.md" license = "MIT" diff --git a/src/rich_toolkit/container.py b/src/rich_toolkit/container.py index c567421..c716332 100644 --- a/src/rich_toolkit/container.py +++ b/src/rich_toolkit/container.py @@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import click -from rich.console import RenderableType from rich.control import Control, ControlType from rich.live_render import LiveRender from rich.segment import Segment @@ -42,6 +41,10 @@ def _refresh(self, done: bool = False): else False ) + # Always show cursor when done to restore terminal state + if done: + should_show_cursor = True + self.console.print( Control.show_cursor(should_show_cursor), *self.move_cursor_at_beginning(),