ats_utilities.option.ioption_parser module¶
- Module
ioption_parser.py
- Copyright
Copyright (C) 2017 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities 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. ats_utilities 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 abstract class IOptionManager with method(s). Creates an interface for ATS option parsing.
- class ats_utilities.option.ioption_parser.IOptionManager[source]¶
Bases:
ABCDefines abstract class IOptionManager with method(s). Creates an interface for ATS option parsing.
It defines:
- attributes:
None
- methods:
- add_operation - Adds an option to the ATS parser.add_version_operation - Adds version option to the ATS parser.parse_input_args - Processes arguments from the start.parse_args - Processes arguments from the start.register_commands - Registers a list of commands with the parser.parse_command - Parses the input arguments and returns an OptionNamespace.is_initialized - Checks if option parser component is initialized.__str__ - Returns the ATS option parser as string representation.
- _abc_impl = <_abc._abc_data object>¶
- abstractmethod add_operation(*args: str, **kwargs: Any) None[source]¶
Adds an option to the ATS parser.
- Parameters:
args (<str>) – Arguments in string form
kwargs (<Any>) – Arguments in Any form
- Exceptions:
NotImplementedError.
- abstractmethod add_version_operation(version: str | None) None[source]¶
Adds version option to the ATS parser.
- Parameters:
version (<str | None>) – The ATS version in string format | None
- Exceptions:
NotImplementedError.
- abstractmethod is_initialized() bool[source]¶
Checks if option parser component is initialized.
- Returns:
True (success) | False (fail).
- Return type:
<bool>
- Exceptions:
NotImplementedError.
- abstractmethod parse_args(arguments: Sequence[str] | None) OptionNamespace[source]¶
Processes arguments from the start.
- Parameters:
arguments (<OptArgs>) – Sequence of arguments | None
- Returns:
Option namespace object
- Return type:
<OptionNamespace>
- Exceptions:
NotImplementedError.
- abstractmethod parse_command(arguments: Sequence[str] | None = None) tuple[str, dict][source]¶
Parses CLI arguments for subcommands and returns command name and parameters.
- Parameters:
arguments (<OptArgs>) – Sequence of arguments | None.
- Returns:
Tuple containing command name and parsed parameters.
- Return type:
<tuple[str, dict]>
- Exceptions:
NotImplementedError.
- abstractmethod parse_input_args(arguments: Sequence[str] | None) OptionNamespace[source]¶
Processes arguments from the start.
- Parameters:
arguments (<OptArgs>) – Sequence of arguments | None
- Returns:
Option namespace object
- Return type:
<OptionNamespace>
- Exceptions:
NotImplementedError.
- abstractmethod register_commands(commands: list[IOptionCommand]) None[source]¶
Register a list of commands with the parser.
- Parameters:
commands (<list[IOptionCommand]>) – List of commands to register.
- Exceptions:
NotImplementedError.