@@ -450,6 +450,11 @@ def _build_tui_parser() -> argparse.ArgumentParser:
450450
451451 inspect_p = subparsers .add_parser ("inspect" , help = "Inspect a Vessel" )
452452 inspect_p .add_argument ("vessel" , nargs = "?" , help = "Path to Vessel file" )
453+ inspect_p .add_argument (
454+ "--no-tui" ,
455+ action = "store_true" ,
456+ help = "Print Vessel status without opening the TUI" ,
457+ )
453458
454459 close_p = subparsers .add_parser ("close" , help = "Close a Vessel" )
455460 close_p .add_argument ("vessel" , nargs = "?" , help = "Path to Vessel file" )
@@ -683,6 +688,9 @@ def main():
683688
684689 if args .command == "inspect" :
685690 vessel = getattr (args , "vessel" , None )
691+ no_tui = getattr (args , "no_tui" , False )
692+ if no_tui or not sys .stdout .isatty ():
693+ return _run_inspect_command (args )
686694 from .tui .app import run_tui
687695
688696 run_tui (initial_screen = "inspect" , vessel_path = vessel )
@@ -786,6 +794,32 @@ def _run_close_command(args) -> int:
786794 return 0
787795
788796
797+ def _run_inspect_command (args ) -> int :
798+ vessel = getattr (args , "vessel" , None )
799+ if not vessel :
800+ error ("Vessel path is required for inspect." )
801+ return 1
802+
803+ path = Path (vessel ).expanduser ().resolve ()
804+ if not path .exists ():
805+ error (f"vessel file not found: { path } " )
806+ return 1
807+
808+ svc = VesselWorkflowService ()
809+ try :
810+ vessels = svc ._vessels .list_all ()
811+ meta = next ((item for item in vessels if item .path .resolve () == path ), None )
812+ except OSError as exc :
813+ error (str (exc ))
814+ return 1
815+
816+ status_label = "open" if meta and meta .is_open else "closed"
817+ open_count = meta .open_count if meta else 0
818+ info (f"Vessel: { path .name } " )
819+ info (f"status: { status_label } open count: { open_count } " )
820+ return 0
821+
822+
789823def _run_face_command (args ) -> int :
790824 if getattr (args , "face_command" , None ) != "create" :
791825 error ("Face action is required." )
@@ -1678,4 +1712,4 @@ def _run_legacy_command(args) -> None:
16781712
16791713
16801714if __name__ == "__main__" :
1681- main ()
1715+ sys . exit ( main () or 0 )
0 commit comments