input

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractLines added in v0.0.11

func ExtractLines(content string, startLine, endLine int) string

ExtractLines extracts lines from content based on start and end line numbers. Line numbers are 1-indexed. 0 for start means from beginning, 0 for end means to end.

func FormatFilesXML

func FormatFilesXML(files []FileContent, stdin string) string

FormatFilesXML formats file contents with prompt-safe delimiters.

func HasStdin

func HasStdin() bool

HasStdin returns true if stdin has data available (not a TTY)

func ReadStdin

func ReadStdin() (string, error)

ReadStdin reads all content from stdin Returns empty string if stdin is a TTY or has no data

Types

type FileContent

type FileContent struct {
	Path    string // File path or special identifier (e.g., "clipboard")
	Content string // The text content
}

FileContent represents content read from a file or other source

func ReadFiles

func ReadFiles(paths []string) ([]FileContent, error)

ReadFiles reads content from the given paths Special values:

  • "clipboard": reads text from system clipboard
  • Glob patterns (e.g., "*.go"): expands and reads all matching files
  • Regular paths: reads file content directly
  • Line ranges (e.g., "main.go:11-22"): reads only specified lines

type FileSpec added in v0.0.11

type FileSpec struct {
	Path      string
	StartLine int  // 1-indexed, 0 means from beginning
	EndLine   int  // 1-indexed, 0 means to end
	HasRegion bool // true if a line range was specified
}

FileSpec represents a file with optional line range

func ParseFileSpec added in v0.0.11

func ParseFileSpec(spec string) (FileSpec, error)

ParseFileSpec parses a file specification like "main.go:11-22" Supported formats:

  • main.go - Entire file (no region)
  • main.go:11-22 - Lines 11-22
  • main.go:11- - Lines 11 to end of file
  • main.go:-22 - Lines 1-22

func (FileSpec) FormatSpecPath added in v0.0.11

func (fs FileSpec) FormatSpecPath() string

FormatSpecPath returns a display path that includes the region if specified

Jump to

Keyboard shortcuts

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