Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find ONE feature ...' (#24) from agent/update-the-code-against-the-ax-design-pr into dev
Some checks failed
Security Scan / security (push) Has been cancelled
Some checks failed
Security Scan / security (push) Has been cancelled
This commit is contained in:
commit
de71ed0429
2 changed files with 22 additions and 0 deletions
|
|
@ -48,6 +48,9 @@ func renderSearchResults(results []*gohelp.SearchResult, query string) error {
|
|||
cli.Section("Search Results")
|
||||
for _, res := range results {
|
||||
cli.Println(" %s - %s", res.Topic.ID, res.Topic.Title)
|
||||
if snippet := strings.TrimSpace(res.Snippet); snippet != "" {
|
||||
cli.Println("%s", cli.DimStr(" "+snippet))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,25 @@ func TestAddHelpCommands_Good(t *testing.T) {
|
|||
assert.Contains(t, out, topics[0].ID)
|
||||
}
|
||||
|
||||
func TestRenderSearchResults_Good(t *testing.T) {
|
||||
out := captureOutput(t, func() {
|
||||
err := renderSearchResults([]*gohelp.SearchResult{
|
||||
{
|
||||
Topic: &gohelp.Topic{
|
||||
ID: "config",
|
||||
Title: "Configuration",
|
||||
},
|
||||
Snippet: "Core is configured via environment variables.",
|
||||
},
|
||||
}, "config")
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
assert.Contains(t, out, "SEARCH RESULTS")
|
||||
assert.Contains(t, out, "config - Configuration")
|
||||
assert.Contains(t, out, "Core is configured via environment variables.")
|
||||
}
|
||||
|
||||
func TestAddHelpCommands_Bad(t *testing.T) {
|
||||
t.Run("missing search results", func(t *testing.T) {
|
||||
cmd := newHelpCommand(t)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue