internal

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputFormatDefault = "default"
	OutputFormatJSON    = "json"
)

Variables

This section is empty.

Functions

func FormatTimestamp

func FormatTimestamp() string

FormatTimestamp returns a formatted timestamp string

func GenerateOutput

func GenerateOutput(paths []PathInfo, registry *parser.Registry, opts OutputOptions) (string, error)

GenerateOutput creates the complete output string

func GenerateTree

func GenerateTree(paths []PathInfo) string

GenerateTree creates a textual representation of the directory structure

func IsBinaryFile

func IsBinaryFile(path string) (bool, error)

IsBinaryFile determines if a file is binary by checking its contents

func WriteOutput

func WriteOutput(path string, content string) error

WriteOutput writes content to a file or stdout

Types

type JSONDocument

type JSONDocument struct {
	Timestamp string            `json:"timestamp"`
	Tree      string            `json:"tree,omitempty"`
	Files     []JSONFile        `json:"files,omitempty"`
	Outlines  []JSONFileOutline `json:"outlines,omitempty"`
}

type JSONFile

type JSONFile struct {
	Path    string `json:"path"`
	Content string `json:"content,omitempty"`
	Binary  bool   `json:"binary,omitempty"`
}

type JSONFileOutline

type JSONFileOutline struct {
	Path    string       `json:"path"`
	Symbols []JSONSymbol `json:"symbols,omitempty"`
	Errors  []string     `json:"errors,omitempty"`
}

JSONFileOutline represents the parsed structure of a source file

type JSONSymbol

type JSONSymbol struct {
	Type          string       `json:"type"`                    // e.g., "function", "class", "interface"
	Name          string       `json:"name"`                    // Name of the symbol
	Signature     string       `json:"signature,omitempty"`     // Full signature for functions/methods
	Documentation string       `json:"documentation,omitempty"` // Associated documentation
	Decorators    []string     `json:"decorators,omitempty"`    // Any decorators/annotations
	Children      []JSONSymbol `json:"children,omitempty"`      // Nested symbols (e.g., methods in a class)
	Metadata      any          `json:"metadata,omitempty"`      // Additional language-specific metadata
}

JSONSymbol represents a parsed symbol (function, type, class, etc.)

type OutputFormat

type OutputFormat string

type OutputOptions

type OutputOptions struct {
	NoTree     bool
	NoDump     bool
	Outline    bool
	SkipBinary bool
	Format     OutputFormat
}

Options configures the output generation

type PathInfo

type PathInfo struct {
	Path         string
	RelativePath string
	Depth        int
	IsDir        bool
}

PathInfo represents information about a file or directory

func TraverseDirectory added in v0.4.0

func TraverseDirectory(dir string, filterPatterns, gitignorePaths []string) ([]PathInfo, error)

TraverseDirectory traverses the directory and collects path information using the filter package

Directories

Path Synopsis
Package parser provides language-specific parsing capabilities
Package parser provides language-specific parsing capabilities

Jump to

Keyboard shortcuts

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