git

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotSupported = errors.New("git provider not supported")
	ErrAuthenticationFailed = func(err error) error {
		return fmt.Errorf("authentication failed, make sure credentials are correct: %w", err)
	}
)

Errors

View Source
var (
	ErrNilOpts      = errors.New("options cannot be nil")
	ErrRepoNotFound = errors.New("git repository not found")
)

Errors

Functions

func Providers

func Providers() []string

Types

type Auth

type Auth struct {
	Username string
	Password string
}

type CloneOptions

type CloneOptions struct {
	// URL clone url
	URL      string
	Revision string
	RepoRoot string
	Auth     Auth
	// contains filtered or unexported fields
}

func AddFlags

func AddFlags(cmd *cobra.Command) (*CloneOptions, error)

func (*CloneOptions) Clone

func (o *CloneOptions) Clone(ctx context.Context, filesystem fs.FS) (Repository, fs.FS, error)

type CreateRepoOptions

type CreateRepoOptions struct {
	Owner   string
	Name    string
	Private bool
}

type GetRepoOptions

type GetRepoOptions struct {
	Owner string
	Name  string
}

type Provider

type Provider interface {
	// CreateRepository creates the repository in the remote provider and returns a
	// clone url
	CreateRepository(ctx context.Context, opts *CreateRepoOptions) (string, error)
}

Provider represents a git provider

func NewProvider

func NewProvider(opts *ProviderOptions) (Provider, error)

New creates a new git provider

type ProviderOptions

type ProviderOptions struct {
	Type string
	Auth *Auth
	Host string
}

ProviderOptions for a new git provider

type PushOptions

type PushOptions struct {
	AddGlobPattern string
	CommitMsg      string
}

type Repository

type Repository interface {
	// Persist runs add, commit and push to the repository default remote
	Persist(ctx context.Context, opts *PushOptions) error
}

Repository represents a git repository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳