Documentation
¶
Overview ¶
Package bookmarks manages persistent directory bookmarks for the grut TUI. Bookmarks are stored in a separate TOML file alongside the main config to avoid conflicting writes with the read-only config loader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides thread-safe bookmark operations and persistence.
func NewManager ¶
func NewManager(cfg config.BookmarksConfig) *Manager
NewManager creates a Manager seeded from the config's bookmark paths. Each path in cfg.Paths is converted into a Bookmark with its basename as the display name. The manager then attempts to load any previously saved bookmarks from the bookmarks file, merging them in.
func NewManagerWithDir ¶
func NewManagerWithDir(cfg config.BookmarksConfig, configDir string) *Manager
NewManagerWithDir creates a Manager with an explicit config directory. This is useful for testing to avoid loading the user's real bookmarks.
func (*Manager) Add ¶
Add validates the path exists and is a directory, checks for duplicates, and appends a new bookmark.
func (*Manager) Remove ¶
Remove deletes the bookmark with the given path. Returns an error if the path is not bookmarked.
func (*Manager) SetConfigDir ¶
SetConfigDir overrides the config directory (used in tests).