aboutsummaryrefslogtreecommitdiff
path: root/restore_dir.go
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2017-09-14 07:42:50 +0200
committerLaria Carolin Chabowski <laria@laria.me>2017-09-26 21:35:41 +0200
commitb2742dc28d1ff9001cd784455bbdf9cf29539c30 (patch)
tree2cac9dff572edbfc05588c33cce76a3dbb406d15 /restore_dir.go
parent9ddda1c317dbeaab1380e46ebf48eba9566a90e2 (diff)
downloadpetrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.gz
petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.bz2
petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.zip
Implement remaining subcommands
Diffstat (limited to 'restore_dir.go')
-rw-r--r--restore_dir.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/restore_dir.go b/restore_dir.go
index 65f2785..2961b70 100644
--- a/restore_dir.go
+++ b/restore_dir.go
@@ -5,11 +5,11 @@ import (
"code.laria.me/petrific/fs"
"code.laria.me/petrific/objects"
"fmt"
- "os"
)
func RestoreDir(args []string) int {
usage := subcmdUsage("restore-dir", "directory object-id", nil)
+ errout := subcmdErrout("restore-dir")
if len(args) != 2 {
usage()
@@ -18,29 +18,29 @@ func RestoreDir(args []string) int {
dir_path, err := abspath(args[0])
if err != nil {
- fmt.Fprintf(os.Stderr, "restore-dir: %s\n", err)
+ errout(err)
return 1
}
d, err := fs.OpenOSFile(dir_path)
if err != nil {
- fmt.Fprintf(os.Stderr, "restore-dir: %s\n", err)
+ errout(err)
return 1
}
if d.Type() != fs.FDir {
- fmt.Fprintf(os.Stderr, "restore-dir: %s is not a directory\n", dir_path)
+ errout(fmt.Errorf("%s is not a directory", dir_path))
return 1
}
id, err := objects.ParseObjectId(args[1])
if err != nil {
- fmt.Fprintf(os.Stderr, "restore-dir: %s\n", err)
+ errout(err)
return 1
}
if err := backup.RestoreDir(objectstore, id, d); err != nil {
- fmt.Fprintf(os.Stderr, "restore-dir: %s\n", err)
+ errout(err)
return 1
}