github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/ui/ui_v6.go (about)

     1  // +build !V7
     2  
     3  package ui
     4  
     5  import (
     6  	"fmt"
     7  )
     8  
     9  // DisplayWarning translates the warning, substitutes in templateValues, and
    10  // outputs to ui.Err. Only the first map in templateValues is used.
    11  func (ui *UI) DisplayWarning(template string, templateValues ...map[string]interface{}) {
    12  	fmt.Fprintf(ui.Err, "%s\n\n", ui.TranslateText(template, templateValues...))
    13  }
    14  
    15  // Translates warnings and outputs them to ui.Err.
    16  // Prints each warning with a trailing newline.
    17  // Prints the final warning with two trailing newlines.
    18  func (ui *UI) DisplayWarnings(warnings []string) {
    19  
    20  	for _, warning := range warnings {
    21  		fmt.Fprintf(ui.Err, "%s\n", ui.TranslateText(warning))
    22  	}
    23  	if len(warnings) > 0 {
    24  		fmt.Fprintln(ui.Err)
    25  	}
    26  }