Skip to content

CLI Hotkeys Resource

CLIHotkeysResource(cli)

Bases: BaseCLIResource

CLI resource for hotkey operations.

Attributes:

Name Type Description
_cli

Reference to the parent ObsidianCLI instance.

Source code in src/aiobsidian/cli/_base.py
def __init__(self, cli: ObsidianCLI) -> None:
    self._cli = cli

get(command_id, *, verbose=False) async

Get the hotkey binding for a command.

Parameters:

Name Type Description Default
command_id str

Command identifier.

required
verbose bool

If True, include extended binding details.

False

Returns:

Type Description
dict[str, Any]

Hotkey binding details.

Source code in src/aiobsidian/cli/hotkeys.py
async def get(self, command_id: str, *, verbose: bool = False) -> dict[str, Any]:
    """Get the hotkey binding for a command.

    Args:
        command_id: Command identifier.
        verbose: If ``True``, include extended binding details.

    Returns:
        Hotkey binding details.
    """
    flags = ["--verbose"] if verbose else None
    output = await self._cli._execute(
        "hotkey", params={"id": command_id}, flags=flags
    )
    result: dict[str, Any] = json.loads(output)
    return result

list() async

List all hotkey bindings.

Returns:

Type Description
list[dict[str, Any]]

List of hotkey binding objects.

Source code in src/aiobsidian/cli/hotkeys.py
async def list(self) -> list[dict[str, Any]]:
    """List all hotkey bindings.

    Returns:
        List of hotkey binding objects.
    """
    output = await self._cli._execute("hotkeys")
    result: list[dict[str, Any]] = json.loads(output)
    return result