@@ -716,6 +716,44 @@ def cmd_autostart_remove(args, api: NvApi) -> int:
716716 return 0
717717
718718
719+ def cmd_menu (args , api : NvApi ) -> int :
720+ """Interactive main menu for double-click / right-click users."""
721+ while True :
722+ print ("\n === xbar5090 main menu ===" )
723+ print (" 1. Show status" )
724+ print (" 2. Interactive setup wizard" )
725+ print (" 3. Run L2 stability test" )
726+ print (" 4. Save current profile" )
727+ print (" 5. Apply a profile" )
728+ print (" 6. Install autostart" )
729+ print (" 7. Remove autostart" )
730+ print (" 0. Exit" )
731+ choice = _prompt_int ("Select" , 0 , 0 , 7 )
732+ if choice == 0 :
733+ break
734+ if choice == 1 :
735+ cmd_status (args , api )
736+ elif choice == 2 :
737+ cmd_wizard (args , api )
738+ elif choice == 3 :
739+ cmd_l2_test (args , api )
740+ elif choice == 4 :
741+ name = input ("Profile name: " ).strip ()
742+ if name :
743+ args .name = name
744+ cmd_profile_save (args , api )
745+ elif choice == 5 :
746+ name = input ("Profile name: " ).strip ()
747+ if name :
748+ args .name = name
749+ cmd_profile_apply (args , api )
750+ elif choice == 6 :
751+ cmd_autostart_install (args , api )
752+ elif choice == 7 :
753+ cmd_autostart_remove (args , api )
754+ return 0
755+
756+
719757def _prompt_int (label : str , current : int , lo : int , hi : int , unit : str = "" ) -> int :
720758 while True :
721759 inp = input (f"{ label } [{ lo } ..{ hi } ] (current { current } { unit } , Enter=keep): " ).strip ()
@@ -946,9 +984,11 @@ def cmd_crack(args, api: NvApi) -> int:
946984
947985def cmd_l2_test (args , api : NvApi ) -> int :
948986 ok = l2test .run_l2_test (
949- blocks = args .blocks , threads = args .threads ,
950- stress_iters = args .stress_iters ,
951- idle_rounds = args .idle_rounds , load_rounds = args .load_rounds ,
987+ blocks = getattr (args , "blocks" , 1360 ),
988+ threads = getattr (args , "threads" , 256 ),
989+ stress_iters = getattr (args , "stress_iters" , 100000 ),
990+ idle_rounds = getattr (args , "idle_rounds" , 3 ),
991+ load_rounds = getattr (args , "load_rounds" , 3 ),
952992 )
953993 return 0 if ok else 1
954994
@@ -1024,9 +1064,9 @@ def main(argv=None) -> int:
10241064 p_pa .set_defaults (func = cmd_profile_apply )
10251065 sub .add_parser ("profile-list" , help = "list saved profiles" ).set_defaults (func = cmd_profile_list )
10261066
1027- # If no subcommand is given, launch the interactive wizard directly .
1067+ # If no subcommand is given, launch the interactive main menu .
10281068 # This makes double-click / "Run as administrator" on the exe work.
1029- parser .set_defaults (func = cmd_wizard )
1069+ parser .set_defaults (func = cmd_menu )
10301070
10311071 args = parser .parse_args (argv )
10321072 _setup_logging (args )
@@ -1042,7 +1082,15 @@ def main(argv=None) -> int:
10421082 if getattr (args , "cmd" , None ) is None :
10431083 _pause_for_interactive ()
10441084 return 2
1045- rc = args .func (args , api )
1085+ try :
1086+ rc = args .func (args , api )
1087+ except Exception as e :
1088+ print (f"ERROR: { e } " , file = sys .stderr )
1089+ import traceback
1090+ traceback .print_exc ()
1091+ if getattr (args , "cmd" , None ) is None :
1092+ _pause_for_interactive ()
1093+ return 1
10461094 # When launched by double-click / right-click with no subcommand, keep the
10471095 # console open on failure so the user can read the error.
10481096 if getattr (args , "cmd" , None ) is None and rc != 0 :
0 commit comments