Skip to content

supanadit/gity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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