<commit_before>package main

import (
	"flag"
	"log"
	_ "net/http/pprof"
	"os"
	"path/filepath"
	"runtime"
	"time"

	"github.com/StackExchange/bosun/_third_party/github.com/StackExchange/scollector/collect"
	"github.com/StackExchange/bosun/_third_party/github.com/howeyc/fsnotify"
	"github.com/StackExchange/bosun/conf"
	"github.com/StackExchange/bosun/sched"
	"github.com/StackExchange/bosun/web"
)

var (
	confFile = flag.String("c", "dev.conf", "config file location")
	test     = flag.Bool("t", false, "Only validate config then exit")
	watch    = flag.Bool("w", false, "watch current directory and exit on changes; for use with an autorestarter")
)

func main() {
	flag.Parse()
	runtime.GOMAXPROCS(runtime.NumCPU())
	c, err := conf.ParseFile(*confFile)
	if err != nil {
		log.Fatal(err)
	}
	if *test {
		log.Println("Valid Config")
		os.Exit(0)
	}
	if err := collect.Init(c.RelayListen, "bosun"); err != nil {
		log.Fatal(err)
	}
	sched.Load(c)
	go func() { log.Fatal(web.Listen(c.HttpListen, c.WebDir, c.TsdbHost, c.RelayListen)) }()
	go func() { log.Fatal(sched.Run()) }()
	go watcher()
	select {}
}

func watcher() {
	if !*watch {
		return
	}
	time.Sleep(time.Second)
	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		log.Print(err)
		return
	}
	go func() {
		for {
			select {
			case ev := <-watcher.Event:
				log.Print("file changed, exiting:", ev)
				os.Exit(0)
			case err := <-watcher.Error:
				log.Print(err)
			}
		}
	}()
	filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
		if !info.IsDir() || (len(path) > 1 && path[0] == '.') {
			return nil
		}
		watcher.Watch(path)
		return nil
	})
}
<commit_msg>Rename flag vars<commit_after>package main

import (
	"flag"
	"log"
	_ "net/http/pprof"
	"os"
	"path/filepath"
	"runtime"
	"time"

	"github.com/StackExchange/bosun/_third_party/github.com/StackExchange/scollector/collect"
	"github.com/StackExchange/bosun/_third_party/github.com/howeyc/fsnotify"
	"github.com/StackExchange/bosun/conf"
	"github.com/StackExchange/bosun/sched"
	"github.com/StackExchange/bosun/web"
)

var (
	flagConf  = flag.String("c", "dev.conf", "config file location")
	flagTest  = flag.Bool("t", false, "Only validate config then exit")
	flagWatch = flag.Bool("w", false, "watch current directory and exit on changes; for use with an autorestarter")
)

func main() {
	flag.Parse()
	runtime.GOMAXPROCS(runtime.NumCPU())
	c, err := conf.ParseFile(*flagConf)
	if err != nil {
		log.Fatal(err)
	}
	if *flagTest {
		log.Println("Valid Config")
		os.Exit(0)
	}
	if err := collect.Init(c.RelayListen, "bosun"); err != nil {
		log.Fatal(err)
	}
	sched.Load(c)
	go func() { log.Fatal(web.Listen(c.HttpListen, c.WebDir, c.TsdbHost, c.RelayListen)) }()
	go func() { log.Fatal(sched.Run()) }()
	go watcher()
	select {}
}

func watcher() {
	if !*flagWatch {
		return
	}
	time.Sleep(time.Second)
	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		log.Print(err)
		return
	}
	go func() {
		for {
			select {
			case ev := <-watcher.Event:
				log.Print("file changed, exiting:", ev)
				os.Exit(0)
			case err := <-watcher.Error:
				log.Print(err)
			}
		}
	}()
	filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
		if !info.IsDir() || (len(path) > 1 && path[0] == '.') {
			return nil
		}
		watcher.Watch(path)
		return nil
	})
}

{'fraction_non_alphanumeric': 0.1746987951807229, 'fraction_numerical': 0.0024096385542168677, 'mean_word_length': 3.690677966101695, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1227161', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1313, 'n_words': 260}