Skip to content

CLI Random Resource

CLIRandomResource(cli)

Bases: BaseCLIResource

CLI resource for random note 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

open() async

Open a random note in the Obsidian UI.

Source code in src/aiobsidian/cli/random_note.py
async def open(self) -> None:
    """Open a random note in the Obsidian UI."""
    await self._cli._execute("random")

read() async

Read the content of a random note.

Returns:

Type Description
str

Content of a randomly selected note.

Source code in src/aiobsidian/cli/random_note.py
async def read(self) -> str:
    """Read the content of a random note.

    Returns:
        Content of a randomly selected note.
    """
    return await self._cli._execute("random:read")