gity

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

README

Gity

Build Status Go Report Card

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type struct {
	Address        string
	Type           string
	RepositoryName string
}

Type is the default model provided by the library

func Check

func Check(url string) (t Type, err error)

Check is the function to check type of git

func (Type) IsHTTP

func (gitType Type) IsHTTP() bool

IsHTTP will return true if this url is type of HTTP

func (Type) IsHTTPORS

func (gitType Type) IsHTTPORS() bool

IsHTTPORS will return true if this url is type of HTTP or HTTPS

func (Type) IsHTTPS

func (gitType Type) IsHTTPS() bool

IsHTTPS will return true if this url is type of HTTPS

func (Type) IsSSH

func (gitType Type) IsSSH() bool

IsSSH will return true if this url is type of SSH

Jump to

Keyboard shortcuts

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