vcsurl

package module
v0.0.0-...-e2c014e Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 4 Imported by: 0

README

go-vcsurl

Go library for parsing and manipulating URLs of VCS services

Overview GoDoc

This package provides useful functions for parsing and manipulating URLs of VCS services such as GitHub, GitLab, BitBucket. It can be used to check whether a given URL points to an account, a repository, a file or a raw file. It also provides functions for converting file URLs to raw URLs and root raw URLs. Note that this library only performs syntactic checks and string manipulation, and it does not perform network calls to check that the given resources actually exist.

Install

go get github.com/alranel/go-vcsurl

Author

Alessandro Ranellucci

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRawFile

func GetRawFile(url *url.URL) *url.URL

GetRawFile returns the raw URL corresponding to the supplied file URL. In case the supplied file URL is already raw, it will be returned back.

func GetRawRoot

func GetRawRoot(url *url.URL) *url.URL

GetRawRoot returns the URL of the raw repository root containing the supplied file.

func GetRepo

func GetRepo(url *url.URL) *url.URL

GetRepo returns the URL of the main page of the repository (i.e. not raw nor git)

func IsAccount

func IsAccount(url *url.URL) bool

IsAccount returns true if the supplied URL points to the root page of an org or user account.

func IsBitBucket

func IsBitBucket(url *url.URL) bool

IsBitBucket returns true if the supplied URL belongs to BitBucket.

func IsFile

func IsFile(url *url.URL) bool

IsFile returns true if the supplied URL points to a file in non-raw mode.

func IsGitHub

func IsGitHub(url *url.URL) bool

IsGitHub returns true if the supplied URL belongs to GitHub.

func IsGitLab

func IsGitLab(url *url.URL) bool

IsGitLab returns true if the supplied URL belongs to BitBucket.

func IsRawFile

func IsRawFile(url *url.URL) bool

IsRawFile returns true if the supplied URL points to a raw file.

func IsRawRoot

func IsRawRoot(url *url.URL) bool

IsRawRoot returns true if the supplied URL is the root for raw files.

func IsRepo

func IsRepo(url *url.URL) bool

IsRepo returns true if the supplied URL points to the root page of a repository.

Types

This section is empty.

Jump to

Keyboard shortcuts

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