@@ -597,6 +597,7 @@ def onConnected(interface):
597597
598598 # Handle the int/float/bool arguments
599599 pref = None
600+ fields = set ()
600601 for pref in args .set :
601602 found = False
602603 field = splitCompoundName (pref [0 ].lower ())[0 ]
@@ -609,11 +610,19 @@ def onConnected(interface):
609610 )
610611 found = setPref (config , pref [0 ], pref [1 ])
611612 if found :
613+ fields .add (field )
612614 break
613615
614616 if found :
615617 print ("Writing modified preferences to device" )
616- node .writeConfig (field )
618+ if len (fields ) > 1 :
619+ print ("Using a configuration transaction" )
620+ node .beginSettingsTransaction ()
621+ for field in fields :
622+ print (f"Writing { field } configuration to device" )
623+ node .writeConfig (field )
624+ if len (fields ) > 1 :
625+ node .commitSettingsTransaction ()
617626 else :
618627 if mt_config .camel_case :
619628 print (
@@ -1417,7 +1426,7 @@ def addConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
14171426 "--get" ,
14181427 help = (
14191428 "Get a preferences field. Use an invalid field such as '0' to get a list of all fields."
1420- " Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')"
1429+ " Can use either snake_case or camelCase format. (ex: 'power. ls_secs' or 'power. lsSecs')"
14211430 ),
14221431 nargs = 1 ,
14231432 action = "append" ,
@@ -1426,7 +1435,11 @@ def addConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
14261435
14271436 group .add_argument (
14281437 "--set" ,
1429- help = "Set a preferences field. Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')" ,
1438+ help = (
1439+ "Set a preferences field. Can use either snake_case or camelCase format."
1440+ " (ex: 'power.ls_secs' or 'power.lsSecs'). May be less reliable when"
1441+ " setting properties from more than one configuration section."
1442+ ),
14301443 nargs = 2 ,
14311444 action = "append" ,
14321445 metavar = ("FIELD" , "VALUE" ),
0 commit comments