summaryrefslogtreecommitdiffstats
path: root/cmd/helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/helpers.go')
-rw-r--r--cmd/helpers.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/cmd/helpers.go b/cmd/helpers.go
new file mode 100644
index 0000000..f53f235
--- /dev/null
+++ b/cmd/helpers.go
@@ -0,0 +1,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)
+}