utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepo

func CloneRepo(repo *github.Repository, repoPath string, config Config) error

CloneRepo clones an individual repo to a local path

func FilteredRepos

func FilteredRepos(config Config) ([]*github.Repository, error)

FilteredRepos loads a list of repositories and removes ones that match a filter

func HandleRepos

func HandleRepos(config Config, repos []*github.Repository) error

HandleRepos handles all repos, updating or cloning as necessary

func UpdateRepo

func UpdateRepo(repoPath string, config Config) error

UpdateRepo updates an existing repo

Types

type Config

type Config struct {
	AuthToken  string   `json:"auth_token"`
	TargetPath string   `json:"target_path"`
	Excludes   []string `json:"excludes"`
}

Config definition for syncgithub

func LoadConfig

func LoadConfig(fileArg string) (Config, error)

LoadConfig reads the config from a file

func (*Config) GetUser

func (c *Config) GetUser() (string, error)

GetUser finds the current username

func (*Config) GithubClient

func (c *Config) GithubClient() *github.Client

GithubClient creates a Github Client from the provided OAuth token

type Filter

type Filter struct {
	Patterns []*regexp.Regexp
}

Filter simplifies running a repo name over a list of exclusion patterns

func NewFilter

func NewFilter(config Config) (*Filter, error)

NewFilter creates a new filter object with a list of regexp patterns

func (*Filter) Match

func (f *Filter) Match(repo string) bool

Match checks if the repo name matches any of the filter's patterns

Jump to

Keyboard shortcuts

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