stm32pio
stm32pio copied to clipboard
Let CLI tools describe their validators themselves
Currently, validation process of some tool is described completely separately of its class (PlatformIO and CubeMX, Java can be treated as a part of CubeMX actually):
return ToolsValidationResults(
Tool(name=param,
command=config.get('app', param),
runner=runner,
required=required,
logger=logger).validate()
for param, runner, required in [
('platformio_cmd', platformio_runner, True),
('cubemx_cmd', cubemx_runner, True),
('java_cmd', java_runner, False)
])
We can define some IVerifiable interface that a tool should implement by having a tool.validator attribute which in turn absorbs all related logic. In such configuration, adding a new tool will automatically register it in the virtual "pool" of verifiable instruments.