-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quiet mode to progress printer #558
Add quiet mode to progress printer #558
Conversation
aa91402
to
03c1f62
Compare
03c1f62
to
f8b1e80
Compare
@tonistiigi Could you PTAL? |
util/progress/printer.go
Outdated
c = cons | ||
switch mode { | ||
case PrinterModeQuiet: | ||
devNull, err := os.Open(os.DevNull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just set out to ioutil.Discard
, no fallthrough
needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ioutil.Discard
is a Writer
and out
is a File
.
About the fallthrough
I'm not sure if I understood, but it is needed in order to execute console.ConsoleFromFile(out)
and assign to c
. Otherwise, how could it affect the console? Note that if not, plain
output is printed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter that DisplaySolveStatus
takes is an io.Writer
. If you discard the output then you don't have a console. That should answer to the fallthrough
case as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhhh... Got it... I missunderstood the out you said with the variable out
.
PTAL
util/progress/printer.go
Outdated
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be connected to -q
as well. Otherwise, the ux is confusing unless we want to completely remove -q
. But there are some things to figure out like outputs can pipe to stdout if image ID is printed there so I guess it could be follow up. Another way to make it faster is to just read the channel here directly until end if the content is disarded anyway. DisplaySolveStatus
does need to analyze the objects and sort/cache them so has some overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! The intent of this PR is only to make docker-archive/compose-cli#1390 possible.
I can propose follow up PR to connect -q
if you want.
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
f8b1e80
to
55d5b80
Compare
Allows it to write to
os.DevNull
and by this silencing the printer.Related to docker-archive/compose-cli#1390