internal

package
v0.0.0-...-d09873d Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "1.7.5"

Variables

This section is empty.

Functions

func AddFlagsToCommand

func AddFlagsToCommand(cmd *cobra.Command, backend bool)

func ArrayContains

func ArrayContains[T comparable](arr []T, needle T) bool

func CheckConfig

func CheckConfig() error

func CheckIfCommandIsCallable

func CheckIfCommandIsCallable(cmd string) bool

func CheckIfResticIsCallable

func CheckIfResticIsCallable() bool

func CheckIfVolumeExists

func CheckIfVolumeExists(volume string) bool

func CopyFile

func CopyFile(from, to string) error

func ExecuteCommand

func ExecuteCommand(options ExecuteOptions, args ...string) (int, string, error)

func ExecuteResticCommand

func ExecuteResticCommand(options ExecuteOptions, args ...string) (int, string, error)

func GetAllOrSelected

func GetAllOrSelected(cmd *cobra.Command, backends bool) ([]string, error)

func GetPathRelativeToConfig

func GetPathRelativeToConfig(p string) (string, error)

func RunCron

func RunCron() error

Types

type Backend

type Backend struct {
	Type    string            `mapstructure:"type,omitempty"`
	Path    string            `mapstructure:"path,omitempty"`
	Key     string            `mapstructure:"key,omitempty"`
	Env     map[string]string `mapstructure:"env,omitempty"`
	Rest    BackendRest       `mapstructure:"rest,omitempty"`
	Options Options           `mapstructure:"options,omitempty"`
	// contains filtered or unexported fields
}

func GetBackend

func GetBackend(name string) (Backend, bool)

func (Backend) Exec

func (b Backend) Exec(args []string) error

func (Backend) ExecDocker

func (b Backend) ExecDocker(l Location, args []string) (int, string, error)

type BackendRest

type BackendRest struct {
	User     string `mapstructure:"user,omitempty"`
	Password string `mapstructure:"password,omitempty"`
}

type ColoredWriter

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

func (ColoredWriter) Write

func (w ColoredWriter) Write(p []byte) (n int, err error)

type Config

type Config struct {
	Version   string              `mapstructure:"version"`
	Extras    interface{}         `mapstructure:"extras"`
	Locations map[string]Location `mapstructure:"locations"`
	Backends  map[string]Backend  `mapstructure:"backends"`
	Global    Options             `mapstructure:"global"`
}

func GetConfig

func GetConfig() *Config

func (*Config) Describe

func (c *Config) Describe()

func (*Config) SaveConfig

func (c *Config) SaveConfig() error

type ExecuteOptions

type ExecuteOptions struct {
	Command string
	Envs    map[string]string
	Dir     string
	Silent  bool
}

type HookArray

type HookArray = []string

type Hooks

type Hooks struct {
	RestoreOption HooksList `mapstructure:"restore,omitempty"`
	BackupOption  HooksList `mapstructure:"backup,omitempty"`
}

type HooksList

type HooksList struct {
	Dir     string    `mapstructure:"dir"`
	Before  HookArray `mapstructure:"before,omitempty"`
	After   HookArray `mapstructure:"after,omitempty"`
	Success HookArray `mapstructure:"success,omitempty"`
	Failure HookArray `mapstructure:"failure,omitempty"`
}

type Location

type Location struct {
	From         []string             `mapstructure:"from,omitempty"`
	Type         string               `mapstructure:"type,omitempty"`
	To           []string             `mapstructure:"to,omitempty"`
	Hooks        Hooks                `mapstructure:"hooks,omitempty"`
	Cron         string               `mapstructure:"cron,omitempty"`
	Options      Options              `mapstructure:"options,omitempty"`
	ForgetOption LocationForgetOption `mapstructure:"forget,omitempty"`
	CopyOption   LocationCopy         `mapstructure:"copy,omitempty"`
	// contains filtered or unexported fields
}

func GetLocation

func GetLocation(name string) (Location, bool)

func (Location) Backup

func (l Location) Backup(cron bool, specificBackend string) []error

func (Location) ExecuteHooks

func (l Location) ExecuteHooks(commands []string, directory string, options ExecuteOptions) error

func (Location) Forget

func (l Location) Forget(prune bool, dry bool) error

func (Location) Restore

func (l Location) Restore(to, from string, force bool, snapshot string, options []string) (errors []error)

func (Location) RunCron

func (l Location) RunCron() error

type LocationCopy

type LocationCopy = map[string][]string

type LocationForgetOption

type LocationForgetOption string
const (
	LocationForgetYes   LocationForgetOption = "yes"
	LocationForgetNo    LocationForgetOption = "no"
	LocationForgetPrune LocationForgetOption = "prune"
)

type LocationType

type LocationType string
const (
	TypeLocal  LocationType = "local"
	TypeVolume LocationType = "volume"
)

type OptionMap

type OptionMap map[string][]interface{}

type Options

type Options map[string]OptionMap

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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