giturl

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 54

Documentation

Index

Constants

View Source
const (
	// KindBitBucketCloud git kind for BitBucket Cloud
	KindBitBucketCloud = "bitbucketcloud"
	// KindBitBucketServer git kind for BitBucket Server
	KindBitBucketServer = "bitbucketserver"
	// KindGitea git kind for gitea
	KindGitea = "gitea"
	// KindGitlab git kind for gitlab
	KindGitlab = "gitlab"
	// KindGitHub git kind for github
	KindGitHub = "github"
	// KindGitFake git kind for fake git
	KindGitFake = "fakegit"
	// KindUnknown git kind for unknown git
	KindUnknown = "unknown"

	// BitbucketCloudURL the default URL for BitBucket Cloud
	BitbucketCloudURL = "https://bitbucket.org"

	// FakeGitURL the default URL for the fake git provider
	FakeGitURL = "https://fake.git"
)
View Source
const (
	GitHubHost = "github.com"
	GitHubURL  = "https://github.com"
)

Variables

Functions

func BitBucketCloudAccessTokenURL

func BitBucketCloudAccessTokenURL(url string, username string) string

func BitBucketServerAccessTokenURL

func BitBucketServerAccessTokenURL(url string) string

BitBucketServerAccessTokenURL generates the access token URL

func GitHubAccessTokenURL

func GitHubAccessTokenURL(url string) string

func GiteaAccessTokenURL

func GiteaAccessTokenURL(url string) string

GiteaAccessTokenURL returns the URL to generate an access token

func GitlabAccessTokenURL

func GitlabAccessTokenURL(url string) string

GitlabAccessTokenURL returns the URL to click on to generate a personal access token for the Git provider

func HttpCloneURL

func HttpCloneURL(repo *GitRepository, kind string) string

HttpCloneURL returns the HTTPS git URL this repository

func PrintCreateRepositoryGenerateAccessToken

func PrintCreateRepositoryGenerateAccessToken(kind string, serverURL string, username string, o io.Writer)

PrintCreateRepositoryGenerateAccessToken prints the access token URL of a Git repository

func ProviderAccessTokenURL

func ProviderAccessTokenURL(kind string, url string, username string) string

func SaasGitKind

func SaasGitKind(gitServiceUrl string) string

SaasGitKind returns the kind for SaaS Git providers or "" if the URL could not be deduced

Types

type GitRepository

type GitRepository struct {
	ID               int64
	Name             string
	AllowMergeCommit bool
	HTMLURL          string
	CloneURL         string
	SSHURL           string
	Language         string
	Fork             bool
	Stars            int
	URL              string
	Scheme           string
	Host             string
	Organisation     string
	Project          string
	Private          bool
	HasIssues        bool
	OpenIssueCount   int
	HasWiki          bool
	HasProjects      bool
	Archived         bool
}

func ParseGitOrganizationURL

func ParseGitOrganizationURL(text string) (*GitRepository, error)

ParseGitOrganizationURL attempts to parse the given text as a URL or git URL-like string to determine the protocol, host, organisation

func ParseGitURL

func ParseGitURL(text string) (*GitRepository, error)

ParseGitURL attempts to parse the given text as a URL or git URL-like string to determine the protocol, host, organisation and name

func (*GitRepository) HostURL

func (i *GitRepository) HostURL() string

HostURL returns the URL to the host

func (*GitRepository) HostURLWithoutUser

func (i *GitRepository) HostURLWithoutUser() string

func (*GitRepository) HttpURL

func (i *GitRepository) HttpURL() string

HttpURL returns the URL to browse this repository in a web browser

func (*GitRepository) HttpsURL

func (i *GitRepository) HttpsURL() string

HttpsURL returns the URL to browse this repository in a web browser

func (*GitRepository) IsGitHub

func (i *GitRepository) IsGitHub() bool

func (*GitRepository) PipelinePath

func (i *GitRepository) PipelinePath() string

PipelinePath returns the pipeline path for the master branch which can be used to query pipeline logs in `jx get build logs myPipelinePath`

func (*GitRepository) PullRequestURL

func (i *GitRepository) PullRequestURL(prName string) string

PullRequestURL returns the URL of a pull request of the given name/number

func (*GitRepository) URLWithoutUser

func (i *GitRepository) URLWithoutUser() string

URLWithoutUser returns the URL without any user/password

Jump to

Keyboard shortcuts

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