MCPcopy Create free account
hub / github.com/github/gh-aw / renderBashCommandsDiffMarkdownSection

Function renderBashCommandsDiffMarkdownSection

pkg/cli/audit_diff_render.go:761–784  ·  view source on GitHub ↗

renderBashCommandsDiffMarkdownSection renders the bash commands diff sub-section as markdown.

(run1ID, run2ID int64, diff *BashCommandsDiff)

Source from the content-addressed store, hash-verified

759
760// renderBashCommandsDiffMarkdownSection renders the bash commands diff sub-section as markdown.
761func renderBashCommandsDiffMarkdownSection(run1ID, run2ID int64, diff *BashCommandsDiff) {
762 fmt.Fprintln(os.Stdout, "#### Bash Commands")
763 fmt.Fprintln(os.Stdout)
764 fmt.Fprintf(os.Stdout, "Total bash calls: Run #%d=%d, Run #%d=%d (%s)\n\n",
765 run1ID, diff.Run1TotalCalls,
766 run2ID, diff.Run2TotalCalls,
767 diff.TotalCallsChange)
768
769 if len(diff.Commands) > 0 {
770 fmt.Fprintf(os.Stdout, "| Command | Run #%d | Run #%d | Change | Max Input (r1/r2) | Max Output (r1/r2) |\n", run1ID, run2ID)
771 fmt.Fprintln(os.Stdout, "|---------|---------|---------|--------|-------------------|-------------------|")
772 for _, cmd := range diff.Commands {
773 change := cmd.CallCountChange
774 if change == "" {
775 change = "—"
776 }
777 fmt.Fprintf(os.Stdout, "| `%s` | %d | %d | %s | %s | %s |\n",
778 cmd.Name, cmd.Run1CallCount, cmd.Run2CallCount, change,
779 formatMaxSizeCell(cmd.Run1MaxInputSize, cmd.Run2MaxInputSize),
780 formatMaxSizeCell(cmd.Run1MaxOutputSize, cmd.Run2MaxOutputSize))
781 }
782 fmt.Fprintln(os.Stdout)
783 }
784}
785
786// formatMaxSizeCell formats a "run1 / run2" max-size pair for display in a table cell.
787// Returns "—" when both values are zero, and omits the individual value if it is zero.

Callers 1

Calls 1

formatMaxSizeCellFunction · 0.85

Tested by

no test coverage detected