summaryrefslogtreecommitdiffstats
path: root/cmd/root.go
blob: e5939cadbad379b2f7beffc6e6d9de7668ddcb3a (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
28
29
30
31
32
package cmd

import (
	"fmt"
	"os"

	"git.db.org.ai/dborg/internal/utils"
	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "dborg",
	Short: "DB.org.ai CLI client",
	Long: `█▀▀▄ █▀▀▄   █▀▀█ █▀▀█ █▀▀▀   █▀▀█ ▀█▀
█░░█░█▀▀▄░░░█░░█░█▄▄▀░█░▀█░░░█▄▄█░░█
▀▀▀▀ ▀▀▀▀ ▀ ▀▀▀▀ ▀  ▀ ▀▀▀▀ ▀ ▀  ▀ ▀▀▀
DB.org.ai CLI client`,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return utils.CheckForUpdates(cmd)
	},
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}

func init() {
	rootCmd.PersistentFlags().StringP("api-key", "k", "", "API key for authentication (or set DBORG_API_KEY env var)")
}