Skip to content

history

import "github.com/ananth/codespace-zed/internal/history"

Package history tracks recently used repositories so the interactive repo picker can sort them by recency. The history is stored as JSON in \~/.config/codespace-zed/history.json.

Index

type Entry

Entry records a single repo usage.

type Entry struct {
    Repository string    `json:"repository"`
    LastUsed   time.Time `json:"lastUsed"`
}

type History

History tracks recently used repositories.

type History struct {
    Entries []Entry `json:"entries"`
}

func Load

func Load() *History

Load reads the history file. Returns empty history if missing.

func LoadFrom

func LoadFrom(path string) *History

LoadFrom reads history from a specific path.

func (*History) Save

func (h *History) Save() error

Save writes the history file.

func (*History) SaveTo

func (h *History) SaveTo(path string) error

SaveTo writes history to a specific path.

func (*History) SortRepos

func (h *History) SortRepos(repos []string) []string

SortRepos reorders repos by recency. Repos not in history go to the end, preserving their original order.

func (*History) Touch

func (h *History) Touch(repo string)

Touch records a repository as just used.

Generated by gomarkdoc