Skip to content

Commit 89386c9

Browse files
committed
Address search review feedback
1 parent 8e7fb98 commit 89386c9

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

internal/commands/help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ var commandExamples = map[string]string{
405405
"fizzy config show": "$ fizzy config show\n$ fizzy config show --verbose",
406406
"fizzy config explain": "$ fizzy config explain\n$ fizzy config explain --profile acme",
407407
"fizzy doctor": "$ fizzy doctor\n$ fizzy doctor --profile acme\n$ fizzy doctor --all-profiles",
408-
"fizzy search": "$ fizzy search \"billing bug\"\n$ fizzy card list --search \"billing bug\" --board <id>",
408+
"fizzy search": "$ fizzy search \"billing bug\"\n$ fizzy search <card-id>",
409409
"fizzy notification": "$ fizzy notification tray\n$ fizzy notification list",
410410
"fizzy notification tray": "$ fizzy notification tray",
411411
"fizzy user": "$ fizzy user list\n$ fizzy user show <id>",

internal/commands/search.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
var searchCmd = &cobra.Command{
11-
Use: "search QUERY",
11+
Use: "search QUERY...",
1212
Short: "Search cards",
1313
Long: `Searches cards using the dedicated full-text search endpoint.
1414
@@ -33,7 +33,7 @@ use 'fizzy card list' with --search and the relevant filter flags.`,
3333

3434
items := normalizeAny(raw)
3535
count := dataCount(items)
36-
summary := fmt.Sprintf("%d results for \"%s\"", count, query)
36+
summary := fmt.Sprintf("%d results for %q", count, query)
3737

3838
breadcrumbs := []Breadcrumb{
3939
breadcrumb("show", "fizzy card show <number>", "View card details"),

internal/commands/search_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ func TestSearch(t *testing.T) {
4949
err := searchCmd.RunE(searchCmd, []string{"login", "error"})
5050
assertExitCode(t, err, 0)
5151

52+
if len(mock.GetWithPaginationCalls) != 1 {
53+
t.Fatalf("expected 1 GET call, got %d", len(mock.GetWithPaginationCalls))
54+
}
5255
if got := mock.GetWithPaginationCalls[0].Path; got != "/search.json?q=login+error" {
5356
t.Errorf("expected '/search.json?q=login+error', got '%s'", got)
5457
}
@@ -68,6 +71,9 @@ func TestSearch(t *testing.T) {
6871
err := searchCmd.RunE(searchCmd, []string{"foo&bar=baz"})
6972
assertExitCode(t, err, 0)
7073

74+
if len(mock.GetWithPaginationCalls) != 1 {
75+
t.Fatalf("expected 1 GET call, got %d", len(mock.GetWithPaginationCalls))
76+
}
7177
if got := mock.GetWithPaginationCalls[0].Path; got != "/search.json?q=foo%26bar%3Dbaz" {
7278
t.Errorf("expected URL-encoded q, got '%s'", got)
7379
}
@@ -88,6 +94,9 @@ func TestSearch(t *testing.T) {
8894
err := searchCmd.RunE(searchCmd, []string{"bug"})
8995
assertExitCode(t, err, 0)
9096

97+
if len(mock.GetWithPaginationCalls) != 1 {
98+
t.Fatalf("expected 1 GET call, got %d", len(mock.GetWithPaginationCalls))
99+
}
91100
if got := mock.GetWithPaginationCalls[0].Path; got != "/search.json?q=bug" {
92101
t.Errorf("expected no board params in path, got '%s'", got)
93102
}

0 commit comments

Comments
 (0)