Documentation
¶
Overview ¶
Package lock marks journal entries as locked to prevent re-export and manages multipart files.
Index ¶
- Constants
- func FrontmatterHasLocked(path string) bool
- func MatchJournalFiles(journalDir string, patterns []string, all bool) ([]string, error)
- func MultipartBase(filename string) string
- func RunLockUnlock(cmd *cobra.Command, args []string, all, lock bool) error
- func UpdateLockFrontmatter(path string, lock bool)
Constants ¶
const LockedFrontmatterLine = session.FrontmatterLockedLine
LockedFrontmatterLine is the YAML line inserted into frontmatter when a journal entry is locked.
Variables ¶
This section is empty.
Functions ¶
func FrontmatterHasLocked ¶
FrontmatterHasLocked reads a journal file and returns true if its YAML frontmatter contains a "locked:" line with a truthy value.
Parameters:
- path: Absolute path to the journal .md file
Returns:
- bool: True if frontmatter contains "locked: true"
func MatchJournalFiles ¶
MatchJournalFiles returns journal .md filenames matching the given patterns. If all is true, returns every .md file in the directory. Multipart files (base + -pN parts) are included when the base matches.
Parameters:
- journalDir: Path to the journal directory
- patterns: Slug, date, or short-ID substrings to match
- all: If true, return all .md files
Returns:
- []string: Matching filenames (basename only)
- error: Non-nil on I/O failure
func MultipartBase ¶
MultipartBase returns the base name for a potentially multipart file. For "2026-01-21-slug-abc12345-p2.md" it returns "2026-01-21-slug-abc12345.md". For non-multipart files, returns the filename as-is.
Parameters:
- filename: Journal entry filename
Returns:
- string: Base filename (without -pN suffix)
func RunLockUnlock ¶
RunLockUnlock handles both lock and unlock commands.
Parameters:
- cmd: Cobra command for output
- args: Patterns to match against journal filenames
- all: If true, apply to all journal entries
- lock: True for lock, false for unlock
Returns:
- error: Non-nil on validation or I/O failure
func UpdateLockFrontmatter ¶
UpdateLockFrontmatter inserts or removes the "locked: true" line in a journal file's YAML frontmatter. The state file is the source of truth; this is for human visibility only.
Parameters:
- path: Absolute path to the journal .md file
- lock: True to insert, false to remove
Types ¶
This section is empty.