diff --git a/src/cli.py b/src/cli.py index b84e4be..ac243ce 100644 --- a/src/cli.py +++ b/src/cli.py @@ -7,7 +7,7 @@ import uuid import click import httpx from rich import pretty -from rich import print # yes, deliberately shadow `print` +from rich.traceback import install from shiv.bootstrap import current_zipfile import src @@ -24,24 +24,12 @@ from src.art import BANNERS def main(ctx): """Launch a utility or drop into a command line REPL if no command is given.""" if ctx.invoked_subcommand is None: - def print_wrapper(*args, **kwargs): - # I know this is dumb. - # https://github.com/Textualize/rich/discussions/2462 - if "crop" in kwargs: - del kwargs["crop"] - print(*args, **kwargs) - banner = random.choice(BANNERS) - # source of code.interact, just expanded to fit Rich in there - console = code.InteractiveConsole(globals()) - console.print = print_wrapper - pretty.install(console) # type: ignore - try: - import readline - except ImportError: - pass - console.interact(banner, None) + pretty.install() # type: ignore + install() # traceback handler + + code.interact(banner, None) sys.exit()