<commit_before>/*
Copyright 2019 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package console

import (
	"fmt"
	"strings"

	"golang.org/x/text/message"
)

var (
	defaultLowPrefix       = "-   "
	defautlLowIndentPrefix = "    - "
)

// style describes how to stylize a message.
type style struct {
	// Prefix is a string to place in the beginning of a message
	Prefix string
	// LowPrefix is the 7-bit compatible prefix we fallback to for less-awesome terminals
	LowPrefix string
	// OmitNewline omits a newline at the end of a message.
	OmitNewline bool
}

// styles is a map of style name to style struct
// For consistency, ensure that emojis added render with the same width across platforms.
var styles = map[string]style{
	"happy":        {Prefix: "😄  ", LowPrefix: "o   "},
	"success":      {Prefix: "✅  "},
	"failure":      {Prefix: "❌  ", LowPrefix: "X   "},
	"conflict":     {Prefix: "💥  ", LowPrefix: "x   "},
	"fatal":        {Prefix: "💣  ", LowPrefix: "!   "},
	"notice":       {Prefix: "📌  ", LowPrefix: "*   "},
	"ready":        {Prefix: "🏄  ", LowPrefix: "=   "},
	"running":      {Prefix: "🏃  ", LowPrefix: ":   "},
	"provisioning": {Prefix: "🌱  ", LowPrefix: ">   "},
	"restarting":   {Prefix: "🔄  ", LowPrefix: ":   "},
	"stopping":     {Prefix: "✋  ", LowPrefix: ":   "},
	"stopped":      {Prefix: "🛑  "},
	"warning":      {Prefix: "⚠️  ", LowPrefix: "!   "},
	"waiting":      {Prefix: "⌛  ", LowPrefix: ":   "},
	"usage":        {Prefix: "💡  "},
	"launch":       {Prefix: "🚀  "},
	"sad":          {Prefix: "😿  ", LowPrefix: "*   "},
	"thumbs-up":    {Prefix: "👍  "},
	"option":       {Prefix: "    ▪ "}, // Indented bullet
	"log-entry":    {Prefix: "    "},   // Indent
	"crushed":      {Prefix: "💔  "},
	"running":      {Prefix: "🏃  "},
	"provisioning": {Prefix: "🌱  "},
	"url":          {Prefix: "👉  "},

	// Specialized purpose styles
	"iso-download":      {Prefix: "💿  ", LowPrefix: "@   "},
	"file-download":     {Prefix: "💾  ", LowPrefix: "@   "},
	"caching":           {Prefix: "🤹  ", LowPrefix: "$   "},
	"starting-vm":       {Prefix: "🔥  ", LowPrefix: ">   "},
	"starting-none":     {Prefix: "🤹  ", LowPrefix: ">   "},
	"resetting":         {Prefix: "🔄  ", LowPrefix: "#   "},
	"deleting-host":     {Prefix: "🔥  ", LowPrefix: "x   "},
	"copying":           {Prefix: "✨  "},
	"connectivity":      {Prefix: "📶  "},
	"internet":          {Prefix: "🌐  ", LowPrefix: "o   "},
	"mounting":          {Prefix: "📁  "},
	"celebrate":         {Prefix: "🎉  "},
	"container-runtime": {Prefix: "🎁  "},
	"Docker":            {Prefix: "🐳  "},<commit_msg>Remove duplicate keys from merge<commit_after>/*
Copyright 2019 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package console

import (
	"fmt"
	"strings"

	"golang.org/x/text/message"
)

var (
	defaultLowPrefix       = "-   "
	defautlLowIndentPrefix = "    - "
)

// style describes how to stylize a message.
type style struct {
	// Prefix is a string to place in the beginning of a message
	Prefix string
	// LowPrefix is the 7-bit compatible prefix we fallback to for less-awesome terminals
	LowPrefix string
	// OmitNewline omits a newline at the end of a message.
	OmitNewline bool
}

// styles is a map of style name to style struct
// For consistency, ensure that emojis added render with the same width across platforms.
var styles = map[string]style{
	"happy":        {Prefix: "😄  ", LowPrefix: "o   "},
	"success":      {Prefix: "✅  "},
	"failure":      {Prefix: "❌  ", LowPrefix: "X   "},
	"conflict":     {Prefix: "💥  ", LowPrefix: "x   "},
	"fatal":        {Prefix: "💣  ", LowPrefix: "!   "},
	"notice":       {Prefix: "📌  ", LowPrefix: "*   "},
	"ready":        {Prefix: "🏄  ", LowPrefix: "=   "},
	"running":      {Prefix: "🏃  ", LowPrefix: ":   "},
	"provisioning": {Prefix: "🌱  ", LowPrefix: ">   "},
	"restarting":   {Prefix: "🔄  ", LowPrefix: ":   "},
	"stopping":     {Prefix: "✋  ", LowPrefix: ":   "},
	"stopped":      {Prefix: "🛑  "},
	"warning":      {Prefix: "⚠️  ", LowPrefix: "!   "},
	"waiting":      {Prefix: "⌛  ", LowPrefix: ":   "},
	"usage":        {Prefix: "💡  "},
	"launch":       {Prefix: "🚀  "},
	"sad":          {Prefix: "😿  ", LowPrefix: "*   "},
	"thumbs-up":    {Prefix: "👍  "},
	"option":       {Prefix: "    ▪ "}, // Indented bullet
	"log-entry":    {Prefix: "    "},   // Indent
	"crushed":      {Prefix: "💔  "},
	"url":          {Prefix: "👉  "},

	// Specialized purpose styles
	"iso-download":      {Prefix: "💿  ", LowPrefix: "@   "},
	"file-download":     {Prefix: "💾  ", LowPrefix: "@   "},
	"caching":           {Prefix: "🤹  ", LowPrefix: "$   "},
	"starting-vm":       {Prefix: "🔥  ", LowPrefix: ">   "},
	"starting-none":     {Prefix: "🤹  ", LowPrefix: ">   "},
	"resetting":         {Prefix: "🔄  ", LowPrefix: "#   "},
	"deleting-host":     {Prefix: "🔥  ", LowPrefix: "x   "},
	"copying":           {Prefix: "✨  "},
	"connectivity":      {Prefix: "📶  "},
	"internet":          {Prefix: "🌐  ", LowPrefix: "o   "},
	"mounting":          {Prefix: "📁  "},
	"celebrate":         {Prefix: "🎉  "},
	"container-runtime": {Prefix: "🎁  "},
	"Docker":            {Prefix: "🐳  "},
{'fraction_non_alphanumeric': 0.18303207946588504, 'fraction_numerical': 0.0029311187103077674, 'mean_word_length': 2.6690561529271206, 'pattern_counts': {'":': 82, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4201821', 'n_tokens_mistral': 2284, 'n_tokens_neox': 2159, 'n_words': 632}