format

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyInfo

type DependencyInfo struct {
	Imports   map[string][]string `xml:"imports>file"`
	Packages  []string            `xml:"packages>package"`
	CoreFiles []string            `xml:"coreFiles>file"`
}

type DirectoryNode

type DirectoryNode struct {
	Name     string           `xml:"name,attr"`
	Type     string           `xml:"type,attr"` // "file" or "dir"
	Children []*DirectoryNode `xml:"node,omitempty"`
}

DirectoryNode represents a node in the directory tree

func (*DirectoryNode) ToMarkdown

func (d *DirectoryNode) ToMarkdown(level int) string

Helper function to convert DirectoryNode to markdown string

type FileInfo

type FileInfo struct {
	Path    string `xml:"path,attr"`
	Content string `xml:"content"`
}

type FileStatistics

type FileStatistics struct {
	TotalFiles   int            `xml:"totalFiles"`
	FilesByType  map[string]int `xml:"-"` // Exclude from direct XML marshaling
	TotalLines   int            `xml:"totalLines"`
	PackageCount int            `xml:"packageCount"`
}

type Formatter

type Formatter interface {
	Format(project *ProjectOutput) (string, error)
}

Formatter interface for different output formats

func GetFormatter

func GetFormatter(format string) (Formatter, error)

Get appropriate formatter based on format string

type GitInfo

type GitInfo struct {
	Branch        string `xml:"branch"`
	CommitHash    string `xml:"commitHash"`
	CommitMessage string `xml:"commitMessage"`
}

type MarkdownFormatter

type MarkdownFormatter struct{}

func (*MarkdownFormatter) Format

func (m *MarkdownFormatter) Format(project *ProjectOutput) (string, error)

type Metadata

type Metadata struct {
	Language     string   `xml:"language"`
	Version      string   `xml:"version"`
	Dependencies []string `xml:"dependencies>dependency,omitempty"`
}

type OutputFormat

type OutputFormat string
const (
	FormatMarkdown OutputFormat = "markdown"
	FormatXML      OutputFormat = "xml"
)

type ProjectAnalysis

type ProjectAnalysis struct {
	EntryPoints   map[string]string `xml:"entryPoints,omitempty"`
	ConfigFiles   map[string]string `xml:"configFiles,omitempty"`
	CoreFiles     map[string]string `xml:"coreFiles,omitempty"`
	TestFiles     map[string]string `xml:"testFiles,omitempty"`
	Documentation map[string]string `xml:"documentation,omitempty"`
}

type ProjectOutput

type ProjectOutput struct {
	XMLName       xml.Name         `xml:"project"`
	DirectoryTree *DirectoryNode   `xml:"directoryTree"`
	GitInfo       *GitInfo         `xml:"gitInfo,omitempty"`
	Metadata      *Metadata        `xml:"metadata,omitempty"`
	Files         []FileInfo       `xml:"files>file,omitempty"`
	Overview      *ProjectOverview `xml:"overview,omitempty"`
	FileStats     *FileStatistics  `xml:"fileStats,omitempty"`
	Dependencies  *DependencyInfo  `xml:"dependencies,omitempty"`
	Analysis      *ProjectAnalysis `xml:"analysis,omitempty"`
}

type ProjectOverview

type ProjectOverview struct {
	Description string   `xml:"description"`
	Purpose     string   `xml:"purpose"`
	Features    []string `xml:"features>feature,omitempty"`
}

type XMLFormatter

type XMLFormatter struct{}

func (*XMLFormatter) Format

func (x *XMLFormatter) Format(project *ProjectOutput) (string, error)

Jump to

Keyboard shortcuts

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