sync

package module
v0.0.0-...-b08fd25 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(pr Program, cfg Config) error

Run is the default program run/exec.

func SetLogger

func SetLogger(l Logger)

SetLogger sets logger for the package.

Types

type Command

type Command struct {
	BinPath string
	Args    []string
	Chdir   string
}

Command describes the commands that are run.

type Config

type Config struct {
	Dir string
}

Config describes the current runtime environment.

type GSUtil

type GSUtil struct {
	// contains filtered or unexported fields
}

GSUtil describes how to run gsutil.

func NewGSUtil

func NewGSUtil(binPath string, bucketName string) (*GSUtil, error)

NewGSUtil creates gcp storage rsync command.

To setup, make a remote bucket: gsutil mb gs://<bucket>

func (*GSUtil) Commands

func (g *GSUtil) Commands(cfg Config) ([]Command, error)

Commands to be run.

type Git

type Git struct{}

Git describes how to run git syncing.

func NewGit

func NewGit() (*Git, error)

NewGit creates git syncing command.

func (*Git) Commands

func (g *Git) Commands(cfg Config) ([]Command, error)

Commands to be run.

type GitSetup

type GitSetup struct {
	// contains filtered or unexported fields
}

GitSetup describes how to setup a directory with git.

To setup, initialize the git repo and add the remote: git init git remote add origin git@gitlab.com:gabrielha/keys.pub.test.git

func NewGitSetup

func NewGitSetup(repo string) (*GitSetup, error)

NewGitSetup creates git sync command.

func (*GitSetup) Commands

func (g *GitSetup) Commands(cfg Config) ([]Command, error)

Commands to be run.

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...

type Program

type Program interface {
	Commands(cfg Config) ([]Command, error)
}

Program to run for syncing.

Jump to

Keyboard shortcuts

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