github

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Prefix is the prefix that all GitHub repository paths have.
	Prefix = "github.com/"
	// Alpha contains all the lower and upper case ASCII letters.
	Alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// Numeric contains all the ASCII digits.
	Numeric = "0123456789"
	// Hyphen is an ASCII hyphen-minus sign -.
	Hyphen = "-"
	// Dot is an ASCII full stop.
	Dot = "."
	// Underscore is an ASCII underscore.
	Underscore = "_"
	// Slash is an ASCII slash or divide character (unicode solidus)
	Slash = "/"

	// UsernameAllowedChars are the characters allowed anywhere in a username.
	UsernameAllowedChars = Alpha + Numeric
	// UsernameAllowedMiddleChars are the characters allowed in the middle of a
	// username.
	UsernameAllowedMiddleChars = UsernameAllowedChars + Hyphen

	// RepoNameAllowedChars are the characters allowed anywhere in a repo name.
	RepoNameAllowedChars = Alpha + Numeric
	// RepoNameAllowedMiddleChars are the characters allowed in the middle of a
	// repo name.
	RepoNameAllowedMiddleChars = RepoNameAllowedChars + Hyphen + Dot + Underscore

	// OffsetAllowedChars are characters allowed in the offset directory path.
	OffsetAllowedChars = Alpha + Numeric + Hyphen + Dot + Underscore + Slash
)

Variables

This section is empty.

Functions

func ParseSourceLocation

func ParseSourceLocation(s string) (sous.SourceLocation, error)

ParseSourceLocation parses s for a GitHub based sous.SourceLocation. It returns an error if the string is malformed, or if it does not begin with "github.com/".

Types

type SourceHost

type SourceHost struct{}

SourceHost is the GitHub source code host. It satisfies sous.SourceHost.

func (SourceHost) CanParseSourceLocation

func (SourceHost) CanParseSourceLocation(s string) bool

CanParseSourceLocation returns true if s begins with Prefix.

func (SourceHost) GetSource

func (h SourceHost) GetSource(id sous.SourceID) (sous.Source, error)

GetSource returns a sous.Source for the provided id. It returns an error if Owns(id.Location) returns false, or if any internal operations, which may include network requests, disk access, etc, fail.

func (SourceHost) Owns

func (SourceHost) Owns(sl sous.SourceLocation) bool

Owns returns true if sl.Repo begins with Prefix.

func (SourceHost) ParseSourceLocation

func (SourceHost) ParseSourceLocation(s string) (sous.SourceLocation, error)

ParseSourceLocation parses a GitHub source location.

Jump to

Keyboard shortcuts

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