<commit_before>package main

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
)

func action(ctx *cli.Context) error {
	config, errors := makeConfig(ctx)
	if errors != nil {
		for _, err := range errors {
			fmt.Fprintf(os.Stderr, err.Error()+"\n")
		}
		fmt.Fprintf(os.Stderr, "\n")
		cli.ShowAppHelp(ctx)
	} else {
		dependency, errors := gatherDependency(config)
		output(config, dependency, errors)
	}
	return nil
}

func output(config *Config, dependency *Dependency, errors []error) {
	for _, err := range errors {
		fmt.Fprintf(os.Stderr, err.Error()+"\n")
	}
	switch config.Format {
	case "dot":
		outputDot(config.Output, dependency)<commit_msg>update action.go: improve error formatting<commit_after>package main

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
)

func action(ctx *cli.Context) error {
	config, errors := makeConfig(ctx)
	if errors != nil {
		hasErr := false
		for _, err := range errors {
			if err.Error() != "" {
				fmt.Fprintf(os.Stderr, err.Error()+"\n")
				hasErr = true
			}
		}
		if hasErr {
			fmt.Fprintf(os.Stderr, "\n")
		}
		cli.ShowAppHelp(ctx)
	} else {
		dependency, errors := gatherDependency(config)
		output(config, dependency, errors)
	}
	return nil
}

func output(config *Config, dependency *Dependency, errors []error) {
	for _, err := range errors {
		fmt.Fprintf(os.Stderr, err.Error()+"\n")
	}
	switch config.Format {
	case "dot":
		outputDot(config.Output, dependency)
{'fraction_non_alphanumeric': 0.15502793296089384, 'fraction_numerical': 0.0, 'mean_word_length': 3.8907849829351537, 'pattern_counts': {'":': 2, '<': 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': '1906632', 'n_tokens_mistral': 551, 'n_tokens_neox': 512, 'n_words': 117}