This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
2016-10-13 19:58:32 +00:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// +build !plan9
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2016-10-13 21:36:42 +00:00
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
config *Config
|
|
|
|
flConfig = flag.String("config", filepath.Join(os.Getenv("HOME"), ".SyncRefs.conf"), "configuration file path")
|
|
|
|
)
|
2016-10-13 19:58:32 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.Parse()
|
2016-10-13 21:36:42 +00:00
|
|
|
fh, err := os.Open(*flConfig)
|
|
|
|
if err != nil && !os.IsNotExist(err) {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
if fh != nil {
|
|
|
|
config, err = ReadConfig(fh)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
2016-10-13 19:58:32 +00:00
|
|
|
|
2016-10-13 21:36:42 +00:00
|
|
|
// Build relationships of each group
|
|
|
|
// there needs to be a quit chan to hand off to each watcher and group
|
2016-10-13 19:58:32 +00:00
|
|
|
for _, arg := range flag.Args() {
|
2016-10-13 21:29:34 +00:00
|
|
|
WatchPath(arg)
|
2016-10-13 19:58:32 +00:00
|
|
|
}
|
|
|
|
}
|