This commit makes the previously internal `progress` package an external API. The is the result of the discussion in images PR#1150 where we decided that the progress module is not a great fit for the "images" library. We want to share this code between bootc-image-builder and image-builder-cli now. In the future we will also want to use it in the `worker-executor` in `osbuild-composer` to parse the stream data from `osbuild`. We plan to merge bootc-image-builder and image-builder-cli medium term so importing code from bootc-image-buider in image-builder cli is not that stange. When we (longer-term) use this code the `worker-executor` we will need to think about this again and maybe put it back into images. However this commit unblocks us without making anything worse.
27 lines
463 B
Go
27 lines
463 B
Go
package progress
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type (
|
|
TerminalProgressBar = terminalProgressBar
|
|
DebugProgressBar = debugProgressBar
|
|
VerboseProgressBar = verboseProgressBar
|
|
)
|
|
|
|
func MockOsStderr(w io.Writer) (restore func()) {
|
|
saved := osStderr
|
|
osStderr = w
|
|
return func() {
|
|
osStderr = saved
|
|
}
|
|
}
|
|
|
|
func MockIsattyIsTerminal(fn func(uintptr) bool) (restore func()) {
|
|
saved := isattyIsTerminal
|
|
isattyIsTerminal = fn
|
|
return func() {
|
|
isattyIsTerminal = saved
|
|
}
|
|
}
|