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'

websites

A command that opens a submenu for websites.

This method returns a menu for accessing various websites.

Returns:

  • Menu

    A submenu for website access.

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

    This method returns a menu for accessing various websites.

    :return: A submenu for website access.
    """

    items: list[Menu | MenuItem] = [
        MenuItem(
            label='Jira',
            action=CommandAction(command=self._open_stratus_jira)
        ),
        MenuItem(
            label='Confluence',
            action=CommandAction(command=self._open_stratus_confluence)
        ),
        MenuItem(
            label='GitHub',
            action=CommandAction(command=self._open_stratus_github)
        ),
        MenuItem(
            label='django-spire documentation',
            action=CommandAction(command=self._open_django_spire_documentation)
        ),
        MenuItem(
            label='dandy documentation',
            action=CommandAction(command=self._open_dandy_documentation)
        ),
        MenuItem(
            label='dev_tool documentation',
            action=CommandAction(command=self._open_dev_tool_documentation)
        ),
        MenuItem(
            label='Python documentation',
            action=CommandAction(command=self._open_python_documentation)
        ),
        MenuItem(
            label='Django documentation',
            action=CommandAction(command=self._open_django_documentation)
        )
    ]

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

open_directories

A command that opens a submenu for opening directories.

This method returns a menu for opening various project directories.

Returns:

  • Menu

    A submenu for directory access.

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

    This method returns a menu for opening various project directories.

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

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

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

version

A command that displays the current version information.

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

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

    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:
        self.updater.run()
    except Exception as e:
        self.emit_error(f'Failed to update the dev_tool: {e}')

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)