formatter

package
v0.0.0-...-15a56fc Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package formatter — clonescript.go generates a clone.ps1 PowerShell script.

Package formatter — desktopscript.go generates a register-desktop.ps1 script. NOTE: Still uses direct fmt.Fprintln approach. Will migrate to template after clone.ps1.tmpl is verified working.

Package formatter — directclone.go generates plain direct clone scripts.

Package formatter — structure.go renders a folder-tree Markdown file.

Package formatter — template.go provides shared template loading via go:embed.

Package formatter renders ScanRecords to terminal output.

Package formatter — terminaltree.go renders folder-tree structures for terminal output.

Package formatter — text.go writes a plain text file with one git clone command per line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCSV

func ParseCSV(reader io.Reader) ([]model.ScanRecord, error)

ParseCSV reads records from a CSV reader.

func ParseJSON

func ParseJSON(reader io.Reader) ([]model.ScanRecord, error)

ParseJSON reads records from a JSON reader.

func SetValidationSink

func SetValidationSink(w io.Writer) io.Writer

SetValidationSink redirects validation warnings to w. Pass os.Stderr to restore the default. Returns the previous sink so tests can defer-restore.

func Terminal

func Terminal(w io.Writer, records []model.ScanRecord, outputDir string, quiet bool) error

Terminal writes a professional colored output to the given writer. When quiet is true, the clone help section is suppressed (useful for CI/scripts).

The "Per-Repo Summary" section emits one standardized block per repo via render.RenderRepoTermBlocks. The block is intentionally rendered without color so the output is grep-friendly across all four commands that share it (scan, clone-from, clone-next, probe).

func WriteCSV

func WriteCSV(w io.Writer, records []model.ScanRecord) error

WriteCSV writes records to the given writer in CSV format.

Records are validated first; per-issue warnings are emitted to the configured sink (default os.Stderr) but the write always proceeds. See validate.go for the warn-and-write policy.

func WriteCloneScript

func WriteCloneScript(w io.Writer, records []model.ScanRecord) error

WriteCloneScript writes a self-contained PowerShell clone script using the embedded clone.ps1.tmpl template.

func WriteDesktopScript

func WriteDesktopScript(w io.Writer, records []model.ScanRecord) error

WriteDesktopScript writes a PowerShell script that registers repos with GitHub Desktop.

func WriteDirectCloneSSHScript

func WriteDirectCloneSSHScript(w io.Writer, records []model.ScanRecord) error

WriteDirectCloneSSHScript writes a plain PS1 with one SSH git clone per line.

func WriteDirectCloneScript

func WriteDirectCloneScript(w io.Writer, records []model.ScanRecord) error

WriteDirectCloneScript writes a plain PS1 with one HTTPS git clone per line.

func WriteJSON

func WriteJSON(w io.Writer, records []model.ScanRecord) error

WriteJSON writes records to the given writer as a JSON array.

Records are validated first; per-issue warnings are emitted to the configured sink (default os.Stderr) but the write always proceeds. See validate.go for the warn-and-write policy.

func WriteStructure

func WriteStructure(w io.Writer, records []model.ScanRecord) error

WriteStructure writes a Markdown folder tree of discovered repos.

func WriteText

func WriteText(w io.Writer, records []model.ScanRecord)

WriteText writes one git clone instruction per line to a plain text file.

Types

type CloneData

type CloneData struct {
	Repos []RepoEntry
}

CloneData is the top-level data for clone.ps1.tmpl.

type DesktopData

type DesktopData struct {
	Repos []RepoEntry
}

DesktopData is the top-level data for desktop.ps1.tmpl.

type RepoEntry

type RepoEntry struct {
	Name   string
	Branch string
	URL    string
	Path   string
}

RepoEntry is the data passed into PowerShell templates for each repo.

type ValidationIssue

type ValidationIssue struct {
	RowIndex int    // 0-based position in the input slice
	RepoName string // best-effort identifier (may be "" when RepoName is the missing field)
	Field    string // the field that triggered the issue
	Reason   string // human-readable explanation
}

ValidationIssue describes one problem discovered in one record. Rendered straight to stderr by the writer; carries enough context for users to fix the source data without re-running the scan.

func ValidateRecords

func ValidateRecords(records []model.ScanRecord) []ValidationIssue

ValidateRecords inspects every record and returns the union of all completeness + consistency issues found. An empty return slice means the input is safe to encode.

func (ValidationIssue) String

func (v ValidationIssue) String() string

String renders an issue as a single line suitable for stderr output.

Jump to

Keyboard shortcuts

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