Work in progress

This commit is contained in:
Alex Yatskov 2015-03-31 20:59:09 +09:00
parent 6aaf319a85
commit 66a8182942
2 changed files with 31 additions and 25 deletions

View File

@ -13,30 +13,30 @@ force = false
src = ".gitconfig"
[profs.base]
[[profs.dev.links]]
[[profs.base.links]]
src = ".config/fish"
[[profs.dev.links]]
[[profs.base.links]]
src = ".config/keepassx"
[[profs.dev.links]]
[[profs.base.links]]
src = ".filezilla"
[[profs.dev.links]]
[[profs.base.links]]
src = "profsile"
[profs.study]
[[profs.dev.links]]
[[profs.study.links]]
src = "Anki"
[[profs.dev.links]]
[[profs.study.links]]
src = ".yomichan.json"
[profs.net]
[[profs.dev.links]]
[[profs.net.links]]
src = ".filezilla"
[[profs.dev.links]]
[[profs.net.links]]
src = ".s3cfg"
[profs.flatline]
@ -44,11 +44,11 @@ force = false
stomp = true
force = true
[[profs.dev.links]]
[[profs.flatline.links]]
src = ".ssh_flatline"
dst = ".ssh"
[[profs.dev.links]]
[[profs.flatline.links]]
src = ".config/syncthing_flatline"
dst = ".config/syncthing"
@ -57,6 +57,6 @@ force = false
stomp = true
force = true
[[profs.dev.links]]
[[profs.wintermute.links]]
src = ".ssh_wintermute"
dst = ".ssh"

34
main.go
View File

@ -26,7 +26,6 @@ import (
"github.com/naoina/toml"
"io/ioutil"
"log"
"os"
)
type link struct {
@ -49,22 +48,29 @@ type config struct {
Stomp bool
}
func parse(filename string) (*config, error) {
bytes, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
conf := &config{}
if err := toml.Unmarshal(bytes, &conf); err != nil {
return nil, err
}
return conf, nil
}
func process(src, dst string) error {
return nil
}
func main() {
f, err := os.Open("config.toml")
if err != nil {
log.Fatal(err)
}
defer f.Close()
buff, err := ioutil.ReadAll(f)
conf, err := parse("config.toml")
if err != nil {
log.Fatal(err)
}
var conf config
if err := toml.Unmarshal(buff, &conf); err != nil {
log.Fatal(err)
}
log.Print(conf.Profs["dev"])
log.Print(conf)
}