pkg

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaxTokensExceeded    = errors.New("maximum total tokens limit reached")
	ErrMaxTotalSizeExceeded = errors.New("maximum total size limit reached")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	OutputFlags OutputFlag
}

type FileProcessor

type FileProcessor struct {
	MaxTotalSize  int64
	TotalSize     int64
	TotalTokens   int
	FileCount     int
	TokenCounter  *tiktoken.Tiktoken
	TokenCounts   map[string]int
	ListOnly      bool
	DelimiterType string
	MaxLines      int
	MaxTokens     int
	Filter        *filefilter.FileFilter
	PrintFilters  bool
	Processor     middlewares.Processor
	Stats         *Stats
}

func NewFileProcessor

func NewFileProcessor(options ...FileProcessorOption) *FileProcessor

func (*FileProcessor) ProcessPaths

func (fp *FileProcessor) ProcessPaths(paths []string) error

type FileProcessorOption

type FileProcessorOption func(*FileProcessor)

func WithDelimiterType

func WithDelimiterType(delimiterType string) FileProcessorOption

func WithFileFilter

func WithFileFilter(filter *filefilter.FileFilter) FileProcessorOption

func WithListOnly

func WithListOnly(listOnly bool) FileProcessorOption

func WithMaxLines

func WithMaxLines(maxLines int) FileProcessorOption

func WithMaxTokens

func WithMaxTokens(maxTokens int) FileProcessorOption

func WithMaxTotalSize

func WithMaxTotalSize(size int64) FileProcessorOption

func WithPrintFilters

func WithPrintFilters(printFilters bool) FileProcessorOption

func WithProcessor

func WithProcessor(processor middlewares.Processor) FileProcessorOption

type FileStats

type FileStats struct {
	TokenCount int
	LineCount  int
	Size       int64
	FileCount  int // Add FileCount field
}

type OutputFlag

type OutputFlag int
const (
	OutputOverview OutputFlag = 1 << iota
	OutputDirStructure
	OutputFullStructure
)

type Stats

type Stats struct {
	Files     map[string]FileStats
	FileTypes map[string]FileStats
	Dirs      map[string]FileStats
	DirFiles  map[string][]string // New field to store files per directory
	Total     FileStats
	// contains filtered or unexported fields
}

func NewStats

func NewStats() *Stats

func (*Stats) AddFile

func (s *Stats) AddFile(path string, stats FileStats)

func (*Stats) ComputeStats

func (s *Stats) ComputeStats(paths []string, filter *filefilter.FileFilter) error

func (*Stats) GetStats

func (s *Stats) GetStats(path string) (FileStats, bool)

func (*Stats) PrintDirStructure

func (s *Stats) PrintDirStructure()

func (*Stats) PrintFullStructure

func (s *Stats) PrintFullStructure()

func (*Stats) PrintOverview

func (s *Stats) PrintOverview()

func (*Stats) PrintStats

func (s *Stats) PrintStats(config Config, processor middlewares.Processor) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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