Skip to content

Latest commit

 

History

History
50 lines (42 loc) · 1.24 KB

README.md

File metadata and controls

50 lines (42 loc) · 1.24 KB

Gity

Build Status Go Report Card GoDoc

Check type of Git url protocol simply whether is SSH, HTTP or HTTPS with Zero Dependencies

type Type struct {
	Address        string
	Type           string
	RepositoryName string
}

Installation

go get -u -v github.com/supanadit/gity

How To Use

import "github.com/supanadit/gity"

For SSH

gity, err := gity.Check("git@github.com:supanadit/jwt-go.git")
if err != nil {
    panic(err)
}
fmt.Println(gity.IsHTTPORS()) // false
fmt.Println(gity.IsHTTP()) // false
fmt.Println(gity.IsHTTPS()) // false
fmt.Println(gity.IsSSH()) // true

For HTTP / HTTPS

type, err := gity.Check("https://github.com/supanadit/jwt-go.git")
if err != nil {
    panic(err)
}
fmt.Println(type.IsHTTPORS()) // true
fmt.Println(type.IsHTTP()) // false
fmt.Println(type.IsHTTPS()) // true
fmt.Println(type.IsSSH()) // false