-
Notifications
You must be signed in to change notification settings - Fork 435
/
Copy pathmain.go
70 lines (57 loc) · 1.4 KB
/
main.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
_ "github.com/spf13/viper/remote"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/doc"
)
func init() {
mainCmd.AddCommand(versionCmd)
mainCmd.AddCommand(updateCmd)
mainCmd.AddCommand(uptodateCmd)
mainCmd.AddCommand(databaseCmd)
mainCmd.AddCommand(startCmd)
mainCmd.AddCommand(configCmd)
mainCmd.AddCommand(downloadCmd)
mainCmd.AddCommand(docCmd) // hidden command
}
func main() {
if err := mainCmd.Execute(); err != nil {
os.Exit(1)
}
}
var mainCmd = &cobra.Command{
Use: "engine",
Short: "CDS Engine",
Long: `
CDS
Continuous Delivery Service
Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform
https://ovh.github.io/cds/
## Download
You will find latest release of CDS ` + "`engine`" + ` on [Github Releases](https://github.com/ovh/cds/releases/latest).
`,
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Display CDS version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(sdk.VersionString())
},
}
var docCmd = &cobra.Command{
Use: "doc <generation-path> <git-directory>",
Short: "generate hugo doc for building http://ovh.github.com/cds",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 2 {
cmd.Usage()
os.Exit(1)
}
if err := doc.GenerateDocumentation(mainCmd, args[0], args[1]); err != nil {
sdk.Exit(err.Error())
}
},
}