Add preflight command and run alias
This commit is contained in:
22
internal/cli/preflight.go
Normal file
22
internal/cli/preflight.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/diagnostics"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
)
|
||||
|
||||
func runPreflight(inv commandkit.Invocation, input processInput) commandkit.Outcome {
|
||||
loaded, err := loadProcessInputs(inv.Context, input, inv.ReportingMode())
|
||||
if err != nil {
|
||||
return acquisitionOutcome(inv, err)
|
||||
}
|
||||
prepared, err := prepareLocal(inv.Context, input, loaded, inv.Reporter().Output())
|
||||
if err != nil {
|
||||
return preparationOutcome(inv, err)
|
||||
}
|
||||
if err := diagnostics.ProbeOutput(inv.Context, prepared.Destinations); err != nil {
|
||||
return commandkit.Failure(err.Error()).WithCause(err)
|
||||
}
|
||||
_ = inv.Reporter().AtEnd().Info("Local preflight checks passed.")
|
||||
return commandkit.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user