summaryrefslogtreecommitdiffstats
path: root/cmd/helpers.go
blob: f53f235d238b398694c6ad8b4ccf38029e48bdf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cmd

import (
	"fmt"

	"git.db.org.ai/dborg/internal/client"
	"git.db.org.ai/dborg/internal/config"
)

func newClient() (*client.Client, error) {
	return client.New(config.New())
}

func newUnauthenticatedClient() (*client.Client, error) {
	return client.NewUnauthenticated(config.New())
}

func checkError(errorMsg string) error {
	if errorMsg != "" {
		return fmt.Errorf("API error: %s", errorMsg)
	}
	return nil
}

func printOutput(output string) {
	fmt.Print(output)
}