@@ -45,8 +45,8 @@ def main(ctx: click.Context) -> None:
4545 "attempt any I/O. Useful as a a dry-run." ,
4646 default = False ,
4747)
48- @click .option ("-n" , "--name" )
49- def connect (beamline : str , all : bool , sim_backend : bool , name : str | None ) -> None :
48+ @click .option ("-n" , "--name" , "device_manager" , default = "devices" )
49+ def connect (beamline : str , all : bool , sim_backend : bool , device_manager : str ) -> None :
5050 """Initialises a beamline module, connects to all devices, reports
5151 any connection issues."""
5252
@@ -70,18 +70,14 @@ def connect(beamline: str, all: bool, sim_backend: bool, name: str | None) -> No
7070 # because the alternatives is handling the fact that only some devices may
7171 # be lazy.
7272
73- if name :
74- if (manager := getattr (mod , name , None )) and isinstance (manager , DeviceManager ):
75- devices , instance_exceptions , connect_exceptions = (
76- manager .build_and_connect (
77- mock = sim_backend ,
78- )
79- )
80- else :
81- raise ValueError (
82- f"Name '{ name } ' could not be found or is not a DeviceManager"
83- )
73+ if (manager := getattr (mod , device_manager , None )) and isinstance (
74+ manager , DeviceManager
75+ ):
76+ devices , instance_exceptions , connect_exceptions = manager .build_and_connect (
77+ mock = sim_backend ,
78+ )
8479 else :
80+ print (f"No device manager named '{ device_manager } ' found in { mod } " )
8581 _spoof_path_provider ()
8682 devices , instance_exceptions = make_all_devices (
8783 full_module_path ,
0 commit comments