commands

package
v1.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package commands provides pure functions for vault file operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetPath added in v1.2.0

func AssetPath(cfg *config.Config, name string) string

AssetPath returns the full filesystem path for an asset filename within the vault's assets dir.

func CreateFile

func CreateFile(path string, content []byte) error

CreateFile creates path (and parent dirs) with content.

func NoteInitialContent

func NoteInitialContent(cfg *config.Config, stem string) []byte

NoteInitialContent returns the initial file content for a new note. Returns nil when cfg.NoteFrontmatter is false.

func NotePath

func NotePath(cfg *config.Config, name string) string

NotePath builds the full filesystem path for a note name. Bare names (no "/") are placed under notes/. Trailing slashes and a trailing extension matching cfg.Ext are stripped before appending it.

func OpenJournal

func OpenJournal(cfg *config.Config, ref string) (string, error)

OpenJournal resolves ref, ensures the journal file exists, and returns its path.

func RenameDestPath

func RenameDestPath(cfg *config.Config, currentPath, newName string) string

RenameDestPath computes the destination path for a rename without performing it. The caller can use this to check for conflicts before calling RenameFile.

func RenameFile

func RenameFile(cfg *config.Config, currentPath, newName string) (string, error)

RenameFile moves currentPath to a new location determined by newName. If newName contains "/", it is treated as vault-relative. Extension is preserved from currentPath if newName has none. Returns the resolved destination path.

func ResolveExternalAsset added in v1.2.0

func ResolveExternalAsset(cfg *config.Config, target string) (string, bool)

ResolveExternalAsset resolves a "@namespace/filename" target to an absolute path. The leading "@" is stripped, then the string is split on the first "/" to get namespace and filename. Returns the full path and true on success; false if the namespace is not registered in cfg.AssetDirs or the path has no "/".

func TemplatePath

func TemplatePath(cfg *config.Config, name string) string

TemplatePath builds the full filesystem path for a template name. Bare names (no "/") are placed under templates/. Trailing slashes and a trailing extension matching cfg.Ext are stripped before appending it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL