<commit_before>package cli

import "fmt"
import "strings"

type paramable struct {
	*writer
	params       paramsList
	paramValues  map[string]Value
	paramsParsed bool
}

// Arg returns the i'th argument.  Arg(0) is the first remaining argument
// after flags have been processed.
func (cmd *paramable) Param(key string) Value {
	value, ok := cmd.paramValues[key]
	if ok {
		return value
	}
	var emptyString stringValue
	emptyString = ""
	return &emptyString
}

// Args returns the non-flag arguments.
func (cmd *paramable) Params() map[string]Value {
	return cmd.paramValues
}

// UsageString returns the params usage as a string
func (cmd *paramable) UsageString() string {
	var formattednames []string
	for i := 0; i < len(cmd.params); i++ {
		param := cmd.params[i]
		formattednames = append(formattednames, fmt.Sprintf("<%s>", param.Name))<commit_msg>raise an error if an invalid param is requested<commit_after>package cli

import "fmt"
import "strings"

type paramable struct {
	*writer
	params       paramsList
	paramValues  map[string]Value
	paramsParsed bool
}

// Param returns named param
func (cmd *paramable) Param(key string) Value {
	value, ok := cmd.paramValues[key]
	if !ok {
		cmd.errf("invalid param: %s", key)
	}
	return value
}

// Args returns the non-flag arguments.
func (cmd *paramable) Params() map[string]Value {
	return cmd.paramValues
}

// UsageString returns the params usage as a string
func (cmd *paramable) UsageString() string {
	var formattednames []string
	for i := 0; i < len(cmd.params); i++ {
		param := cmd.params[i]
		formattednames = append(formattednames, fmt.Sprintf("<%s>", param.Name))
{'fraction_non_alphanumeric': 0.11397058823529412, 'fraction_numerical': 0.001838235294117647, 'mean_word_length': 4.3019480519480515, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6499718', 'n_tokens_mistral': 532, 'n_tokens_neox': 522, 'n_words': 175}