@@ -1380,47 +1380,42 @@ def run(
13801380 )
13811381
13821382
1383- @subcommand
13841383@implementation_subcommand ()
13851384@dialect_option ()
1386- def tui (start : Any , dialect : Dialect , ** kwargs : Any ):
1385+ async def tui (start : Any , dialect : Dialect , ** kwargs : Any ):
13871386 """
13881387 Interactively evaluate schemas against instances across implementations.
13891388
13901389 Starts a REPL that keeps implementations running between validations,
13911390 prompting for a JSON Schema and an instance on each iteration
13921391 """
1393-
1394- async def _tui (start : Any , dialect : Dialect , ** kwargs : Any ):
1395- runners = []
1396- async for impl_id , implementation in start ():
1397- try :
1398- runner = await implementation .start_speaking (dialect )
1399- except UnsupportedDialect as error :
1400- STDERR .print (error )
1401- continue
1402- runners .append (
1403- (
1404- impl_id ,
1405- implementation .info .version or "?" ,
1406- runner ,
1407- ),
1408- )
1409-
1410- if not runners :
1411- STDERR .print (
1412- "[bold red]No implementation started successfully![/]" ,
1413- )
1414- return EX .CONFIG
1415- session = TuiSession (
1416- runners = runners ,
1417- dialect = dialect ,
1418- console = STDOUT ,
1419- prompt = lambda msg : Prompt .ask (msg ),
1392+ runners = []
1393+ async for impl_id , implementation in start ():
1394+ try :
1395+ runner = await implementation .start_speaking (dialect )
1396+ except UnsupportedDialect as error :
1397+ STDERR .print (error )
1398+ continue
1399+ runners .append (
1400+ (
1401+ impl_id ,
1402+ implementation .info .version or "?" ,
1403+ runner ,
1404+ ),
14201405 )
1421- await session .repl ()
14221406
1423- return asyncio .run (_tui (start = start , dialect = dialect , ** kwargs ))
1407+ if not runners :
1408+ STDERR .print (
1409+ "[bold red]No implementation started successfully![/]" ,
1410+ )
1411+ return EX .CONFIG
1412+ session = TuiSession (
1413+ runners = runners ,
1414+ dialect = dialect ,
1415+ console = STDOUT ,
1416+ prompt = lambda msg : Prompt .ask (msg ),
1417+ )
1418+ await session .repl ()
14241419
14251420
14261421@subcommand
0 commit comments