gen_avr8.infrastructure.cli.engine module

Module

engine.py

Copyright

Copyright (C) 2026 Vladimir Roncevic <elektron.ronca@gmail.com> gen_avr8 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. gen_avr8 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Info

Defines CLI class implementing inbound CLI port.

class gen_avr8.infrastructure.cli.engine.CLI(bundle: CLIBundle)[source]

Bases: ICLI

Adapter that implements CLI commands for the code generator.

It defines:

attributes:
_service - File generation orchestrator service.
_parser - Argument parser for parsing CLI command args.
_executors - Map of command names to command executor instances.
methods:
__init__ - Initializes the CLI with service, parser and commands list.
run - Parses command line arguments and runs selected command strategy.
is_initialized - Checks if the CLI is initialized.
__str__ - Returns the CLI as string representation.
_abc_impl = <_abc._abc_data object>
_executors: Mapping[str, ICommandExecutor[object, object, object]]
_is_protocol = False
_parser: IOptionManager
_service: IService
is_initialized() bool[source]

Checks if the CLI is initialized.

Returns:

True if CLI is initialized, False otherwise.

Exceptions:

None.

run() Mapping[str, object][source]

Parses command line arguments and runs selected command strategy.

Note: returncode is 0 for success, 1 for exception or if command is not found, None if process timed out or failed to start, otherwise it is the integer exit code of the process.

Returns:

The execution result (return code, stdout, and stderr).

Exceptions:

None.