Skip to content

CLI Outline Resource

CLIOutlineResource(cli)

Bases: BaseCLIResource

CLI resource for document outline 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(path) async

Get the heading outline of a file.

Parameters:

Name Type Description Default
path str

Path to the file relative to the vault root.

required

Returns:

Type Description
list[dict[str, Any]]

List of heading objects forming the document outline.

Source code in src/aiobsidian/cli/outline.py
async def get(self, path: str) -> list[dict[str, Any]]:
    """Get the heading outline of a file.

    Args:
        path: Path to the file relative to the vault root.

    Returns:
        List of heading objects forming the document outline.
    """
    output = await self._cli._execute("outline", params={"file": path})
    result: list[dict[str, Any]] = json.loads(output)
    return result