formatter

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Path     string
	Size     int64
	Content  string
	Language string
}

FileInfo represents information about a file

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter handles formatting output in different formats

func NewFormatter

func NewFormatter(format string, outputDir, projectDir string) *Formatter

NewFormatter creates a new formatter for the specified format

func (*Formatter) AddFile

func (f *Formatter) AddFile(fileInfo FileInfo)

AddFile adds a file to the report

func (*Formatter) GetFormattedContent

func (f *Formatter) GetFormattedContent() (string, error)

GetFormattedContent returns the formatted content as a string

func (*Formatter) SetFileTypes

func (f *Formatter) SetFileTypes(fileTypes map[string]int)

SetFileTypes sets the file types in the report

func (*Formatter) SetHeaderContent

func (f *Formatter) SetHeaderContent(content string)

SetHeaderContent sets the header content for the report

func (*Formatter) SetIssues

func (f *Formatter) SetIssues(issues []string)

SetIssues sets the issues in the report

func (*Formatter) SetKeyFiles

func (f *Formatter) SetKeyFiles(keyFiles []string)

SetKeyFiles sets the key files in the report

func (*Formatter) SetProjectStructure

func (f *Formatter) SetProjectStructure(structure string)

SetProjectStructure sets the project structure for the report

func (*Formatter) SetStatistics

func (f *Formatter) SetStatistics(fileCount int, totalSize int64, tokenCount, charCount int, duration time.Duration)

SetStatistics sets the statistics for the report

func (*Formatter) SetTechnologies

func (f *Formatter) SetTechnologies(technologies []string)

SetTechnologies sets the technologies in the report

func (*Formatter) WriteToFile

func (f *Formatter) WriteToFile() (string, error)

WriteToFile writes the formatted output to a file

func (*Formatter) WriteToStdout

func (f *Formatter) WriteToStdout() error

WriteToStdout writes the formatted output to stdout

type OutputFormat

type OutputFormat string

OutputFormat represents the format of the output file

const (
	FormatTXT    OutputFormat = "txt"
	FormatJSON   OutputFormat = "json"
	FormatXML    OutputFormat = "xml"
	FormatSTDOUT OutputFormat = "stdout" // Format pour sortie directe sur stdout
)

type ProjectReport

type ProjectReport struct {
	ProjectInfo struct {
		Name        string    `json:"name" xml:"name"`
		GeneratedAt time.Time `json:"generated_at" xml:"generated_at"`
		Generator   string    `json:"generator" xml:"generator"`
		Host        string    `json:"host" xml:"host"`
		OS          string    `json:"os" xml:"os"`
	} `json:"project_info" xml:"project_info"`
	Technologies []string `json:"technologies" xml:"technologies>technology"`
	KeyFiles     []string `json:"key_files" xml:"key_files>file"`
	Issues       []string `json:"issues" xml:"issues>issue"`
	Statistics   struct {
		FileCount      int     `json:"file_count" xml:"file_count"`
		TotalSize      int64   `json:"total_size" xml:"total_size"`
		TotalSizeHuman string  `json:"total_size_human" xml:"total_size_human"`
		AvgFileSize    int64   `json:"avg_file_size" xml:"avg_file_size"`
		TokenCount     int     `json:"token_count" xml:"token_count"`
		CharCount      int     `json:"char_count" xml:"char_count"`
		FilesPerSecond float64 `json:"files_per_second" xml:"files_per_second"`
	} `json:"statistics" xml:"statistics"`
	FileTypes []struct {
		Extension string `json:"extension" xml:"extension,attr"`
		Count     int    `json:"count" xml:"count"`
	} `json:"file_types" xml:"file_types>type"`
	Files []struct {
		Path     string `json:"path" xml:"path"`
		Size     int64  `json:"size" xml:"size"`
		Content  string `json:"content,omitempty" xml:"content,omitempty"`
		Language string `json:"language" xml:"language"`
	} `json:"files" xml:"files>file"`
}

ProjectReport represents the structure for formatted output

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL