giturl

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 4 Imported by: 1

README

go-giturl

CI GoDoc GitHub issues GitHub forks GitHub stars GitHub license

Parse git remote URLs.

Example

package main

import (
    "fmt"

    "github.com/dosquad/go-giturl"
)

// Output: slug: dosquad/go-giturl
func main() {
    u, err := giturl.Parse("git@github.com:dosquad/go-giturl.git")
    if err != nil {
        panic(err)
    }

    fmt.Printf("slug: %s", u.Slug())
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrUnknownSyntax = errors.New("unknown URL syntax")

Functions

This section is empty.

Types

type URL

type URL struct {
	*url.URL

	PathUser     *url.Userinfo
	PathRelative string
}

func Parse

func Parse(rawURL string) (*URL, error)
Example
package main

import (
	"fmt"

	"github.com/dosquad/go-giturl"
)

func main() {
	u, err := giturl.Parse("git@github.com:dosquad/go-giturl.git")
	if err != nil {
		panic(err)
	}

	fmt.Printf("slug: %s", u.Slug())
}
Output:
slug: dosquad/go-giturl

func (*URL) Slug

func (u *URL) Slug() string

func (*URL) String

func (u *URL) String() string

Jump to

Keyboard shortcuts

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