Documentation ¶
Index ¶
- Constants
- func ClearCommands()
- func CommandNames() []string
- func CommandNamesForVersion(version string) (names []string)
- func DownloadBinary(executable, version string) error
- func GetVersion(executable string) (string, error)
- func KnownVersions() (versions []string)
- func LoadCommands(filename string) (err error)
- func LoadEmbeddedCommands()
- func ParseCommandsFromManPages(manualDir fs.FS, version string, baseVersion bool) error
- func StoreCommands(filename string) error
- type CommandIf
- type Option
- type Versioned
Constants ¶
const ( AnyVersion = "" BaseVersion = "0.9" DefaultCommand = "__default" )
const ( VersionLatest = "latest" Executable = "restic" )
Variables ¶
This section is empty.
Functions ¶
func CommandNames ¶
func CommandNames() []string
CommandNames returns the command names of the latest known restic version
func CommandNamesForVersion ¶
CommandNamesForVersion returns the names of all known restic commands for the specified restic version
func DownloadBinary ¶
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 ¶
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 ¶
LoadCommands loads current list of commands from the specified file
func LoadEmbeddedCommands ¶
func LoadEmbeddedCommands()
func ParseCommandsFromManPages ¶
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 ¶
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 ¶
GetCommand returns the named command for the latest known 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 ¶
GetDefaultOptionsForVersion returns options that are valid for all commands for the specified restic version
func (*Option) AvailableForOS ¶
AvailableForOS returns true if the option is available in the current runtime.GOOS
func (*Option) AvailableInOS ¶
AvailableInOS returns true if the option is available in the specified goos
func (*Option) ContainedInVersion ¶
func (*Option) GetFromVersion ¶
func (*Option) GetRemovedInVersion ¶
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