-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathroot.go
More file actions
52 lines (42 loc) · 1.2 KB
/
root.go
File metadata and controls
52 lines (42 loc) · 1.2 KB
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
47
48
49
50
51
52
// Copyright (c) Codesphere Inc.
// SPDX-License-Identifier: Apache-2.0
package cmd
import (
"log"
"os"
"github.com/codesphere-cloud/cs-go/pkg/io"
"github.com/spf13/cobra"
)
type GlobalOptions struct {
OmsPortalApiKey string
}
// GetRootCmd adds all child commands to the root command and sets flags appropriately.
func GetRootCmd() *cobra.Command {
opts := GlobalOptions{}
rootCmd := &cobra.Command{
Use: "oms",
Short: "Codesphere Operations Management System (OMS)",
Long: io.Long(`Codesphere Operations Management System (OMS)
This command can be used to run common tasks related to managing codesphere installations,
like downloading new versions.`),
}
AddVersionCmd(rootCmd)
AddUpdateCmd(rootCmd, opts)
AddListCmd(rootCmd, opts)
AddDownloadCmd(rootCmd, opts)
AddBetaCmd(rootCmd, &opts)
AddLicensesCmd(rootCmd)
// OMS API key management commands
AddRegisterCmd(rootCmd, opts)
AddRevokeCmd(rootCmd, opts)
return rootCmd
}
// Execute executes the root command. This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
//Disable printing timestamps on log lines
log.SetFlags(0)
err := GetRootCmd().Execute()
if err != nil {
os.Exit(1)
}
}