utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaysUntil

func DaysUntil(t time.Time) int

DaysUntil returns the number of days until t, rounded half away from zero so a deadline a few hours from now reads 0, one a day out reads 1, and a deadline that passed reads negative — past and future are never conflated by naive truncation.

func EnsureDir

func EnsureDir(path string) error

func ExpandHome

func ExpandHome(path string) string

ExpandHome expands a leading "~" to the user's home directory. It only treats "~" as home when it is the first character and is followed by a path separator or is the whole string, so paths like "~/a" expand but a literal "~" inside a path (e.g. "x~y") is left untouched.

func FileExists

func FileExists(path string) bool

func GoalsPath

func GoalsPath() string

func NotesPath

func NotesPath(repo string) string

func ReadFile

func ReadFile(path string) (string, error)

func SanitizeRepoName

func SanitizeRepoName(name string) (string, error)

SanitizeRepoName validates that a name is safe to use as a single filename segment for note storage. It rejects empty names, names containing path separators, or ".." segments, which would otherwise let a caller escape the notes directory via path traversal (e.g. "../../.bashrc").

func WorkspaceBaseDir

func WorkspaceBaseDir() string

WorkspaceBaseDir resolves the DevPulse data root, honouring DEVPULSE_CONFIG so notes/goals/cache/logs follow the config location.

Types

This section is empty.

Jump to

Keyboard shortcuts

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