borgocli/generate/folders/create_repo_folders.go

25 lines
445 B
Go
Raw Normal View History

2017-04-25 21:27:29 +00:00
package folders
import (
"git.jcg.re/jcgruenhage/borgocli/generate/authorized_keys"
"gopkg.in/yaml.v2"
2017-04-25 21:27:29 +00:00
"os"
"fmt"
)
func Run(data []byte) {
var hosts authorized_keys.HostList
err := yaml.Unmarshal(data, &hosts)
2017-04-25 21:27:29 +00:00
check(err)
fmt.Println("Backup Paths:")
for i := 0; i < len(hosts.Hosts); i++ {
os.MkdirAll(hosts.TotalPath(i), os.ModePerm)
fmt.Print(" " + hosts.TotalPath(i))
}
}
func check(e error) {
if e != nil {
panic(e)
}
}