← back to jterrazz__jterrazz-configuration

Function bodies 209 total

All specs Real LLM only Function bodies
status.Model.renderSetupRow method · go · L45-L54 (10 LOC)
src/internal/presentation/views/status/rows.go
func (m Model) renderSetupRow(item status.Item, colWidths ColumnWidths) string {
	name := components.CellNormal(item.Name, colWidths.Name)
	desc := components.CellMuted(item.Description, colWidths.Desc)
	statusBadge := components.Badge(item.Installed)
	detail := ""
	if item.Detail != "" {
		detail = components.Muted(item.Detail)
	}
	return components.RowPrefix + name + components.ColumnSeparator + desc + components.ColumnSeparator + statusBadge + components.ColumnSeparator + detail
}
status.Model.renderCheckRow method · go · L62-L72 (11 LOC)
src/internal/presentation/views/status/rows.go
func (m Model) renderCheckRow(item status.Item, colWidths ColumnWidths) string {
	name := components.CellNormal(item.Name, colWidths.Name)
	desc := components.CellMuted(item.Description, colWidths.Desc)
	ok := item.Installed == item.GoodWhen
	statusBadge := components.Badge(ok)
	detail := ""
	if item.Detail != "" {
		detail = components.Muted(item.Detail)
	}
	return components.RowPrefix + name + components.ColumnSeparator + desc + components.ColumnSeparator + statusBadge + components.ColumnSeparator + detail
}
status.Model.renderToolRow method · go · L80-L100 (21 LOC)
src/internal/presentation/views/status/rows.go
func (m Model) renderToolRow(item status.Item, colWidths ColumnWidths) string {
	name := components.CellNormal(item.Name, colWidths.Name)
	method := components.CellMethod(item.Method, colWidths.Method)
	statusBadge := components.Badge(item.Installed)
	version := components.CellSpecial(item.Version, colWidths.Version)

	// Show service status for docker/ollama
	extra := ""
	if item.Status != "" {
		if item.Status == "running" {
			extra = components.ColumnSeparator + theme.ServiceRunning.Render(theme.IconServiceOn) + " " + components.Success("running")
		} else if item.Status == "stopped" {
			extra = components.ColumnSeparator + components.Muted("stopped")
		} else {
			// Other status like "199 formulae, 6 casks" or "2 versions"
			extra = components.ColumnSeparator + components.Muted(item.Status)
		}
	}

	return components.RowPrefix + name + components.ColumnSeparator + method + components.ColumnSeparator + statusBadge + components.ColumnSeparator + version + extra
}
status.Model.renderProcessRows method · go · L113-L148 (36 LOC)
src/internal/presentation/views/status/rows.go
func (m Model) renderProcessRows(item status.Item) []string {
	// Add category header
	var header string
	if item.Name == "top cpu" {
		header = components.RowPrefix + components.Muted("CPU")
	} else if item.Name == "top memory" {
		header = components.RowPrefix + components.Muted("Memory")
	}

	if len(item.Processes) == 0 {
		if !item.Loaded {
			return []string{header + components.ColumnSeparator + m.spinner.View()}
		}
		return []string{header + components.ColumnSeparator + components.Muted("no data")}
	}

	var rows []string
	rows = append(rows, header)

	const nameWidth = 28

	for i, p := range item.Processes {
		if i >= 5 { // Show top 5
			break
		}
		// Truncate name if too long
		name := p.Name
		if len(name) > nameWidth {
			name = name[:nameWidth-3] + "..."
		}

		row := components.RowPrefix + components.CellNormal(name, nameWidth) + components.ColumnSeparator + components.CellRight(p.Value, 6)
		rows = append(rows, row)
	}
	return rows
}
status.Model.renderContent method · go · L12-L88 (77 LOC)
src/internal/presentation/views/status/sections.go
func (m Model) renderContent() string {
	var b strings.Builder

	sections := m.groupBySection()
	boxWidth := m.width
	if boxWidth < 40 {
		boxWidth = 40
	}

	isFirst := true
	for _, section := range []string{"Setup", "System", "Tools", "Resources"} {
		subsections, ok := sections[section]
		if !ok {
			continue
		}

		// Section header with decorative line (no leading newline for first section)
		if !isFirst {
			b.WriteString("\n")
		}
		isFirst = false
		sectionHeader := components.SectionHeader(section, boxWidth)
		b.WriteString(sectionHeader)
		b.WriteString("\n")

		// Collect all items in this section for column width calculation
		var allSectionItems []status.Item
		for _, subsection := range getSubsectionOrder(section) {
			items, ok := subsections[subsection]
			if !ok {
				continue
			}
			for _, item := range items {
				if item.Kind == status.KindNetwork || item.Kind == status.KindCache {
					if !item.Loaded || item.Available {
						allSectionItems = append(allSectionIte
status.Model.groupBySection method · go · L90-L116 (27 LOC)
src/internal/presentation/views/status/sections.go
func (m Model) groupBySection() map[string]map[string][]status.Item {
	sections := make(map[string]map[string][]status.Item)

	for _, baseItem := range m.itemOrder {
		item := m.items[baseItem.ID]
		if item.Kind == status.KindHeader || item.Kind == status.KindSystemInfo {
			continue
		}

		if sections[item.Section] == nil {
			sections[item.Section] = make(map[string][]status.Item)
		}
		sections[item.Section][item.SubSection] = append(sections[item.Section][item.SubSection], item)
	}

	// Sort items A-Z by name within each subsection
	for _, subsections := range sections {
		for subsection, items := range subsections {
			sort.Slice(items, func(i, j int) bool {
				return strings.ToLower(items[i].Name) < strings.ToLower(items[j].Name)
			})
			subsections[subsection] = items
		}
	}

	return sections
}
status.getSubsectionOrder function · go · L118-L130 (13 LOC)
src/internal/presentation/views/status/sections.go
func getSubsectionOrder(section string) []string {
	switch section {
	case "Setup":
		return []string{"Setup"}
	case "System":
		return []string{"Security", "Identity"}
	case "Tools":
		return []string{"Package Managers", "Runtimes", "DevOps", "AI", "Terminal & Git", "GUI Apps", "Mac App Store"}
	case "Resources":
		return []string{"Top Processes", "Network", "Caches & Cleanable"}
	}
	return nil
}
Repobility — the code-quality scanner for AI-generated software · https://repobility.com
status.Model.renderSubsectionBox method · go · L132-L147 (16 LOC)
src/internal/presentation/views/status/sections.go
func (m Model) renderSubsectionBox(title string, items []status.Item, width int, colWidths ColumnWidths) string {
	// Render rows
	var rows []string
	for _, item := range items {
		if item.Kind == status.KindProcess {
			// Process items render multiple rows
			processRows := m.renderProcessRows(item)
			rows = append(rows, processRows...)
		} else {
			row := m.renderTableRow(item, colWidths)
			rows = append(rows, row)
		}
	}

	return components.SubsectionBox(title, rows, width)
}
status.calculateColumnWidths function · go · L158-L178 (21 LOC)
src/internal/presentation/views/status/sections.go
func calculateColumnWidths(items []status.Item) ColumnWidths {
	widths := ColumnWidths{}
	for _, item := range items {
		if len(item.Name) > widths.Name {
			widths.Name = len(item.Name)
		}
		if len(item.Description) > widths.Desc {
			widths.Desc = len(item.Description)
		}
		if len(item.Version) > widths.Version {
			widths.Version = len(item.Version)
		}
		if len(item.Method) > widths.Method {
			widths.Method = len(item.Method)
		}
		if len(item.Detail) > widths.Detail {
			widths.Detail = len(item.Detail)
		}
	}
	return widths
}
‹ prevpage 5 / 5