autodiscovery

package
v0.18.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

package autodiscovery is an implementation of the VCS Autodiscovery RFC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 added in v0.9.3

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

func (Forge) FileURL added in v0.9.3

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

func (Forge) LineURL added in v0.9.3

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

func (Forge) RawFileURL added in v0.9.3

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 added in v0.9.0

func Forgejo(url, defaultBranch string) VCS

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

func Github

func Github(url, defaultBranch string) VCS

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

func Infer added in v0.16.0

func Infer(cloneURL string) (VCS, error)

Infer tries to infer the VCS from the clone url (not reliable, use at you own risks!)

func New added in v0.9.2

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

New creates a VCS of the given type (forgejo, gitsrht, hgsrht, 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".

func SourceHutHg added in v0.12.0

func SourceHutHg(url, defaultBranch string) VCS

SourceHutHg generates VCS for hg.sr.ht. For instance "https://hg.sr.ht/~username/repo" and defaultBranch "tip".

func (VCS) GoImport

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

GoImport writes the go-import meta tag.

func (VCS) GoSource added in v0.13.0

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

GoSource writes the go-source meta tag. Its format officially does not contain the version however its seem to be used by pkgsite as {commit}.

func (VCS) MetaTags

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL