Connect invocation execution to one reporter

This commit is contained in:
2026-10-26 02:59:28 +00:00
parent df21b75f9c
commit 49a10690c6
6 changed files with 261 additions and 144 deletions

View File

@@ -5,6 +5,8 @@ import (
"io"
"strings"
"sync"
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
)
type reportingMode uint8
@@ -100,6 +102,30 @@ func newReporter(streams Streams) *Reporter {
}}
}
func (r *Reporter) applySelection(selection commandmeta.ReportingSelection) {
if r == nil || r.state == nil {
return
}
state := r.state
state.mu.Lock()
defer state.mu.Unlock()
if state.closed {
return
}
switch selection.Mode {
case commandmeta.ReportingModeQuiet:
state.mode = modeQuiet
case commandmeta.ReportingModeVerbose:
state.mode = modeVerbose
case commandmeta.ReportingModeDebug:
state.mode = modeDebug
default:
state.mode = modeOrdinary
}
state.progress = selection.Progress
state.progressSet = selection.ProgressSet
}
// Output returns a managed writer for substantive command results.
func (r *Reporter) Output() io.Writer {
if r == nil || r.state == nil {