mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
cli/templateinit: add links to template READMEs (#2576)
- template init: add links to template docs - examples: add URL field to examples, ensure that example fields are always non-empty - cliui: bump wrap width to 80 from 58
This commit is contained in:
@ -18,13 +18,15 @@ var (
|
||||
//go:embed templates
|
||||
files embed.FS
|
||||
|
||||
examples = make([]Example, 0)
|
||||
parseExamples sync.Once
|
||||
archives = singleflight.Group{}
|
||||
exampleBasePath = "https://github.com/coder/coder/tree/main/examples/templates/"
|
||||
examples = make([]Example, 0)
|
||||
parseExamples sync.Once
|
||||
archives = singleflight.Group{}
|
||||
)
|
||||
|
||||
type Example struct {
|
||||
ID string `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Markdown string `json:"markdown"`
|
||||
@ -52,6 +54,7 @@ func List() ([]Example, error) {
|
||||
continue
|
||||
}
|
||||
exampleID := dir.Name()
|
||||
exampleURL := exampleBasePath + exampleID
|
||||
// Each one of these is a example!
|
||||
readme, err := fs.ReadFile(files, path.Join(dir.Name(), "README.md"))
|
||||
if err != nil {
|
||||
@ -91,6 +94,7 @@ func List() ([]Example, error) {
|
||||
|
||||
examples = append(examples, Example{
|
||||
ID: exampleID,
|
||||
URL: exampleURL,
|
||||
Name: name,
|
||||
Description: description,
|
||||
Markdown: string(frontMatter.Content),
|
||||
|
Reference in New Issue
Block a user