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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package cmd
import (
"fmt"
"os"
"git.db.org.ai/dborg/internal/utils"
"github.com/spf13/cobra"
)
var (
jsonOutput bool
debugOutput bool
)
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().BoolVarP(&jsonOutput, "json", "j", false, "Output raw JSON instead of formatted text")
rootCmd.PersistentFlags().BoolVarP(&debugOutput, "debug", "d", false, "Enable debug output (shows raw API responses)")
}
func IsJSONOutput() bool {
return jsonOutput
}
func IsDebugOutput() bool {
return debugOutput
}
|