restic

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnyVersion     = ""
	BaseVersion    = "0.9"
	DefaultCommand = "__default"
)
View Source
const (
	VersionLatest = "latest"
	Executable    = "restic"
)

Variables

This section is empty.

Functions

func ClearCommands

func ClearCommands()

ClearCommands removes all know restic commands

func CommandNames

func CommandNames() []string

CommandNames returns the command names of the latest known restic version

func CommandNamesForVersion

func CommandNamesForVersion(version string) (names []string)

CommandNamesForVersion returns the names of all known restic commands for the specified restic version

func DownloadBinary

func DownloadBinary(executable, version string) error

DownloadBinary downloads a specific restic binary to executable for the current platform. Version can be empty or "latest" to download the latest available restic binary for the current platform.

func GetVersion

func GetVersion(executable string) (string, error)

GetVersion returns the version of the executable

func KnownVersions

func KnownVersions() (versions []string)

KnownVersions returns all restic versions in descending order that applied changes to available commands or command flags

func LoadCommands

func LoadCommands(filename string) (err error)

LoadCommands loads current list of commands from the specified file

func LoadEmbeddedCommands

func LoadEmbeddedCommands()

func ParseCommandsFromManPages

func ParseCommandsFromManPages(manualDir fs.FS, version string, baseVersion bool) error

ParseCommandsFromManPages parses commands from manual pages located in the specified directory and adds them to the known commands. version indicates the restic version that generated the man pages and baseVersion indicates that the version is the min required base version and will not be used for filtering

func StoreCommands

func StoreCommands(filename string) error

StoreCommands stores current list of commands to the specified file

Types

type CommandIf

type CommandIf interface {
	Versioned
	// GetName provides the command name (e.g. "backup")
	GetName() string
	// GetDescription provides the long description of the command
	GetDescription() string
	// GetOptions returns a list of all valid options (excluding GetDefaultOptions)
	GetOptions() []Option
	// Lookup returns a named option if available
	Lookup(name string) (option Option, found bool)
}

CommandIf provides access to shared Command instances

func GetCommand

func GetCommand(name string) (CommandIf, bool)

GetCommand returns the named command for the latest known restic version

func GetCommandForVersion

func GetCommandForVersion(name, version string, includeRemoved bool) (command CommandIf, found bool)

GetCommandForVersion returns the named command for the specified restic version

type Option

type Option struct {
	Name, Alias, Default, Description string
	Once                              bool
	OnlyInOS                          []string `json:",omitempty"`
	FromVersion, RemovedInVersion     string
}

Option provides meta information for a restic command option

func GetDefaultOptions

func GetDefaultOptions() []Option

GetDefaultOptions returns options that are valid for all commands for the latest known restic version

func GetDefaultOptionsForVersion

func GetDefaultOptionsForVersion(version string, includeRemoved bool) []Option

GetDefaultOptionsForVersion returns options that are valid for all commands for the specified restic version

func (*Option) AvailableForOS

func (o *Option) AvailableForOS() bool

AvailableForOS returns true if the option is available in the current runtime.GOOS

func (*Option) AvailableInOS

func (o *Option) AvailableInOS(goos string) bool

AvailableInOS returns true if the option is available in the specified goos

func (*Option) ContainedInVersion

func (o *Option) ContainedInVersion(version string) bool

func (*Option) GetFromVersion

func (o *Option) GetFromVersion() string

func (*Option) GetRemovedInVersion

func (o *Option) GetRemovedInVersion() string

type Versioned

type Versioned interface {
	// GetFromVersion returns the version when the item was supported initially
	GetFromVersion() string
	// GetRemovedInVersion returns the version when the item was no longer supported
	GetRemovedInVersion() string
	// ContainedInVersion is true the item is contained in the specified version
	ContainedInVersion(version string) bool
}

Versioned indicates that the item may be available only for certain restic versions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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