<commit_before>package utils

import (
	"fmt"

	"github.com/elves/elvish/newedit/types"
)

// ActionError is like HandlerAction with an Error method. It is useful as a
// control flow exception to exit early from a handler.
type ActionError types.HandlerAction

var actionNames = [...]string{
	"no-action", "commit-code",
}

func (ae ActionError) Error() string {
	if ae < 0 || int(ae) >= len(actionNames) {
		return fmt.Sprintf("!(BAD ACTION: %d)", ae)
	}
	return actionNames[ae]
}

func (ae ActionError) Repr(int) string {
	return "?(edit:" + ae.Error() + ")"
}

func (ae ActionError) Pprint(string) string {
	return "\033[33;1m" + ae.Error() + "\033[m"
}<commit_msg>newedit/utils: Add godoc to ActionError's methods.<commit_after>package utils

import (
	"fmt"

	"github.com/elves/elvish/newedit/types"
)

// ActionError is like HandlerAction with an Error method. It is useful as a
// control flow exception to exit early from a handler.
type ActionError types.HandlerAction

var actionNames = [...]string{
	"no-action", "commit-code",
}

func (ae ActionError) Error() string {
	if ae < 0 || int(ae) >= len(actionNames) {
		return fmt.Sprintf("!(BAD ACTION: %d)", ae)
	}
	return actionNames[ae]
}

// Repr returns an Elvish representation of ae.
func (ae ActionError) Repr(int) string {
	return "?(edit:" + ae.Error() + ")"
}

// Pprint pretty-prints ae to the terminal.
func (ae ActionError) Pprint(string) string {
	return "\033[33;1m" + ae.Error() + "\033[m"
}
{'fraction_non_alphanumeric': 0.1520109066121336, 'fraction_numerical': 0.013633265167007498, 'mean_word_length': 4.097222222222222, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3803622', 'n_tokens_mistral': 531, 'n_tokens_neox': 512, 'n_words': 156}