<commit_before>package main

import (
	"fmt"
	"deltareport/config"
	"deltareport/model"
	"deltareport/diff"
	"deltareport/queue"
	"flag"
)

func main() {
	configPath := ""
	flag.BoolVar(&config.Verbose, "v", false, "Verbose-mode (log more)")
	flag.StringVar(&configPath, "c", "./config.json", "Path to config.json")
	flag.Parse()

	if e := config.Init(configPath); e != nil {
		panic(e)
	}
	// TODO: Handle toggling recurse true/false
	for path, meta := range config.C.Files {
		pos, e := model.Pos(path)
		if e != nil {
			panic(e)
		}

		lookup := make(map[string]diff.Res)
		if meta.Recurse {
			lookup, e = diff.Recurse(path, pos, meta.IncludeExt)
		} else {
			lookup[path], e = diff.File(path, pos[path])
		}
		if e != nil {
			panic(e)
		}

		// show diff
		fmt.Printf("%+v\n", lookup)<commit_msg>Bugfix. Closing DB<commit_after>package main

import (
	"fmt"
	"deltareport/config"
	"deltareport/model"
	"deltareport/diff"
	"deltareport/queue"
	"flag"
)

func main() {
	configPath := ""
	flag.BoolVar(&config.Verbose, "v", false, "Verbose-mode (log more)")
	flag.StringVar(&configPath, "c", "./config.json", "Path to config.json")
	flag.Parse()

	if e := config.Init(configPath); e != nil {
		panic(e)
	}
	defer config.Close()

	// TODO: Handle toggling recurse true/false
	for path, meta := range config.C.Files {
		pos, e := model.Pos(path)
		if e != nil {
			panic(e)
		}

		lookup := make(map[string]diff.Res)
		if meta.Recurse {
			lookup, e = diff.Recurse(path, pos, meta.IncludeExt)
		} else {
			lookup[path], e = diff.File(path, pos[path])
		}
		if e != nil {
			panic(e)
		}

		// show diff
		fmt.Printf("%+v\n", lookup)
{'fraction_non_alphanumeric': 0.1784841075794621, 'fraction_numerical': 0.0, 'mean_word_length': 3.4363143631436315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7596794', 'n_tokens_mistral': 705, 'n_tokens_neox': 655, 'n_words': 143}