Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/azd/cmd/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ func (tl *templateListAction) Run(ctx context.Context) (*actions.ActionResult, e
err = tl.formatter.Format(listedTemplates, tl.writer, output.TableFormatterOptions{
Columns: columns,
})

if err == nil {
templates.PrintGalleryLinks(tl.writer)
fmt.Fprintf(tl.writer, "Select a template from the gallery, then run %s\n",
output.WithHighLightFormat("azd init -t <template name>"))
}
Comment thread
JeffreyCA marked this conversation as resolved.
} else {
err = tl.formatter.Format(listedTemplates, tl.writer, nil)
}
Expand Down
15 changes: 15 additions & 0 deletions cli/azd/pkg/templates/template_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ package templates
import (
"context"
"fmt"
"io"
"log"
"slices"
"strings"

"github.com/azure/azure-dev/cli/azd/pkg/input"
"github.com/azure/azure-dev/cli/azd/pkg/output"
)

var (
Expand Down Expand Up @@ -196,6 +198,9 @@ func PromptTemplate(
return Template{}, fmt.Errorf("prompting for template: %w", err)
}

// Display gallery links before template selection
PrintGalleryLinks(console.Handles().Stdout)

templateChoices := []*Template{}
duplicateNames := []string{}

Expand Down Expand Up @@ -251,3 +256,13 @@ func PromptTemplate(

return *template, nil
}

// PrintGalleryLinks prints the template gallery banner message to the given writer.
func PrintGalleryLinks(w io.Writer) {
fmt.Fprintln(w)
fmt.Fprintln(w, "For Microsoft AI Gallery visit",
output.WithLinkFormat("https://azure.github.io/ai-app-templates"))
Comment thread
JeffreyCA marked this conversation as resolved.
fmt.Fprintln(w, "For azd community gallery (awesome-azd) visit",
output.WithLinkFormat("https://azure.github.io/awesome-azd"))
fmt.Fprintln(w)
}
Loading