Skip to content

other

dev_tool.commands.other

log = logging.getLogger(__name__) module-attribute

OtherCommandGroup

Bases: CommandGroup

A command group for ungrouped operations.

This class provides commands for ungrouped operations such as directory access, version information, updates, and application exit.

The constructor for the SystemCommandGroup class.

This method initializes the command group with required services and registers all command methods.

Parameters:

  • updater (UpdateService) –

    The update service for checking and applying updates.

Source code in dev_tool/commands/other.py
def __init__(self, updater: UpdateService) -> None:
    """
    The constructor for the SystemCommandGroup class.

    This method initializes the command group with required services
    and registers all command methods.

    :param updater: The update service for checking and applying updates.
    """

    super().__init__()

    self.updater = updater

updater = updater instance-attribute

__str__

The string representation of the command group.

This method returns the category name for the command group.

Returns:

  • str

    The category name as a string.

Source code in dev_tool/commands/other.py
def __str__(self) -> str:
    """
    The string representation of the command group.

    This method returns the category name for the command group.

    :return: The category name as a string.
    """

    return 'Other'

check_version

A command that checks the current version.

This method retrieves and logs the current version of the application.

Source code in dev_tool/commands/other.py
@ordered_command(label='Check version')
def check_version(self) -> None:
    """
    A command that checks the current version.

    This method retrieves and logs the current version of the application.
    """

    try:
        version = self.configuration.get_current_version()
    except Exception as e:
        self.emit_error(f'Failed to get the current version: {e}')
    else:
        message = f'Current version: {version}'
        self.emit_normal(message)

        log.debug(message)

check_update

A command that checks for updates.

This method checks for updates and notifies the user if an update is available.

Source code in dev_tool/commands/other.py
@ordered_command(label='Check for updates')
def check_update(self) -> None:
    """
    A command that checks for updates.

    This method checks for updates and notifies the user if an update is available.
    """

    try:
        if self.updater.run():
            sys.exit(2)
    except Exception as e:
        message = f'Failed to update the dev_tool: {e}'
        self.emit_error(message)

exit

A command that exits the application.

This method terminates the application with an exit code of 0.

Source code in dev_tool/commands/other.py
@ordered_command(label='Exit application')
def exit(self) -> None:
    """
    A command that exits the application.

    This method terminates the application with an exit code of 0.
    """

    sys.exit(0)

open_directory

A command that opens a submenu for directory access.

This method returns a menu for opening various directories.

Returns:

  • Menu

    A submenu for directory options.

Source code in dev_tool/commands/other.py
@ordered_submenu(label='Open directory')
def open_directory(self) -> Menu:
    """
    A command that opens a submenu for directory access.

    This method returns a menu for opening various directories.

    :return: A submenu for directory options.
    """

    items: list[Menu | MenuItem] = [
        MenuItem(
            label='Open base directory',
            action=CommandAction(command=self._open_base_directory)
        ),
        MenuItem(
            label='Open Stratus directory',
            action=CommandAction(command=self._open_stratus_directory)
        )
    ]

    return Menu(title='Open a directory', items=items)

open_documentation

A command that opens a submenu for documentation access.

This method returns a menu for opening various documentation websites.

Returns:

  • Menu

    A submenu for documentation options.

Source code in dev_tool/commands/other.py
@ordered_submenu(label='Open documentation')
def open_documentation(self) -> Menu:
    """
    A command that opens a submenu for documentation access.

    This method returns a menu for opening various documentation websites.

    :return: A submenu for documentation options.
    """

    items: list[Menu | MenuItem] = [
        MenuItem(
            label='Open Dandy documentation',
            action=CommandAction(command=self._open_dandy_documentation)
        ),
        MenuItem(
            label='Open dev_tool documentation',
            action=CommandAction(command=self._open_dev_tool_documentation)
        ),
        MenuItem(
            label='Open Django documentation',
            action=CommandAction(command=self._open_django_documentation)
        )
    ]

    return Menu(title='Open documentation', items=items)

raise_test_error

A command that raises a test error for debugging stack trace interfaces.

Source code in dev_tool/commands/other.py
@ordered_command(label='Raise test error')
def raise_test_error(self) -> None:
    """A command that raises a test error for debugging stack trace interfaces."""

    self._raise_error()