autodiscovery

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: BSD-3-Clause Imports: 6 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 {
	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:

  • gitea://git.example.com/folder
  • gitsrht://git.example.com/folder

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

  • gitea://master@git.example.com/folder
  • gitsrht://dev@git.example.com/folder

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.

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