@@ -851,7 +851,7 @@ def subscribe():
851851
852852
853853def export_config (interface ):
854- """used in--export-config"""
854+ """used in --export-config"""
855855 configObj = {}
856856
857857 owner = interface .getLongName ()
@@ -1062,10 +1062,31 @@ def initParser():
10621062 parser = our_globals .get_parser ()
10631063 args = our_globals .get_args ()
10641064
1065+ # The "Help" group includes the help option and other informational stuff about the CLI itself
1066+ outerHelpGroup = parser .add_argument_group ('Help' )
1067+ helpGroup = outerHelpGroup .add_mutually_exclusive_group ()
1068+ helpGroup .add_argument ("-h" , "--help" , action = "help" , help = "show this help message and exit" )
1069+
1070+ the_version = get_active_version ()
1071+ helpGroup .add_argument ("--version" , action = "version" , version = f"{ the_version } " )
1072+
1073+ helpGroup .add_argument (
1074+ "--support" ,
1075+ action = "store_true" ,
1076+ help = "Show support info (useful when troubleshooting an issue)" ,
1077+ )
1078+
1079+ # Connection arguments to indicate a device to connect to
10651080 parser = addConnectionArgs (parser )
10661081
1082+ # Arguments concerning viewing and setting configuration
1083+
1084+ # Arguments for sending or requesting things from the local device
1085+
1086+ # Arguments for sending or requesting things from the mesh
1087+
1088+ # All the rest of the arguments
10671089 group = parser .add_argument_group ("optional arguments" )
1068- group .add_argument ("-h" , "--help" , action = "help" , help = "show this help message and exit" )
10691090 group .add_argument (
10701091 "--configure" ,
10711092 help = "Specify a path to a yaml(.yml) file containing the desired settings for the connected device." ,
@@ -1384,12 +1405,13 @@ def initParser():
13841405
13851406 have_tunnel = platform .system () == "Linux"
13861407 if have_tunnel :
1387- group .add_argument (
1408+ tunnelArgs = parser .add_argument_group ('Tunnel' , 'Arguments related to establishing a tunnel device over the mesh.' )
1409+ tunnelArgs .add_argument (
13881410 "--tunnel" ,
13891411 action = "store_true" ,
13901412 help = "Create a TUN tunnel device for forwarding IP packets over the mesh" ,
13911413 )
1392- group .add_argument (
1414+ tunnelArgs .add_argument (
13931415 "--subnet" ,
13941416 dest = "tunnel_net" ,
13951417 help = "Sets the local-end subnet address for the TUN IP bridge. (ex: 10.115' which is the default)" ,
@@ -1398,14 +1420,6 @@ def initParser():
13981420
13991421 parser .set_defaults (deprecated = None )
14001422
1401- the_version = get_active_version ()
1402- group .add_argument ("--version" , action = "version" , version = f"{ the_version } " )
1403-
1404- group .add_argument (
1405- "--support" ,
1406- action = "store_true" ,
1407- help = "Show support info (useful when troubleshooting an issue)" ,
1408- )
14091423
14101424 args = parser .parse_args ()
14111425 our_globals .set_args (args )
@@ -1430,7 +1444,7 @@ def main():
14301444def tunnelMain ():
14311445 """Run a meshtastic IP tunnel"""
14321446 our_globals = Globals .getInstance ()
1433- parser = argparse .ArgumentParser ()
1447+ parser = argparse .ArgumentParser (add_help = False )
14341448 our_globals .set_parser (parser )
14351449 initParser ()
14361450 args = our_globals .get_args ()
0 commit comments