<commit_before>package main

import (
	"fmt"
)

type Handler func (command string, args ...string) error

type Runner struct {
	Handlers map[string] Handler
	Aliases  map[string] string
}

func NewRunner() *Runner {
	return &Runner{
		Handlers: make(map[string] Handler),
		Aliases:  make(map[string] string),
	}
}

func (r *Runner) Dispatch(command string, fn Handler, aliases ...string) {
	r.Handlers[command] = fn
	for _, alias := range aliases {
		r.Aliases[alias] = command
	}
}

func (r *Runner) Execute(args ...string) error {
	if len(args) < 1 {
		return nil
	}
	command, args := args[0], args[1:]
	if fn, ok := r.Handlers[command]; ok {
		return fn(command, args...)
	}

	if alias, ok := r.Aliases[command]; ok {
		if fn, ok := r.Handlers[alias]; ok {
			return fn(command, args...)
		}
	}

	return fmt.Errorf("unknown command '%s'", command)
}

func (r *Runner) Run(args ...string) error {<commit_msg>go fmt ftw<commit_after>package main

import (
	"fmt"
)

type Handler func(command string, args ...string) error

type Runner struct {
	Handlers map[string]Handler
	Aliases  map[string]string
}

func NewRunner() *Runner {
	return &Runner{
		Handlers: make(map[string]Handler),
		Aliases:  make(map[string]string),
	}
}

func (r *Runner) Dispatch(command string, fn Handler, aliases ...string) {
	r.Handlers[command] = fn
	for _, alias := range aliases {
		r.Aliases[alias] = command
	}
}

func (r *Runner) Execute(args ...string) error {
	if len(args) < 1 {
		return nil
	}
	command, args := args[0], args[1:]
	if fn, ok := r.Handlers[command]; ok {
		return fn(command, args...)
	}

	if alias, ok := r.Aliases[command]; ok {
		if fn, ok := r.Handlers[alias]; ok {
			return fn(command, args...)
		}
	}

	return fmt.Errorf("unknown command '%s'", command)
}

func (r *Runner) Run(args ...string) error {
{'fraction_non_alphanumeric': 0.15986769570011025, 'fraction_numerical': 0.0033076074972436605, 'mean_word_length': 3.7020725388601035, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6828761', 'n_tokens_mistral': 686, 'n_tokens_neox': 655, 'n_words': 189}