<commit_before>package commands

import (
	"os"

	log "github.com/sirupsen/logrus"
	"github.com/spf13/cobra"
)

const (
	APP_NAME = "Talk2Docker"
)

var (
	configPath string
	hostName   string

	boolYAML, boolJSON, boolVerbose, boolDebug bool

	boolAll, boolQuiet, boolNoHeader, boolNoTrunc bool
)

var app = &cobra.Command{
	Use:   "talk2docker",
	Short: "Yet Another Docker Client to talk to Docker daemon",
	Long:  APP_NAME + " - Yet Another Docker Client to talk to Docker daemon",
	Run: func(ctx *cobra.Command, args []string) {
		ctx.Help()
	},
}

func init() {
	app.PersistentFlags().StringVarP(&configPath, "config", "C", "$HOME/.talk2docker/config", "Path to the configuration file")
	app.PersistentFlags().StringVarP(&hostName, "host", "H", "", "Docker hostname to use its config (runtime only)")

	app.PersistentFlags().BoolVarP(&boolYAML, "yaml", "Y", false, "Output in YAML format")
	app.PersistentFlags().BoolVarP(&boolJSON, "json", "J", false, "Output in JSON format")

	app.PersistentFlags().BoolVarP(&boolVerbose, "verbose", "V", false, "Print verbose messages")
	app.PersistentFlags().BoolVarP(&boolDebug, "debug", "D", false, "Print debug messages")

	cobra.OnInitialize(Initialize)
}

func Initialize() {
	log.SetOutput(os.Stderr)
	log.SetLevel(log.WarnLevel)

	if boolVerbose {
		log.SetFormatter(&LogFormatter{})
		log.SetLevel(log.InfoLevel)
	}
	if boolDebug {
		log.SetFormatter(&log.TextFormatter{})
		log.SetLevel(log.DebugLevel)
	}
}

func Execute() {
	app.AddCommand(cmdPs)
	app.AddCommand(cmdIs)
	app.AddCommand(cmdVs)
	app.AddCommand(cmdHosts)

	app.AddCommand(cmdBuild)
	app.AddCommand(cmdCompose)
	app.AddCommand(cmdCommit)
	app.AddCommand(cmdVersion)

	app.AddCommand(cmdContainer)
	app.AddCommand(cmdImage)
	app.AddCommand(cmdVolume)
	app.AddCommand(cmdHost)
	app.AddCommand(cmdRegistry)
	app.AddCommand(cmdConfig)

	app.SetOutput(os.Stdout)
	app.Execute()
}

func ErrorExit(ctx *cobra.Command, message string) {
	log.Error(message)
	ctx.Usage()
	os.Exit(1)
}
<commit_msg>Enable it to set the configuration file path via TALK2DOCKER_CONFIG<commit_after>package commands

import (
	"os"

	log "github.com/sirupsen/logrus"
	"github.com/spf13/cobra"
)

const (
	APP_NAME = "Talk2Docker"
)

var (
	configPath string
	hostName   string

	boolYAML, boolJSON, boolVerbose, boolDebug bool

	boolAll, boolQuiet, boolNoHeader, boolNoTrunc bool
)

var app = &cobra.Command{
	Use:   "talk2docker",
	Short: "Yet Another Docker Client to talk to Docker daemon",
	Long:  APP_NAME + " - Yet Another Docker Client to talk to Docker daemon",
	Run: func(ctx *cobra.Command, args []string) {
		ctx.Help()
	},
}

func init() {
	defaultConfigPath := os.Getenv("TALK2DOCKER_CONFIG")
	if defaultConfigPath == "" {
		defaultConfigPath = "$HOME/.talk2docker/config"
	}

	app.PersistentFlags().StringVarP(&configPath, "config", "C", defaultConfigPath, "Path to the configuration file")
	app.PersistentFlags().StringVarP(&hostName, "host", "H", "", "Docker hostname to use its config (runtime only)")

	app.PersistentFlags().BoolVarP(&boolYAML, "yaml", "Y", false, "Output in YAML format")
	app.PersistentFlags().BoolVarP(&boolJSON, "json", "J", false, "Output in JSON format")

	app.PersistentFlags().BoolVarP(&boolVerbose, "verbose", "V", false, "Print verbose messages")
	app.PersistentFlags().BoolVarP(&boolDebug, "debug", "D", false, "Print debug messages")

	cobra.OnInitialize(Initialize)
}

func Initialize() {
	log.SetOutput(os.Stderr)
	log.SetLevel(log.WarnLevel)

	if boolVerbose {
		log.SetFormatter(&LogFormatter{})
		log.SetLevel(log.InfoLevel)
	}
	if boolDebug {
		log.SetFormatter(&log.TextFormatter{})
		log.SetLevel(log.DebugLevel)
	}
}

func Execute() {
	app.AddCommand(cmdPs)
	app.AddCommand(cmdIs)
	app.AddCommand(cmdVs)
	app.AddCommand(cmdHosts)

	app.AddCommand(cmdBuild)
	app.AddCommand(cmdCompose)
	app.AddCommand(cmdCommit)
	app.AddCommand(cmdVersion)

	app.AddCommand(cmdContainer)
	app.AddCommand(cmdImage)
	app.AddCommand(cmdVolume)
	app.AddCommand(cmdHost)
	app.AddCommand(cmdRegistry)
	app.AddCommand(cmdConfig)

	app.SetOutput(os.Stdout)
	app.Execute()
}

func ErrorExit(ctx *cobra.Command, message string) {
	log.Error(message)
	ctx.Usage()
	os.Exit(1)
}

{'fraction_non_alphanumeric': 0.14067715784453982, 'fraction_numerical': 0.0033381020505484026, 'mean_word_length': 5.443932411674347, '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': '6047044', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1530, 'n_words': 311}