Skip to content

Commit 42791cb

Browse files
authored
Merge pull request #2 from nmemoto/fix-no-results-case
Consider the case when there are no results that match the search criteria.
2 parents d059e61 + 9e90e6b commit 42791cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ var rootCmd = &cobra.Command{
7373
fmt.Fprintf(os.Stderr, "HTML Parse error: %v", err)
7474
return err
7575
}
76+
if len(repos) == 0 {
77+
fmt.Fprintln(os.Stdout, "No Results.")
78+
return nil
79+
}
7680

7781
if mode == "json" {
7882
jsonBytes, err := json.Marshal(repos)
@@ -119,7 +123,6 @@ var rootCmd = &cobra.Command{
119123
}
120124

121125
i, _, err := prompt.Run()
122-
123126
if err != nil {
124127
fmt.Printf("Prompt failed %v\n", err)
125128
return err

0 commit comments

Comments
 (0)