fix: add docstrings to improve code documentation and clarity

This commit is contained in:
Даниил Грабарь
2026-05-22 18:16:59 +03:00
parent a7590cc93f
commit 463a1e1423
9 changed files with 209 additions and 0 deletions
+14
View File
@@ -39,6 +39,12 @@ _DESCRIPTION = "Lightweight Cobot"
# Custom --help action that prints commands grouped by category instead of a flat list.
# Кастомный обработчик --help, который выводит команды по категориям, а не одним списком.
class _GroupedHelpAction(argparse.Action):
"""Custom argparse action that replaces the default --help output with a grouped
command listing organized by category (Setup, Run, Management).
Кастомный обработчик argparse, заменяющий стандартный вывод --help на сгруппированный
список команд по категориям (Setup, Run, Management).
"""
def __init__(self, option_strings, dest, default=None, required=False, help=None):
super().__init__(
option_strings=option_strings,
@@ -63,6 +69,9 @@ class _GroupedHelpAction(argparse.Action):
def main():
"""Entry point for the cobot CLI. Parses arguments and dispatches to the correct command.
Точка входа CLI cobot. Разбирает аргументы и вызывает нужную команду.
"""
parser = argparse.ArgumentParser(
prog="cobot",
description=_DESCRIPTION,
@@ -85,6 +94,11 @@ def main():
def _register_commands(subparsers):
"""Register all command subparsers. Each command module calls register() which adds its
own subparser and sets args.func to its run() function.
Регистрирует все подпарсеры команд. Каждый модуль вызывает register(), добавляет свой
подпарсер и устанавливает args.func на свою функцию run().
"""
# Each module registers its own subparser and sets args.func to its run() function.
# Каждый модуль регистрирует свой подпарсер и устанавливает args.func на свою функцию run().
cmd_setup.register(subparsers)