Hello world
Release / Build and publish (push) Successful in 23s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kebandClaude Opus 5.5 committed 2026-10-12 13:52:25 +02:00
commit c00f4b14c4
133 files changed
+26979

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
package commands
import (
"strings"
"testing"
)
func TestRenderQuotes(t *testing.T) {
c := Command{Context: Secrets, Command: `kubectl create secret generic {{.Name}} -n {{.Prompt.ns}} # {{.Note}} {{raw .Name}}`}
got, err := c.Render(Item{Name: "db-password", Note: "it's $(rm -rf ~)", Prompt: map[string]Q{"ns": "team a"}})
if err != nil {
t.Fatal(err)
}
want := `kubectl create secret generic db-password -n 'team a' # 'it'\''s $(rm -rf ~)' db-password`
if got != want {
t.Errorf("got %s\nwant %s", got, want)
}
}
func TestValidate(t *testing.T) {
ok := Command{Context: Secrets, Command: "gh secret set {{.Name}}", Value: "stdin"}
if err := ok.Validate(); err != nil {
t.Errorf("valid command: %v", err)
}
if !ok.Confirms() || ok.Out() != Quiet {
t.Error("defaults: confirm with a value, quiet output")
}
for _, c := range []struct {
cmd Command
want string
}{
{Command{Context: "panes", Command: "x"}, "context"},
{Command{Context: Vaults, Command: "x", Value: "stdin"}, "needs context: secrets"},
{Command{Context: Secrets, Command: "x", Value: "env:1BAD"}, "not stdin or env:NAME"},
{Command{Context: Secrets, Command: "x", Value: "stdin", Output: Terminal}, "terminal's input"},
{Command{Context: Global, Command: "{{.Nope"}, "unclosed"},
{Command{Context: Global, Command: "x", Output: "loud"}, "output"},
{Command{Context: Global, Command: "echo {{.Nmae}}"}, "Nmae"},
{Command{Context: Global, Command: "echo {{.Prompt.ns}}"}, "ns"},
} {
if err := c.cmd.Validate(); err == nil || !strings.Contains(err.Error(), c.want) {
t.Errorf("%+v: %v, want %q", c.cmd, err, c.want)
}
}
}