Auto-commit after successful build: update app gameplay/UI, improve build setup

Changed files:\napp/build.gradle.kts
app/src/main/java/solutions/tretter/githugandroid/GitHelpCommands.kt
app/src/main/java/solutions/tretter/githugandroid/GitHugApp.kt
app/src/main/java/solutions/tretter/githugandroid/GitRuntime.kt
app/src/main/java/solutions/tretter/githugandroid/ManPageDialog.kt
app/src/test/java/solutions/tretter/githugandroid/GitHelpCommandsTest.kt
This commit is contained in:
Joe Tretter
2026-05-02 22:09:20 -05:00
parent dcd5589d74
commit ca20b0a358
6 changed files with 247 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ fun GitHugApp() {
var historyDraft by remember { mutableStateOf("") }
var hasRestoredProgress by remember { mutableStateOf(false) }
var editorState by remember { mutableStateOf<TextEditorState?>(null) }
var manPageState by remember { mutableStateOf<ManPageState?>(null) }
val currentLevel = levels[currentLevelIndex]
LaunchedEffect(persistedPaneLayout) {
@@ -168,6 +169,7 @@ fun GitHugApp() {
historyIndex = -1
historyDraft = ""
editorState = null
manPageState = null
applyRecommendedPaneWeights(persist = false)
}
@@ -184,6 +186,7 @@ fun GitHugApp() {
historyIndex = -1
historyDraft = ""
editorState = null
manPageState = null
paneLayout = paneLayout.copy(
weights = paneLayout.weights + recommendedPaneWeights(
heights = recommendedPaneHeights(
@@ -323,6 +326,17 @@ fun GitHugApp() {
applyRecommendedPaneWeights(persist = false)
}
fun openManPage(invocation: GitHelpInvocation) {
val content = runtime.gitManPage(currentLevel, repo, invocation.topic)
output = buildList {
addAll(output)
add("$ ${invocation.command}")
add("Opened git help viewer for ${invocation.topic}")
}
manPageState = ManPageState(topic = invocation.topic, content = content)
applyRecommendedPaneWeights(persist = false)
}
fun saveEditor() {
val state = editorState ?: return
val targetPath = state.saveAsPath.trim()
@@ -352,6 +366,12 @@ fun GitHugApp() {
return
}
val helpInvocation = parseGitHelpInvocation(raw)
if (helpInvocation != null) {
openManPage(helpInvocation)
return
}
val (newRepo, lines) = runtime.execute(currentLevel, repo, raw)
applyCommandResult(raw, newRepo, lines, echoCommand = true)
}
@@ -460,5 +480,12 @@ fun GitHugApp() {
onSave = { saveEditor() },
)
}
manPageState?.let { state ->
ManPageDialog(
state = state,
onClose = { manPageState = null },
)
}
}
}