40 lines
759 B
Go
40 lines
759 B
Go
// 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
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
var (
|
|
config *Config
|
|
flConfig = flag.String("config", filepath.Join(os.Getenv("HOME"), ".SyncRefs.conf"), "configuration file path")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
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)
|
|
}
|
|
}
|
|
|
|
// Build relationships of each group
|
|
// there needs to be a quit chan to hand off to each watcher and group
|
|
for _, arg := range flag.Args() {
|
|
WatchPath(arg)
|
|
}
|
|
}
|