<commit_before>package main

import (
	"flag"
	"fmt"
	"os"

	"github.com/scriptnull/badgeit/common"
	"github.com/scriptnull/badgeit/contracts"
	"github.com/scriptnull/badgeit/formatters"
)

func main() {
	// Parse Flags
	fFlag := flag.String("f", "all", "Format for arranging the badges.")
	dFlag := flag.String("d", " ", "Delimiter to be used.")
	flag.Parse()

	// Obtain destination path, if not found, it will be cwd
	args := flag.Args()
	path, err := os.Getwd()
	if len(args) != 0 && len(args[0]) > 0 {
		path = args[0]
	}

	// Check Contract aggreement and obtain eligible badges
	var badges []common.Badge

	npmBadges, err := contracts.NewNpmBadgeContract(path).Badges()
	if err == nil {
		badges = append(badges, npmBadges...)
	}

	// Get Suitable Formatter
	formatter, err := formatters.NewFormatter(
		formatters.FormatterOption{
			Badges:    badges,
			Delimiter: *dFlag,
			Type:      *fFlag,
		},
	)
	if err != nil {
		fmt.Fprint(os.Stderr, "Invalid -f option.")
	}

	result := formatter.Format()
	fmt.Fprintf(os.Stdout, "%s\n", result)
	os.Exit(0)
}
<commit_msg>adds version flag<commit_after>package main

import (
	"flag"
	"fmt"
	"os"

	"github.com/scriptnull/badgeit/common"
	"github.com/scriptnull/badgeit/contracts"
	"github.com/scriptnull/badgeit/formatters"
)

const VERSION = "0.1.0"

func main() {
	// Parse Flags
	fFlag := flag.String("f", "all", "Format for arranging the badges.")
	dFlag := flag.String("d", " ", "Delimiter to be used.")
	vFlag := flag.Bool("v", false, "Version information.")
	flag.Parse()

	if *vFlag {
		fmt.Println("badgeit version: " + VERSION)
		os.Exit(0)
	}
	// Obtain destination path, if not found, it will be cwd
	args := flag.Args()
	path, err := os.Getwd()
	if len(args) != 0 && len(args[0]) > 0 {
		path = args[0]
	}

	// Check Contract aggreement and obtain eligible badges
	var badges []common.Badge

	npmBadges, err := contracts.NewNpmBadgeContract(path).Badges()
	if err == nil {
		badges = append(badges, npmBadges...)
	}

	// Get Suitable Formatter
	formatter, err := formatters.NewFormatter(
		formatters.FormatterOption{
			Badges:    badges,
			Delimiter: *dFlag,
			Type:      *fFlag,
		},
	)
	if err != nil {
		fmt.Fprint(os.Stderr, "Invalid -f option.")
	}

	result := formatter.Format()
	fmt.Fprintf(os.Stdout, "%s\n", result)
	os.Exit(0)
}

{'fraction_non_alphanumeric': 0.16270012981393336, 'fraction_numerical': 0.006057983556901774, 'mean_word_length': 3.5782178217821783, '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': '4161264', 'n_tokens_mistral': 925, 'n_tokens_neox': 882, 'n_words': 206}