internal

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "1.8.2"

Variables

This section is empty.

Functions

func AddFlagsToCommand

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

func ArrayContains added in v1.6.0

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 added in v1.5.0

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 added in v1.0.4

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

type ColoredWriter added in v1.7.0

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

func (ColoredWriter) Write added in v1.7.0

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 added in v1.0.4

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 {
	Dir         string    `mapstructure:"dir"`
	PreValidate HookArray `mapstructure:"prevalidate,omitempty"`
	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 added in v1.5.0

func (l Location) ExecuteHooks(commands []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) error

func (Location) RunCron

func (l Location) RunCron() error

type LocationCopy added in v1.6.0

type LocationCopy = map[string][]string

type LocationForgetOption added in v1.6.0

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 added in v1.4.0

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