From 0f16fb62e3f02e80af5570b56fbf13344828d3cc Mon Sep 17 00:00:00 2001 From: Hu Keping Date: Sat, 19 Sep 2015 10:36:10 +0800 Subject: [PATCH] Format output of docker info Format those info which will only be displayed when daemon is in debug mode. Signed-off-by: Hu Keping --- ioutils/fmt.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ioutils/fmt.go b/ioutils/fmt.go index 801132f..0b04b0b 100644 --- a/ioutils/fmt.go +++ b/ioutils/fmt.go @@ -12,3 +12,11 @@ func FprintfIfNotEmpty(w io.Writer, format, value string) (int, error) { } return 0, nil } + +// FprintfIfTrue prints the boolean value if it's true +func FprintfIfTrue(w io.Writer, format string, ok bool) (int, error) { + if ok { + return fmt.Fprintf(w, format, ok) + } + return 0, nil +}