all repos — searchix @ 2f2d86922ba23c4b7f92b115f4e8d26e5058bd23

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: link man pages like how NixOS does it

Alan Pearce
commit

2f2d86922ba23c4b7f92b115f4e8d26e5058bd23

parent

813e5a26b629d4c27b6ce0a8de2e3d04308ef535

1 file changed, 21 insertions(+), 0 deletions(-)

changed files
M internal/config/repository.gointernal/config/repository.go
@@ -22,6 +22,27 @@ Repo string
Revision string `toml:"-"` } +func (r *Repository) GetRawFileURL(path string) (string, errors.E) { + switch r.Type { + case GitHub: + ref := r.Revision + if ref == "" { + ref = "master" + } + u, err := url.JoinPath("https://github.com/", r.Owner, r.Repo, "raw", ref, path) + if err != nil { + return "", errors.Wrap(err, "failed to join path") + } + + return u, nil + default: + return "", errors.Errorf( + "don't know how to generate a repository URL for %s", + r.Type.String(), + ) + } +} + func (r *Repository) GetFileURL(path string, line ...string) (string, errors.E) { switch r.Type { case GitHub: