diff options
| author | s <[email protected]> | 2025-11-13 22:25:02 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-13 22:25:02 -0500 |
| commit | 07662d9403eb85b39e1ffcf91014bbf36efd1c5a (patch) | |
| tree | 1181435223899bae039a947c5fc4fdeec085f91b /cmd/npd.go | |
| parent | 239936e87183a10a33ce593709eb16c92a04af98 (diff) | |
| download | dborg-07662d9403eb85b39e1ffcf91014bbf36efd1c5a.tar.gz dborg-07662d9403eb85b39e1ffcf91014bbf36efd1c5a.zip | |
refactor: break down large osint.go file into separate command modules and add helper functionsv1.0.1
Diffstat (limited to 'cmd/npd.go')
| -rw-r--r-- | cmd/npd.go | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -1,10 +1,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" @@ -44,9 +40,7 @@ func init() { } func runNPDSearch(cmd *cobra.Command, args []string) error { - cfg := config.New() - - c, err := client.New(cfg) + c, err := newClient() if err != nil { return err } @@ -80,14 +74,14 @@ func runNPDSearch(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 } output, err := formatter.FormatNPDResults(response, IsJSONOutput()) if err != nil { return err } - fmt.Print(output) + printOutput(output) return nil } |
