feat: allow for stdout to be buffered on each command (#2335)

* feat: add preRun func to version to restore stdout

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>

* test: add test to capture version in output

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>

* change stdout buffering to log to be opt-in per command

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix tests

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Christopher Angelo Phillips
2023-11-17 14:14:13 -05:00
committed by GitHub
co-authored by Alex Goodman
parent 1c787f436f
commit ba80e490c2
11 changed files with 62 additions and 75 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ import (
// It also constructs the syft attest command and the syft version command.
// `RunE` is the earliest that the complete application configuration can be loaded.
func Application(id clio.Identification) clio.Application {
app, rootCmd := create(id, os.Stdout)
return ui.StdoutLoggingApplication(app, rootCmd)
app, _ := create(id, os.Stdout)
return app
}
// Command returns the root command for the syft CLI application. This is useful for embedding the entire syft CLI