implemented 10-cli-commands.md: added CLI commands for branch name resolution, one-shot builds, failed build retries, and build status reports; includes tests for functionality and edge cases

This commit is contained in:
Michael Hoennig
2026-07-07 13:19:29 +02:00
parent a6a2c9de0b
commit 73221a8b8b
19 changed files with 943 additions and 2 deletions
@@ -0,0 +1,26 @@
package de.hoennig.gittally.commands
import java.io.ByteArrayOutputStream
import java.io.PrintStream
data class CapturedConsole(
val stdout: String,
val stderr: String,
)
/** Captures `System.out` and `System.err` while [block] runs. */
fun captureConsole(block: () -> Unit): CapturedConsole {
val out = ByteArrayOutputStream()
val err = ByteArrayOutputStream()
val previousOut = System.out
val previousErr = System.err
System.setOut(PrintStream(out, true))
System.setErr(PrintStream(err, true))
try {
block()
} finally {
System.setOut(previousOut)
System.setErr(previousErr)
}
return CapturedConsole(out.toString(), err.toString())
}