Skip to content

CLI Daily Resource

CLIDailyResource(cli)

Bases: BaseCLIResource

CLI resource for daily 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

read(*, date=None) async

Read the content of a daily note.

Parameters:

Name Type Description Default
date str | None

Date in YYYY-MM-DD format. Defaults to today.

None

Returns:

Type Description
str

Daily note content as a string.

Source code in src/aiobsidian/cli/daily.py
async def read(self, *, date: str | None = None) -> str:
    """Read the content of a daily note.

    Args:
        date: Date in ``YYYY-MM-DD`` format. Defaults to today.

    Returns:
        Daily note content as a string.
    """
    params = {"date": date} if date is not None else None
    return await self._cli._execute("daily:read", params=params)

path() async

Get the file path of today's daily note.

Returns:

Type Description
str

Path to the daily note relative to the vault root.

Source code in src/aiobsidian/cli/daily.py
async def path(self) -> str:
    """Get the file path of today's daily note.

    Returns:
        Path to the daily note relative to the vault root.
    """
    output = await self._cli._execute("daily:path")
    return output.strip()

create() async

Create today's daily note.

Source code in src/aiobsidian/cli/daily.py
async def create(self) -> None:
    """Create today's daily note."""
    await self._cli._execute("daily")

append(content) async

Append content to today's daily note.

Parameters:

Name Type Description Default
content str

Content to append.

required
Source code in src/aiobsidian/cli/daily.py
async def append(self, content: str) -> None:
    """Append content to today's daily note.

    Args:
        content: Content to append.
    """
    await self._cli._execute("daily:append", params={"content": content})

prepend(content) async

Prepend content to today's daily note.

Parameters:

Name Type Description Default
content str

Content to prepend.

required
Source code in src/aiobsidian/cli/daily.py
async def prepend(self, content: str) -> None:
    """Prepend content to today's daily note.

    Args:
        content: Content to prepend.
    """
    await self._cli._execute("daily:prepend", params={"content": content})