madonctl version: Do not use theme for now
Version theme cannot fallback to default output if the
theme template is missing, so only allow templates for now.
--- a/cmd/utils.go Fri May 26 12:05:50 2017 +0200
+++ b/cmd/utils.go Fri May 26 13:41:58 2017 +0200
@@ -41,15 +41,12 @@
of = "plain"
}
}
- // Override format if a template is provided
- if of == "plain" {
- // If the format is plain and there is a template option,
- // set the format to "template". Same for "theme".
- if outputTemplate != "" || outputTemplateFile != "" {
- of = "template"
- } else if outputTheme != "" {
- of = "theme"
- }
+
+ // Override format if a template or a theme is provided
+ if outputTemplate != "" || outputTemplateFile != "" {
+ of = "template"
+ } else if outputTheme != "" {
+ of = "theme"
}
return of
}
--- a/cmd/version.go Fri May 26 12:05:50 2017 +0200
+++ b/cmd/version.go Fri May 26 13:41:58 2017 +0200
@@ -39,11 +39,12 @@
}
var p printer.ResourcePrinter
var err error
- if getOutputFormat() == "plain" {
+ of := getOutputFormat()
+ if of == "template" {
+ p, err = getPrinter()
+ } else { // Default
pOptions := printer.Options{"template": versionTemplate}
p, err = printer.NewPrinterTemplate(pOptions)
- } else {
- p, err = getPrinter()
}
if err != nil {
errPrint("Error: %s", err.Error())