lib

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TXT_FLAGS_USE       = "If -r/-g not specified, all remotes in config file will be used. "
	TXT_REPO_CLONE_LONG = "Provide at least one repository name(not url). Need exactly one -r/--remote. Do not accept -g/--group."
	TXT_REPO_CLONE_USE  = "<repository ...>"
	TXT_REPO_DIR_LONG   = "If no repository is specified, current git root will be used as repository name. "
	TXT_REPO_DIR_USE    = "[repository/directory ...]"
)

Variables

This section is empty.

Functions

func GitClone added in v2.6.0

func GitClone(optionsP *[]string, wgP *sync.WaitGroup) *helper.MyCmd

git clone to current directory

func GitPull added in v2.6.0

func GitPull(workPathP *string, optionsP *[]string, wgP *sync.WaitGroup) *helper.MyCmd

Push all Remotes in git repository

func GitPush

func GitPush(workPathP *string, optionsP *[]string, wgP *sync.WaitGroup) *helper.MyCmd

Push all Remotes in git repository

Types

type ConfSecret

type ConfSecret struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Secret entry in config file

func (*ConfSecret) Encrypt

func (self *ConfSecret) Encrypt(pubKeyP *gitapi.RepoPublicKey) *gitapi.RepoEncryptedPair

Do NACL box encryption

type ConfSecrets

type ConfSecrets []ConfSecret

func (*ConfSecrets) Has

func (self *ConfSecrets) Has(name *string) bool

Check if secrete exist by name

type Groups

type Groups []string

Group names

func (*Groups) Add

func (groupsP *Groups) Add(groupP *string)

func (*Groups) Get

func (groupsP *Groups) Get(name string) *string

func (*Groups) Has

func (groupsP *Groups) Has(groupP *string) bool

type Remote

type Remote struct {
	Name  string `json:"name"`  // Name of remote entry, also use as git remote name
	Group string `json:"group"` // Group name
	Ssh   string `json:"ssh"`   // Ssh url for git server

	Entrypoint string `json:"entrypoint"` // Api entrypoint url
	Token      string `json:"token"`      // Api token
	User       string `json:"user"`       // Api user
	Private    bool   `json:"private"`    // Default private value
	Vendor     string `json:"vendor"`     // Api vendor/brand
	SkipVerify bool   `json:"skipverify"` // Api request skip cert verify (allow self-signed cert)
}

Remote entry in config file

func (*Remote) GetGitApi

func (self *Remote) GetGitApi(workPathP *string, info gitapi.GitApiInfo) *gitapi.GitApi

func (*Remote) GitAdd

func (self *Remote) GitAdd(workPathP *string) *helper.MyCmd

Add all Remotes into git repository

func (*Remote) GitRemove

func (self *Remote) GitRemove(workPathP *string) *helper.MyCmd

Remove all Remotes in git repository

type Remotes

type Remotes []Remote

Array of Remote

func (*Remotes) Add

func (self *Remotes) Add(rP *Remote)

Add Remote

func (*Remotes) AddArray

func (self *Remotes) AddArray(raP *Remotes)

Add Remote Array

func (*Remotes) GetByGroup

func (self *Remotes) GetByGroup(groupP *string) *Remotes

Get all Remote in a group

func (*Remotes) GetByName added in v2.5.0

func (self *Remotes) GetByName(nameP *string) *Remote

Get Remote by name

func (*Remotes) GetNames added in v2.5.0

func (self *Remotes) GetNames() *[]string

Get all Remote names

func (*Remotes) Has

func (self *Remotes) Has(name *string) bool

Check array has Remote (by name)

type TypeConf

type TypeConf struct {
	File          string      `json:"-"`
	Groups        Groups      `json:"-"`
	Remotes       Remotes     `json:"remotes"`
	Secrets       ConfSecrets `json:"secrets"`
	MergedRemotes Remotes     `json:"-"`
}

File, Group, MergeRemotes are filled in at runtime

Remotes, Secrets are read from config file by viper

var Conf TypeConf

func (*TypeConf) Init

func (self *TypeConf) Init()

Fill in conf struct from viper and extract all groups from `Remotes`

func (*TypeConf) MergeRemotes

func (self *TypeConf) MergeRemotes()

Calculate remotes base on flag

type TypeFlag

type TypeFlag struct {
	Args            []string   // Args from command line
	Debug           bool       // Enable debug output
	Groups          []string   // Groups specified in command line
	NoParallel      bool       // Do not process in parallel(go routine)
	NoSkip          bool       // Flag for not skipping empty output
	NoTitle         bool       // Do not print title in output
	Page            int        // Page number of repository listing
	PushAll         bool       // Flag for git push
	PushBranch      []string   // Flag for git push
	PushTag         bool       // Flag for git push
	RemoteRemoveAll bool       // Flag for git remote remove all
	Remotes         []string   // Remotes specified in command line
	Secret          ConfSecret // Secret specified in command line
	SecretsDel      []string   // Secrets specified in command line
}

Holding all flags from command line

var Flag TypeFlag

Jump to

Keyboard shortcuts

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