summaryrefslogtreecommitdiffstats
path: root/cmd/sl.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/sl.go')
-rw-r--r--cmd/sl.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/cmd/sl.go b/cmd/sl.go
index c30725a..8c43506 100644
--- a/cmd/sl.go
+++ b/cmd/sl.go
@@ -3,8 +3,6 @@ package cmd
import (
"fmt"
- "git.db.org.ai/dborg/internal/client"
- "git.db.org.ai/dborg/internal/config"
"git.db.org.ai/dborg/internal/formatter"
"git.db.org.ai/dborg/internal/models"
"github.com/spf13/cobra"
@@ -30,9 +28,7 @@ func init() {
}
func runSLSearch(cmd *cobra.Command, args []string) error {
- cfg := config.New()
-
- c, err := client.New(cfg)
+ c, err := newClient()
if err != nil {
return err
}
@@ -57,8 +53,8 @@ func runSLSearch(cmd *cobra.Command, args []string) error {
return err
}
- if response.Error != "" {
- return fmt.Errorf("API error: %s", response.Error)
+ if err := checkError(response.Error); err != nil {
+ return err
}
if params.Format != "json" {
@@ -70,6 +66,6 @@ func runSLSearch(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- fmt.Print(output)
+ printOutput(output)
return nil
}