💾 Archived View for code.pfad.fr › vanitydoc › autodiscovery captured on 2023-04-26 at 13:14:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

➡️ Next capture (2023-07-10)

-=-=-=-=-=-=-

autodiscovery package

import "code.pfad.fr/vanitydoc/autodiscovery"

package autodiscovery is an implementation of the [VCS Autodiscovery RFC].

VCS Autodiscovery RFC

Types

type Forge

type Forge struct {
	RawFile string
	File    string
	Dir     string
	Summary string
	Line    string
}

Forge indicates the links used to navigate around the software forge.

type VCS

type VCS struct {
	Type          string
	DefaultBranch string
	Clone         []string
	Forge         Forge
}

VCS represents the Version Control System being used.

func Gitea

func Gitea(domain, uri, defaultBranch string) VCS

Gitea generates VCS for gitea. For instance domain "codeberg.org", uri "pfad.fr/vanitydoc" and defaultBranch "main".

Gitea expects the type of "ref" in the URL (branch/main, tag/v1.0.0), so this is a bit hacky.

func Github

func Github(domain, uri, defaultBranch string) VCS

Github generates VCS for github. For instance domain "github.com", uri "fluhus/godoc-tricks" and defaultBranch "main".

func ParseURL

func ParseURL(rawURL string) (VCS, error)

ParseURL parses a forge URL into a VCS struct. Use the scheme to specify the forge type:

Use the username to specify the default branch (main if unspecified):

func SourceHutGit

func SourceHutGit(domain, uri, defaultBranch string) VCS

SourceHutGit generates VCS for git.sr.ht. Domain is usually "git.sr.ht", uri "~username/repo" and defaultBranch "main".

func (VCS) GoImport

func (vcs VCS) GoImport(wr io.Writer, importPrefix string) error

GoImport writes the [go-import] meta tag.

go-import

func (VCS) MetaTags

func (vcs VCS) MetaTags(wr io.Writer) error

MetaTags writes the [VCS Autodiscovery RFC] meta tags (which are not empty).

VCS Autodiscovery RFC

Files

autodiscovery.go

url.go

Forge

https://codeberg.org/pfad.fr/vanitydoc

git clone

https://codeberg.org/pfad.fr/vanitydoc
git@codeberg.org:pfad.fr/vanitydoc