<commit_before>package main

import (
	"fmt"
	"runtime"
	"runtime/debug"
	"strings"

	"github.com/anaminus/cobra"
	"github.com/anaminus/pflag"
)

func init() {
	var c VersionCommand
	var cmd = &cobra.Command{
		Use: "version",
		Run: c.Run,
	}
	c.SetFlags(cmd.PersistentFlags())
	Program.AddCommand(cmd)
}

func VersionString() string {
	s := Version
	if Prerelease != "" {
		s += "-" + Prerelease
	}
	if Build != "" {
		s += "+" + Build
	}
	return s
}

func writeModuleString(s *strings.Builder, mod debug.Module, prefix string) {
	s.WriteString("\t")
	s.WriteString(prefix)
	s.WriteString("\t")
	s.WriteString(mod.Path)
	if mod.Version != "" {
		s.WriteString("\t")
		s.WriteString(mod.Version)
	}
	if mod.Sum != "" {
		s.WriteString("\t")
		s.WriteString(mod.Sum)
	}
	s.WriteString("\n")
	if mod.Replace != nil {
		writeModuleString(s, *mod.Replace, "=>")
	}
}

func DetailedInfoString() string {
	var s strings.Builder
	fmt.Fprintf(&s, "rbxmk version: %s\n", Version)
	if Prerelease != "" {
		fmt.Fprintf(&s, "rbxmk prerelease: %s\n", Prerelease)
	}
	if Build != "" {
		fmt.Fprintf(&s, "rbxmk build: %s\n", Build)
	}
	if sslKeyLogFileEnvVar != "" {
		fmt.Fprintf(&s, "ssl log var: %s\n", sslKeyLogFileEnvVar)
	}
	fmt.Fprintf(&s, "go version: %s\n", runtime.Version())
	fmt.Fprintf(&s, "go compiler: %s\n", runtime.Compiler)
	fmt.Fprintf(&s, "go target: %s/%s\n", runtime.GOOS, runtime.GOARCH)
	if info, ok := debug.ReadBuildInfo(); ok {
		fmt.Fprintf(&s, "package: %s\n", info.Path)
		fmt.Fprintf(&s, "modules:\n")
		writeModuleString(&s, info.Main, "mod")
		for _, dep := range info.Deps {<commit_msg>Use path instead of package as field name.<commit_after>package main

import (
	"fmt"
	"runtime"
	"runtime/debug"
	"strings"

	"github.com/anaminus/cobra"
	"github.com/anaminus/pflag"
)

func init() {
	var c VersionCommand
	var cmd = &cobra.Command{
		Use: "version",
		Run: c.Run,
	}
	c.SetFlags(cmd.PersistentFlags())
	Program.AddCommand(cmd)
}

func VersionString() string {
	s := Version
	if Prerelease != "" {
		s += "-" + Prerelease
	}
	if Build != "" {
		s += "+" + Build
	}
	return s
}

func writeModuleString(s *strings.Builder, mod debug.Module, prefix string) {
	s.WriteString("\t")
	s.WriteString(prefix)
	s.WriteString("\t")
	s.WriteString(mod.Path)
	if mod.Version != "" {
		s.WriteString("\t")
		s.WriteString(mod.Version)
	}
	if mod.Sum != "" {
		s.WriteString("\t")
		s.WriteString(mod.Sum)
	}
	s.WriteString("\n")
	if mod.Replace != nil {
		writeModuleString(s, *mod.Replace, "=>")
	}
}

func DetailedInfoString() string {
	var s strings.Builder
	fmt.Fprintf(&s, "rbxmk version: %s\n", Version)
	if Prerelease != "" {
		fmt.Fprintf(&s, "rbxmk prerelease: %s\n", Prerelease)
	}
	if Build != "" {
		fmt.Fprintf(&s, "rbxmk build: %s\n", Build)
	}
	if sslKeyLogFileEnvVar != "" {
		fmt.Fprintf(&s, "ssl log var: %s\n", sslKeyLogFileEnvVar)
	}
	fmt.Fprintf(&s, "go version: %s\n", runtime.Version())
	fmt.Fprintf(&s, "go compiler: %s\n", runtime.Compiler)
	fmt.Fprintf(&s, "go target: %s/%s\n", runtime.GOOS, runtime.GOARCH)
	if info, ok := debug.ReadBuildInfo(); ok {
		fmt.Fprintf(&s, "path: %s\n", info.Path)
		fmt.Fprintf(&s, "modules:\n")
		writeModuleString(&s, info.Main, "mod")
		for _, dep := range info.Deps {
{'fraction_non_alphanumeric': 0.19302038295243978, 'fraction_numerical': 0.0, 'mean_word_length': 3.9001512859304084, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2444818', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1311, 'n_words': 267}