-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
executable file
·42 lines (36 loc) · 1.04 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
package main
import (
"fmt"
"log"
"github.com/flanksource/gitlab-multirepo-deployer/cmd"
"github.com/spf13/cobra"
)
var (
version = "dev"
)
func main() {
root := &cobra.Command{
Use: "gitlab-multirepo-deployer",
}
root.AddCommand(
cmd.Trigger,
cmd.Scan,
)
root.AddCommand(&cobra.Command{
Use: "version",
Short: "Print version info",
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
},
})
root.PersistentFlags().StringP("config", "c", "projects.yaml", "Path to config file")
root.PersistentFlags().StringP("branch", "b", "main", "branch to trigger against")
root.PersistentFlags().StringP("token", "t", "", "ci trigger token")
root.PersistentFlags().StringP("pat", "p", "", "personal access token for api calls")
root.PersistentFlags().StringP("token-file", "f", "", "file with key-value pairs of project specific tokens")
root.PersistentFlags().IntP("timeout", "o", 5, "timeout")
if err := root.Execute(); err != nil {
log.Fatalf("error running application: %s", err)
}
}