💾 Archived View for code.pfad.fr › vanitydoc › autodiscovery captured on 2023-12-28 at 15:28:46. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

➡️ Next capture (2024-02-05)

🚧 View Differences

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

autodiscovery package - code.pfad.fr/vanitydoc

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 {
	Summary string // overview of the project
	Dir     string
	File    string // file with pretty printing
	Line    string // file with specific line hightlighted
	RawFile string
}

Forge indicates the URLs pattern available in the software forge (with {ref}, {path} and {line} as placeholders).

func (Forge) DirURL

func (f Forge) DirURL(path, ref string) (url string)

func (Forge) FileURL

func (f Forge) FileURL(path, ref string) (url string)

func (Forge) LineURL

func (f Forge) LineURL(path, ref, line string) (url string)

func (Forge) RawFileURL

func (f Forge) RawFileURL(path, ref string) (url string)

type VCS

type VCS struct {
	// VCS Standard Tags
	Kind          string // git, fossil, pijul...
	DefaultBranch string
	Clone         []string // URLs for clones (unauthenticated first)
	Forge         Forge
}

VCS represents the Version Control System being used.

func Forgejo

func Forgejo(url, defaultBranch string) VCS

Forgejo generates VCS for forgejo/gitea. For instance "[https://codeberg.org/pfad.fr/vanitydoc]" and defaultBranch "main".

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

func Github

func Github(url, defaultBranch string) VCS

Github generates VCS for github. For instance "[https://github.com/fluhus/godoc-tricks]" and defaultBranch "main".

https://github.com/fluhus/godoc-tricks

func New

func New(typ string, url, defaultBranch string) (VCS, error)

NewFromString creates a VCS of the given type (gitsrht, forgejo, github).

func SourceHutGit

func SourceHutGit(url, defaultBranch string) VCS

SourceHutGit generates VCS for git.sr.ht. For instance "[https://git.sr.ht/~username/repo]" and defaultBranch "main".

https://git.sr.ht/~username/repo

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

Breadcrumb

code.pfad.fr/vanitydoc