options: Register local and sftp backends

This commit is contained in:
Alexander Neumann 2017-04-13 23:55:32 +02:00
parent b7671dafc8
commit 859ee23d2e
2 changed files with 13 additions and 3 deletions

View File

@ -4,12 +4,17 @@ import (
"strings" "strings"
"restic/errors" "restic/errors"
"restic/options"
) )
// Config holds all information needed to open a local repository. // Config holds all information needed to open a local repository.
type Config struct { type Config struct {
Path string Path string
Layout string `option:"layout"` Layout string `option:"layout" help:"use this backend directory layout (default: auto-detect)"`
}
func init() {
options.Register("local", Config{})
} }
// ParseConfig parses a local backend config. // ParseConfig parses a local backend config.

View File

@ -6,13 +6,18 @@ import (
"strings" "strings"
"restic/errors" "restic/errors"
"restic/options"
) )
// Config collects all information required to connect to an sftp server. // Config collects all information required to connect to an sftp server.
type Config struct { type Config struct {
User, Host, Path string User, Host, Path string
Layout string `option:"layout"` Layout string `option:"layout" help:"use this backend directory layout (default: auto-detect)"`
Command string `option:"command"` Command string `option:"command" help:"specify command to create sftp connection"`
}
func init() {
options.Register("sftp", Config{})
} }
// ParseConfig parses the string s and extracts the sftp config. The // ParseConfig parses the string s and extracts the sftp config. The