<commit_before>package main

import (
	"errors"
	"flag"
	"fmt"
	"github.com/fatih/color"
	"github.com/probandula/figlet4go"
	"log"
	"strings"
)

var (
	str      *string = flag.String("str", "", "String to be converted with FIGlet")
	font     *string = flag.String("font", "", "Font name to use")
	fontpath *string = flag.String("fontpath", "", "Font path to load fonts from")
	colors   *string = flag.String("colors", "", "Character colors seperated by ';'\n\tPossible colors: black, red, green, yellow, blue, magenta, cyan, white")
)

func main() {
	// Parse the flags
	flag.Parse()

	// Validate and log the error
	err := validate()
	if err != nil {
		log.Fatal(err)
	}

	// Create objects
	ascii := figlet4go.NewAsciiRender()
	options := figlet4go.NewRenderOptions()

	// Load fonts
	if *fontpath != "" {
		ascii.LoadFont(*fontpath)
	}

	// Set the font
	options.FontName = *font

	// Set colors
	if *colors != "" {
		options.FontColor = getColorSlice(*colors)
	}

	// Render the string
	renderStr, err := ascii.RenderOpts(*str, options)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(renderStr)
}

// Get a slice with colors to give to the RenderOptions
// Splits the given string with the seperator ";"
func getColorSlice(colorStr string) []color.Attribute {

	givenColors := strings.Split(colorStr, ";")

	colors := make([]color.Attribute, len(givenColors))

	for i, c := range givenColors {
		switch c {
		case "black":
			colors[i] = color.FgBlack
		case "red":
			colors[i] = color.FgRed
		case "green":
			colors[i] = color.FgGreen
		case "yellow":
			colors[i] = color.FgYellow
		case "blue":
			colors[i] = color.FgBlue
		case "magenta":
			colors[i] = color.FgMagenta
		case "cyan":
			colors[i] = color.FgCyan
		case "white":
			colors[i] = color.FgWhite
		}
	}
<commit_msg>no newline at the end<commit_after>package main

import (
	"errors"
	"flag"
	"fmt"
	"github.com/fatih/color"
	"github.com/probandula/figlet4go"
	"log"
	"strings"
)

var (
	str      *string = flag.String("str", "", "String to be converted with FIGlet")
	font     *string = flag.String("font", "", "Font name to use")
	fontpath *string = flag.String("fontpath", "", "Font path to load fonts from")
	colors   *string = flag.String("colors", "", "Character colors seperated by ';'\n\tPossible colors: black, red, green, yellow, blue, magenta, cyan, white")
)

func main() {
	// Parse the flags
	flag.Parse()

	// Validate and log the error
	err := validate()
	if err != nil {
		log.Fatal(err)
	}

	// Create objects
	ascii := figlet4go.NewAsciiRender()
	options := figlet4go.NewRenderOptions()

	// Load fonts
	if *fontpath != "" {
		ascii.LoadFont(*fontpath)
	}

	// Set the font
	options.FontName = *font

	// Set colors
	if *colors != "" {
		options.FontColor = getColorSlice(*colors)
	}

	// Render the string
	renderStr, err := ascii.RenderOpts(*str, options)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Print(renderStr)
}

// Get a slice with colors to give to the RenderOptions
// Splits the given string with the seperator ";"
func getColorSlice(colorStr string) []color.Attribute {

	givenColors := strings.Split(colorStr, ";")

	colors := make([]color.Attribute, len(givenColors))

	for i, c := range givenColors {
		switch c {
		case "black":
			colors[i] = color.FgBlack
		case "red":
			colors[i] = color.FgRed
		case "green":
			colors[i] = color.FgGreen
		case "yellow":
			colors[i] = color.FgYellow
		case "blue":
			colors[i] = color.FgBlue
		case "magenta":
			colors[i] = color.FgMagenta
		case "cyan":
			colors[i] = color.FgCyan
		case "white":
			colors[i] = color.FgWhite
		}
	}

{'fraction_non_alphanumeric': 0.1520891364902507, 'fraction_numerical': 0.001671309192200557, 'mean_word_length': 3.516981132075472, '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': '2820032', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1300, 'n_words': 342}