Added folder creation

This commit is contained in:
Jan Christian Grünhage 2017-04-25 23:27:29 +02:00
parent e77d53d327
commit f14a2a729d
Signed by: jcgruenhage
GPG key ID: 321A67D9EE8BC3E1
3 changed files with 31 additions and 0 deletions

View file

@ -33,6 +33,9 @@ func Run(data []byte) {
fmt.Print("\n")
}
}
func (*HostList) TotalPath(index int) string {
}
func check(e error) {
if e != nil {

View file

@ -0,0 +1,25 @@
package folders
import (
"git.jcg.re/jcgruenhage/borgocli/generate/authorized_keys"
"encoding/json"
"os"
"fmt"
)
func Run(data []byte) {
var hosts authorized_keys.HostList
err := json.Unmarshal(data, &hosts)
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)
}
}

View file

@ -4,6 +4,7 @@ import (
"os"
"git.jcg.re/jcgruenhage/borgocli/generate/authorized_keys"
"io/ioutil"
"git.jcg.re/jcgruenhage/borgocli/generate/folders"
)
func main() {
@ -12,6 +13,8 @@ func main() {
switch os.Args[2] {
case "authorized_keys":
authorized_keys.Run(readFile(os.Args[3]))
case "folders":
folders.Run(readFile(os.Args[3]))
}
}
}