28 lines
448 B
Go
28 lines
448 B
Go
package run
|
|
|
|
import (
|
|
"gopkg.in/yaml.v2"
|
|
"git.jcg.re/jcgruenhage/borgocli/run/prune"
|
|
"git.jcg.re/jcgruenhage/borgocli/run/create"
|
|
"git.jcg.re/jcgruenhage/borgocli/run/config"
|
|
)
|
|
|
|
func Run(command string, data []byte) {
|
|
var config config.Config
|
|
err := yaml.Unmarshal(data, &config)
|
|
check(err)
|
|
switch command {
|
|
case "create":
|
|
create.Run(config)
|
|
case "prune":
|
|
prune.Run(config)
|
|
}
|
|
|
|
}
|
|
|
|
func check(e error) {
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
}
|