Documentation
¶
Overview ¶
Package commands provides pure functions for vault file operations.
Index ¶
- func AssetPath(cfg *config.Config, name string) string
- func CreateFile(path string, content []byte) error
- func NoteInitialContent(cfg *config.Config, stem string) []byte
- func NotePath(cfg *config.Config, name string) string
- func OpenJournal(cfg *config.Config, ref string) (string, error)
- func RenameDestPath(cfg *config.Config, currentPath, newName string) string
- func RenameFile(cfg *config.Config, currentPath, newName string) (string, error)
- func ResolveExternalAsset(cfg *config.Config, target string) (string, bool)
- func TemplatePath(cfg *config.Config, name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetPath ¶ added in v1.2.0
AssetPath returns the full filesystem path for an asset filename within the vault's assets dir.
func CreateFile ¶
CreateFile creates path (and parent dirs) with content.
func NoteInitialContent ¶
NoteInitialContent returns the initial file content for a new note. Returns nil when cfg.NoteFrontmatter is false.
func NotePath ¶
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 ¶
OpenJournal resolves ref, ensures the journal file exists, and returns its path.
func RenameDestPath ¶
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 ¶
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
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 "/".
Types ¶
This section is empty.