feat(dev): show workflow templates in list

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-01 09:48:48 +00:00
parent c50257fa49
commit 6e278a293a
3 changed files with 26 additions and 1 deletions

View file

@ -7,10 +7,10 @@ import (
"slices"
"strings"
"forge.lthn.ai/core/cli/pkg/cli"
"dappco.re/go/core/i18n"
"dappco.re/go/core/io"
"dappco.re/go/core/scm/repos"
"forge.lthn.ai/core/cli/pkg/cli"
)
// Workflow command flags
@ -117,6 +117,10 @@ func runWorkflowList(registryPath string) error {
for _, wf := range templateWorkflows {
templateSet[wf] = true
}
templateNames := slices.Sorted(maps.Keys(templateSet))
if len(templateNames) > 0 {
cli.Print("%s %s\n\n", i18n.T("cmd.dev.workflow.templates"), strings.Join(templateNames, ", "))
}
// Build table
headers := []string{i18n.T("cmd.dev.workflow.header.repo")}

View file

@ -1,7 +1,9 @@
package dev
import (
"maps"
"path/filepath"
"slices"
"testing"
"dappco.re/go/core/io"
@ -106,3 +108,21 @@ func TestFindTemplateWorkflow_NotFound(t *testing.T) {
t.Errorf("Expected empty string for non-existent template, got %s", result)
}
}
func TestTemplateNames_Good(t *testing.T) {
templateSet := map[string]bool{
"z.yml": true,
"a.yml": true,
"m.yml": true,
}
names := slices.Sorted(maps.Keys(templateSet))
if len(names) != 3 {
t.Fatalf("Expected 3 template names, got %d", len(names))
}
if names[0] != "a.yml" || names[1] != "m.yml" || names[2] != "z.yml" {
t.Fatalf("Expected sorted template names, got %v", names)
}
}

View file

@ -210,6 +210,7 @@
"skipped_count": "{{.Count}} skipped",
"synced_count": "{{.Count}} synced",
"would_sync_count": "{{.Count}} would sync",
"templates": "Templates",
"header": {
"repo": "Repo"
},