Restructure cmd/restic, no functional changes

This commit is contained in:
Alexander Neumann
2015-06-21 13:02:56 +02:00
parent 2fa259816b
commit 4388474cdc
16 changed files with 309 additions and 264 deletions
+6 -4
View File
@@ -6,13 +6,15 @@ import (
"github.com/restic/restic"
)
type CmdCache struct{}
type CmdCache struct {
global *GlobalOptions
}
func init() {
_, err := parser.AddCommand("cache",
"manage cache",
"The cache command creates and manages the local cache",
&CmdCache{})
&CmdCache{global: &globalOpts})
if err != nil {
panic(err)
}
@@ -27,12 +29,12 @@ func (cmd CmdCache) Execute(args []string) error {
// return fmt.Errorf("wrong number of parameters, Usage: %s", cmd.Usage())
// }
s, err := OpenRepo()
s, err := cmd.global.OpenRepository()
if err != nil {
return err
}
cache, err := restic.NewCache(s, mainOpts.CacheDir)
cache, err := restic.NewCache(s, cmd.global.CacheDir)
if err != nil {
return err
}