1package backend
2
3import (
4 "github.com/charmbracelet/soft-serve/git"
5)
6
7// LatestFile returns the contents of the latest file at the specified path in
8// the repository and its file path.
9func LatestFile(r Repository, pattern string) (string, string, error) {
10 repo, err := r.Open()
11 if err != nil {
12 return "", "", err
13 }
14 return git.LatestFile(repo, pattern)
15}
16
17// Readme returns the repository's README.
18func Readme(r Repository) (readme string, path string, err error) {
19 readme, path, err = LatestFile(r, "README*")
20 return
21}