diff options
| author | Laria Carolin Chabowski <laria@laria.me> | 2017-09-14 07:42:50 +0200 | 
|---|---|---|
| committer | Laria Carolin Chabowski <laria@laria.me> | 2017-09-26 21:35:41 +0200 | 
| commit | b2742dc28d1ff9001cd784455bbdf9cf29539c30 (patch) | |
| tree | 2cac9dff572edbfc05588c33cce76a3dbb406d15 /write_dir.go | |
| parent | 9ddda1c317dbeaab1380e46ebf48eba9566a90e2 (diff) | |
| download | petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.gz petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.bz2 petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.zip | |
Implement remaining subcommands
Diffstat (limited to 'write_dir.go')
| -rw-r--r-- | write_dir.go | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/write_dir.go b/write_dir.go index e701a56..34abcd1 100644 --- a/write_dir.go +++ b/write_dir.go @@ -22,6 +22,7 @@ func abspath(p string) (string, error) {  func WriteDir(args []string) int {  	usage := subcmdUsage("write-dir", "directory", nil) +	errout := subcmdErrout("write-dir")  	if len(args) != 1 {  		usage() @@ -30,24 +31,24 @@ func WriteDir(args []string) int {  	dir_path, err := abspath(args[0])  	if err != nil { -		fmt.Fprintf(os.Stderr, "write-dir: %s\n", err) +		errout(err)  		return 1  	}  	d, err := fs.OpenOSFile(dir_path)  	if err != nil { -		fmt.Fprintf(os.Stderr, "write-dir: %s\n", err) +		errout(err)  		return 1  	}  	if d.Type() != fs.FDir { -		fmt.Fprintf(os.Stderr, "write-dir: %s is not a directory\n", dir_path) +		errout(fmt.Errorf("%s is not a directory\n", dir_path))  		return 1  	}  	id, err := backup.WriteDir(objectstore, dir_path, d, cache.NopCache{})  	if err != nil { -		fmt.Fprintf(os.Stderr, "write-dir: %s\n", err) +		errout(err)  		return 1  	} | 
