218 def make_cmd(self, cfg_args: SimpleNamespace) -> List:
219 assert self.
target,
"Target should be set before making commands"
220 assert self.
driver,
"Driver should be set before making commands"
225 driver_list = [shutil.which(driver_name)]
227 raise FileNotFoundError(f
'{driver_name} not found')
229 driver_path = driver_list[0]
230 cmd: List = [driver_path]
231 invalid_options = list(cfg_args.__dict__.keys())
233 for action
in self._actions:
234 args, act, dtype, otype = action
235 assert act
in [NormalOption, TargetOption]
236 if otype == Optional:
239 if arg.startswith(
'--'):
240 option_names.append(arg[len(
'--'):])
241 elif arg.startswith(
'-'):
242 option_names.append(arg[len(
'-'):])
243 elif otype == Positional:
249 if act == NormalOption:
250 for option_name
in option_names:
251 if oneutils.is_valid_attr(cfg_args, option_name):
252 given_option = option_name
256 if dtype == bool
and given_option.lower() ==
"false":
258 if otype == Optional:
261 if act == TargetOption:
264 assert act == NormalOption
266 cmd += [getattr(cfg_args, given_option)]
267 invalid_options.remove(given_option)
269 if len(invalid_options):
270 print(f
'WARNING: there are invalid options {invalid_options}')