<commit_before>package main

import "os"
import "fmt"
import "time"

import "github.com/prataprc/golog"
import "github.com/tn47/goledger/dblentry"
import "github.com/tn47/goledger/reports"
import "github.com/tn47/goledger/api"

var _ = fmt.Sprintf("dummy")

func main() {
	args := phase1()
	reporter, db := phase2(args)
	nreporter, ndb := phase3(args, reporter, db)
	if nreporter != nil {
		nreporter.Render(args, ndb)
	}
}

func trycommand(args []string, phase string) bool {
	if len(args) == 0 {
		return false
	}
	switch phase {
	case "phase1":
		switch args[0] {
		case "version", "ver":
			log.Consolef("goledger version - goledger%v\n", api.LedgerVersion)
			return true
		}

	case "phase2":
	case "phase3":
	}
	return false
}

// 1. arguments are parsed.
// 2. log is initialized.
func phase1() (args []string) {
	defer func() {
		if trycommand(args, "phase1") {
			os.Exit(0)
		}
	}()

	var err error

	if args, err = argparse(); err != nil {
		os.Exit(1)
	}

	logsetts := map[string]interface{}{
		"log.level":      api.Options.Loglevel,
		"log.file":       "",
		"log.timeformat": "",
		"log.prefix":     "%v:",
	}
	log.SetLogger(nil, logsetts)

	return args
}

// 1. create one or more reporter
// 2. create a datastore.
// 3. firstpass on all journal files on the datastore.
// 4. firstpass completed
func phase2(args []string) (api.Reporter, api.Datastorer) {
	defer func() {<commit_msg>again update the prefix format for log-level.<commit_after>package main

import "os"
import "fmt"
import "time"

import "github.com/prataprc/golog"
import "github.com/tn47/goledger/dblentry"
import "github.com/tn47/goledger/reports"
import "github.com/tn47/goledger/api"

var _ = fmt.Sprintf("dummy")

func main() {
	args := phase1()
	reporter, db := phase2(args)
	nreporter, ndb := phase3(args, reporter, db)
	if nreporter != nil {
		nreporter.Render(args, ndb)
	}
}

func trycommand(args []string, phase string) bool {
	if len(args) == 0 {
		return false
	}
	switch phase {
	case "phase1":
		switch args[0] {
		case "version", "ver":
			log.Consolef("goledger version - goledger%v\n", api.LedgerVersion)
			return true
		}

	case "phase2":
	case "phase3":
	}
	return false
}

// 1. arguments are parsed.
// 2. log is initialized.
func phase1() (args []string) {
	defer func() {
		if trycommand(args, "phase1") {
			os.Exit(0)
		}
	}()

	var err error

	if args, err = argparse(); err != nil {
		os.Exit(1)
	}

	logsetts := map[string]interface{}{
		"log.level":      api.Options.Loglevel,
		"log.file":       "",
		"log.timeformat": "",
		"log.prefix":     "[%v]",
	}
	log.SetLogger(nil, logsetts)

	return args
}

// 1. create one or more reporter
// 2. create a datastore.
// 3. firstpass on all journal files on the datastore.
// 4. firstpass completed
func phase2(args []string) (api.Reporter, api.Datastorer) {
	defer func() {
{'fraction_non_alphanumeric': 0.15848923402753265, 'fraction_numerical': 0.017649135192375574, 'mean_word_length': 3.4489795918367347, 'pattern_counts': {'":': 16, '<': 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': '2412362', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1078, 'n_words': 278}