tolerate output without template file

This commit is contained in:
deads2k 2015-08-13 13:11:00 -04:00
parent 919c7e94e2
commit 969d526ca5

View File

@ -82,7 +82,10 @@ func OutputVersion(cmd *cobra.Command, defaultVersion string) string {
// Requires that printer flags have been added to cmd (see AddPrinterFlags).
func PrinterForCommand(cmd *cobra.Command) (kubectl.ResourcePrinter, bool, error) {
outputFormat := GetFlagString(cmd, "output")
templateFile := GetFlagString(cmd, "template")
// templates are logically optional for specifying a format.
// TODO once https://github.com/kubernetes/kubernetes/issues/12668 is fixed, this should fall back to GetFlagString
templateFile, _ := cmd.Flags().GetString("template")
if len(outputFormat) == 0 && len(templateFile) != 0 {
outputFormat = "template"
}