remote

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package remote turns git remote URLs into forge projects.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotForgeURL = errors.New("remote is not a forge repository URL")

ErrNotForgeURL is returned for remotes that do not name a repository on a network host: local paths, file URLs, unsupported schemes, and paths with fewer than two segments.

Functions

func Parse

func Parse(raw string) (host, path string, err error)

Parse extracts the lowercased host and the repository path from a git remote URL in scp-like, ssh, git, http or https form. Port and userinfo are dropped, as are a leading slash, a trailing slash and a ".git" suffix. Errors never include the input, which may carry credentials.

Types

type Classifier

type Classifier struct {
	// GitHubHosts lists GitHub Enterprise Server hosts; github.com is implicit.
	GitHubHosts []string
	// GitLabHosts lists GitLab hosts, including gitlab.com if wanted.
	GitLabHosts []string
}

Classifier decides which forge a host belongs to.

func (Classifier) Project

func (c Classifier) Project(raw string) (project forge.Project, ok bool, err error)

Project parses raw and classifies its host. GitHub wins when a host is in both lists. An unknown host yields ok == false and a nil error; a parse failure yields ok == false and the error.

Jump to

Keyboard shortcuts

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