<commit_before>// SPDX-License-Identifier: MIT

// Package cmd 提供子命令的相关功能
package cmd

import (
	"bytes"
	"flag"
	"fmt"
	"io"
	"os"
	"strings"

	"github.com/issue9/cmdopt"
	"github.com/issue9/term/colors"
	"golang.org/x/text/message"

	"github.com/caixw/apidoc/v7/core"
	"github.com/caixw/apidoc/v7/internal/locale"
)

// 命令行输出的表格中，每一列为了对齐填补的空格数量。
const tail = 3

var command *cmdopt.CmdOpt

var printers = map[core.MessageType]*printer{
	core.Erro: &printer{
		out:    os.Stderr,
		color:  colors.Red,
		prefix: locale.ErrorPrefix,
	},
	core.Warn: &printer{
		out:    os.Stderr,
		color:  colors.Cyan,
		prefix: locale.WarnPrefix,
	},
	core.Info: &printer{
		out:    os.Stdout,
		color:  colors.Default,
		prefix: locale.InfoPrefix,
	},
	core.Succ: &printer{
		out:    os.Stdout,
		color:  colors.Green,
		prefix: locale.SuccessPrefix,
	},
}

type printer struct {
	out    io.Writer
	color  colors.Color
	prefix message.Reference
}

// Init 初始化 cmdopt.CmdOpt 实例
func Init(out io.Writer) *cmdopt.CmdOpt {<commit_msg>style(internal/cmd): 删除多余的类型名称<commit_after>// SPDX-License-Identifier: MIT

// Package cmd 提供子命令的相关功能
package cmd

import (
	"bytes"
	"flag"
	"fmt"
	"io"
	"os"
	"strings"

	"github.com/issue9/cmdopt"
	"github.com/issue9/term/colors"
	"golang.org/x/text/message"

	"github.com/caixw/apidoc/v7/core"
	"github.com/caixw/apidoc/v7/internal/locale"
)

// 命令行输出的表格中，每一列为了对齐填补的空格数量。
const tail = 3

var command *cmdopt.CmdOpt

var printers = map[core.MessageType]*printer{
	core.Erro: {
		out:    os.Stderr,
		color:  colors.Red,
		prefix: locale.ErrorPrefix,
	},
	core.Warn: {
		out:    os.Stderr,
		color:  colors.Cyan,
		prefix: locale.WarnPrefix,
	},
	core.Info: {
		out:    os.Stdout,
		color:  colors.Default,
		prefix: locale.InfoPrefix,
	},
	core.Succ: {
		out:    os.Stdout,
		color:  colors.Green,
		prefix: locale.SuccessPrefix,
	},
}

type printer struct {
	out    io.Writer
	color  colors.Color
	prefix message.Reference
}

// Init 初始化 cmdopt.CmdOpt 实例
func Init(out io.Writer) *cmdopt.CmdOpt {
{'fraction_non_alphanumeric': 0.1427863163113535, 'fraction_numerical': 0.00495785820525533, 'mean_word_length': 3.47450110864745, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6844474', 'n_tokens_mistral': 924, 'n_tokens_neox': 914, 'n_words': 155}