commands

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 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 LogForPeriod added in v1.6.0

func LogForPeriod(cfg *config.Config, periodStr string, now time.Time) (string, error)

LogForPeriod resolves a period name ("day", "week", "month", "year"), ensures the log file exists, and returns its path.

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 ReviewPaths added in v1.6.0

func ReviewPaths(cfg *config.Config, periodStr string, now time.Time) ([]string, error)

ReviewPaths resolves a period name and returns the set of files relevant for a period review (sub-period files, previous summary, current period).

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