Skip to content

Commit

Permalink
Update recommended status for the template store describe command
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Apr 4, 2023
1 parent 526a7a0 commit de0f17e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
20 changes: 17 additions & 3 deletions commands/template_store_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 11 additions & 5 deletions commands/template_store_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit de0f17e

Please sign in to comment.