commands

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 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 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 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