CLI Vault Resource¶
CLIVaultResource(cli)
¶
Bases: BaseCLIResource
CLI resource for vault file operations.
Attributes:
| Name | Type | Description |
|---|---|---|
_cli |
Reference to the parent |
Source code in src/aiobsidian/cli/_base.py
open(path)
async
¶
Open a file in the Obsidian UI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
read(path)
async
¶
Read the content of a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
Returns:
| Type | Description |
|---|---|
str
|
File content as a string. |
Source code in src/aiobsidian/cli/vault.py
create(path, content, *, name=None, template=None, overwrite=False, silent=False)
async
¶
Create a new file in the vault.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path for the new file relative to the vault root. |
required |
content
|
str
|
File content. |
required |
name
|
str | None
|
Display name for the note. |
None
|
template
|
str | None
|
Template to use for the new file. |
None
|
overwrite
|
bool
|
If |
False
|
silent
|
bool
|
If |
False
|
Source code in src/aiobsidian/cli/vault.py
append(path, content, *, inline=False)
async
¶
Append content to a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
content
|
str
|
Content to append. |
required |
inline
|
bool
|
If |
False
|
Source code in src/aiobsidian/cli/vault.py
prepend(path, content)
async
¶
Prepend content to a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
content
|
str
|
Content to prepend. |
required |
Source code in src/aiobsidian/cli/vault.py
move(path, to)
async
¶
Move a vault file to a new location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Current path relative to the vault root. |
required |
to
|
str
|
Destination path relative to the vault root. |
required |
Source code in src/aiobsidian/cli/vault.py
rename(path, new_name)
async
¶
Rename a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Current path relative to the vault root. |
required |
new_name
|
str
|
New file name (without directory prefix). |
required |
Source code in src/aiobsidian/cli/vault.py
delete(path, *, permanent=False)
async
¶
Delete a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
permanent
|
bool
|
If |
False
|
Source code in src/aiobsidian/cli/vault.py
info()
async
¶
Get vault information.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Vault details including name and configuration. |
Source code in src/aiobsidian/cli/vault.py
file_info(path)
async
¶
Get information about a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
File metadata. |
Source code in src/aiobsidian/cli/vault.py
folder_info(path)
async
¶
Get information about a folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the folder relative to the vault root. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Folder metadata. |
Source code in src/aiobsidian/cli/vault.py
folders(path='')
async
¶
List folders in the vault.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path relative to the vault root. Empty string lists all folders. |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of folder paths. |
Source code in src/aiobsidian/cli/vault.py
wordcount(path)
async
¶
Get word and character count for a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Word count statistics. |
Source code in src/aiobsidian/cli/vault.py
list(path='', *, ext=None, folder=None)
async
¶
List files in the vault.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path relative to the vault root. Empty string lists all files. |
''
|
ext
|
str | None
|
Filter by file extension (e.g. |
None
|
folder
|
str | None
|
Filter by folder path. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of file paths. |