From de0f17e2de25d8c16e58b7d9f5d609f87ae8136a Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Tue, 4 Apr 2023 11:31:15 +0100 Subject: [PATCH] Update recommended status for the template store describe command Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- commands/template_store_describe.go | 20 +++++++++++++++++--- commands/template_store_list.go | 16 +++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/commands/template_store_describe.go b/commands/template_store_describe.go index bf6220e50..4e699a492 100644 --- a/commands/template_store_describe.go +++ b/commands/template_store_describe.go @@ -70,12 +70,26 @@ func formatTemplateOutput(storeTemplate TemplateInfo) string { lineWriter := tabwriter.NewWriter(&buff, 0, 0, 1, ' ', 0) fmt.Fprintln(lineWriter) fmt.Fprintf(lineWriter, "Name:\t%s\n", storeTemplate.TemplateName) - fmt.Fprintf(lineWriter, "Platform:\t%s\n", storeTemplate.Platform) + fmt.Fprintf(lineWriter, "Description:\t%s\n", storeTemplate.Description) + fmt.Fprintf(lineWriter, "Language:\t%s\n", storeTemplate.Language) fmt.Fprintf(lineWriter, "Source:\t%s\n", storeTemplate.Source) - fmt.Fprintf(lineWriter, "Description:\t%s\n", storeTemplate.Description) fmt.Fprintf(lineWriter, "Repository:\t%s\n", storeTemplate.Repository) - fmt.Fprintf(lineWriter, "Official Template:\t%s\n", storeTemplate.Official) + + fmt.Fprintf(lineWriter, "Platform:\t%s\n", storeTemplate.Platform) + + if storeTemplate.Official == "true" { + fmt.Fprintf(lineWriter, "Official:\t%s\n", "[x]") + } else { + fmt.Fprintf(lineWriter, "Official:\t%s\n", "[ ]") + } + + if storeTemplate.Recommended { + fmt.Fprintf(lineWriter, "Recommended:\t%s\n", "[x]") + } else { + fmt.Fprintf(lineWriter, "Recommended:\t%s\n", "[ ]") + } + fmt.Fprintln(lineWriter) lineWriter.Flush() diff --git a/commands/template_store_list.go b/commands/template_store_list.go index f1851d28d..22aefc92e 100644 --- a/commands/template_store_list.go +++ b/commands/template_store_list.go @@ -210,14 +210,20 @@ func formatBasicOutput(lineWriter *tabwriter.Writer, templates []TemplateInfo) { func formatVerboseOutput(lineWriter *tabwriter.Writer, templates []TemplateInfo) { - fmt.Fprintf(lineWriter, "NAME\tLANGUAGE\tPLATFORM\tSOURCE\tDESCRIPTION\n") + fmt.Fprintf(lineWriter, "NAME\tRECOMMENDED\tSOURCE\tDESCRIPTION\tLANGUAGE\tPLATFORM\n") for _, template := range templates { - fmt.Fprintf(lineWriter, "%s\t%s\t%s\t%s\t%s\n", + recommended := "[ ]" + if template.Recommended { + recommended = "[x]" + } + + fmt.Fprintf(lineWriter, "%s\t%s\t%s\t%s\t%s\t%s\n", template.TemplateName, - template.Language, - template.Platform, + recommended, template.Source, - template.Description) + template.Description, + template.Language, + template.Platform) } }