Cli
Unofficial
Command-line interface handler for Obsidian.
Import:
import type { Cli } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface CliConstructor
new Cli(app: App)Constructor.
To get the constructor instance, use getCliConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| app | App | Reference to the app. | |
| handlers | Map<string, CliHandlerEntry> | Registered CLI command handlers. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| formatAsciiTree(nodes, prefix?) | string | Format tree nodes as an ASCII tree. | |
| formatAsciiTreeWithRoot(root, children) | string | Format a root label and child nodes as an ASCII tree. | |
| formatDiff(oldText, newText, oldName, newName) | string | Format two strings as a unified diff. | |
| formatTable(headers, rows, format) | string | Format data as a table in JSON, CSV, or TSV format. | |
| init() | void | Initialize the CLI handler, registering the global handleCli function. | |
| registerHandler(id, description, flags, handler) | void | Register a CLI command handler. | |
| tryResolveFile(params, requireFile?) | TFile | Try to resolve a file from CLI input parameters. | |
| unregisterHandler(id, handler?) | void | Unregister a CLI command handler. |
Links to this page: