more knecht

This commit is contained in:
2026-04-04 15:05:08 +02:00
parent 960e12f967
commit b4fddbb5b6
9 changed files with 463 additions and 84 deletions

View File

@@ -13,10 +13,14 @@ var listCmd = &cobra.Command{
Use: "list",
Short: "List all stacks with status and drift",
RunE: func(cmd *cobra.Command, args []string) error {
_, client, svcPath, err := setup()
cfg, client, svcPath, err := setup()
if err != nil {
return err
}
ignoreSet := make(map[string]bool, len(cfg.Ignore))
for _, name := range cfg.Ignore {
ignoreSet[name] = true
}
stacks, err := client.ListStacks()
if err != nil {
@@ -35,7 +39,12 @@ var listCmd = &cobra.Command{
fmt.Printf("%-20s %-10s %s\n", "STACK", "STATUS", "DRIFT")
fmt.Println(repeat("-", 60))
remoteNames := make(map[string]bool, len(stacks))
for _, s := range stacks {
if ignoreSet[s.Name] {
continue
}
remoteNames[s.Name] = true
status := statusLabel(s.Status)
driftSummary := "no local compose"
@@ -49,6 +58,14 @@ var listCmd = &cobra.Command{
fmt.Printf("%-20s %-10s %s\n", s.Name, status, driftSummary)
}
// Local-only stacks
for _, l := range locals {
if ignoreSet[l.Name] || remoteNames[l.Name] {
continue
}
fmt.Printf("%-20s %-10s %s\n", l.Name, "not deployed", "-")
}
return nil
},
}