1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-10-18 13:48:07 +02:00

added version, added exclude organizations

This commit is contained in:
Andreas Wachter 2021-12-03 21:34:46 +01:00
parent 9808abba29
commit ceecb85a71
3 changed files with 27 additions and 9 deletions

@ -26,6 +26,9 @@ source:
exclude: # this excludes the repos foo and bar
- foo
- bar
excludeorgs:
- foo
- bar
gitea:
- token: blabla
user: blabla

16
main.go

@ -31,8 +31,17 @@ import (
"gopkg.in/yaml.v2"
)
type versionFlag bool
func (v versionFlag) BeforeApply() error {
fmt.Println("v0.9.3-1")
os.Exit(0)
return nil
}
var cli struct {
Configfile string `arg required name:"conf" help:"path to the configfile." type:"existingfile"`
Version versionFlag
}
var (
@ -365,11 +374,16 @@ func getGithub(conf *Conf) []Repo {
}
exclude := GetExcludedMap(repo.Exclude)
excludeorgs := GetExcludedMap(repo.ExcludeOrgs)
for _, r := range githubrepos {
if exclude[*r.Name] {
continue
}
if excludeorgs[r.GetOwner().GetLogin()] {
continue
}
repos = append(repos, Repo{Name: r.GetName(), Url: r.GetCloneURL(), SshUrl: r.GetSSHURL(), Token: repo.Token, Defaultbranch: r.GetDefaultBranch(), Origin: repo})
}
}
@ -559,7 +573,7 @@ func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
kong.Parse(&cli)
kong.Parse(&cli, kong.Name("gickup"), kong.Description("a tool to backup all your favorite repos"))
log.Info().Str("file", cli.Configfile).Msgf("Reading %s", green(cli.Configfile))
conf := ReadConfigfile(cli.Configfile)

@ -31,14 +31,15 @@ type Source struct {
// Generell Repo
type GenRepo struct {
Token string `yaml:"token"`
User string `yaml:"user"`
SSH bool `yaml:"ssh"`
SSHKey string `yaml:"sshkey"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Url string `yaml:"url"`
Exclude []string `yaml:"exclude"`
Token string `yaml:"token"`
User string `yaml:"user"`
SSH bool `yaml:"ssh"`
SSHKey string `yaml:"sshkey"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Url string `yaml:"url"`
Exclude []string `yaml:"exclude"`
ExcludeOrgs []string `yaml:"excludeorgs"`
}
// Repo