Source

Docs · Command line

The vaultdraw command

Install the vaultdraw command, see how it talks to the app, and learn the options every command shares.

vaultdraw lets you use your vault from Terminal and scripts: list, search, read and write drawings, and drive the running app.

Install

If you installed Vaultdraw with Homebrew, the command is already there. Otherwise open the command palette (Cmd+Shift+P) and run one of:

  • Install ‘vaultdraw’ command in PATH links it into ~/.local/bin.
  • Install ‘vaultdraw’ command in /usr/local/bin links it there instead, for every user.

Check it works:

vaultdraw status

If it stops with Killed: 9, see troubleshooting.

With or without the app

app runningapp closed

vaultdraw

Vaultdraw app

Reads the vault directly

Vault folder

When the app runs, the command asks it. When the app is closed, file commands read and write the vault directly.

  • App running: every command goes through the app, so edits show up in the window at once.
  • App closed: file commands still work on the most recent vault, or the one given with --vault. App commands such as open and tabs need the app.

Both paths give the same output.

Options for every command

OptionWhat it does
--jsonPrint stable JSON instead of text, for scripts
--vault <PATH>Vault to read when the app is closed
--offlineNever go through the app (refused while the app is running)
--pathTreat names as exact vault-relative paths
--fileTreat names as link-style drawing names
--timeout <SECS>How long to wait for the app (default 30)

A target such as Roadmap is matched like a [[link]]. Anything that contains / or ends in .excalidraw is a path.

Exit codes

CodeMeaning
0Success
1Usage or local error
2The app or vault refused, for example a write conflict
3The app is not running and the command needs it
4Protocol error

Help and completions

vaultdraw --help             # every command
vaultdraw search --help      # one command
vaultdraw completions zsh    # bash, zsh, fish, elvish or nushell

For zsh, save the output in a folder on your fpath, for example:

vaultdraw completions zsh > ~/.zfunc/_vaultdraw