-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroot_cmd.go
46 lines (41 loc) · 968 Bytes
/
root_cmd.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
package main
import (
"fmt"
"github.com/spf13/cobra"
"os"
)
var (
jiraAPIHost string
jiraAPIUsername string
jiraAPIToken string
)
var rootCmd = &cobra.Command{
Use: "issuez",
Short: "Importing Tickets to Jira from Markdown.",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Please use one of the subcommands.")
},
Version: "1.0.0-beta.01",
}
func init() {
rootCmd.PersistentFlags().StringVarP(
&jiraAPIHost, "api", "a", "", "JIRA host to use",
)
rootCmd.MarkPersistentFlagRequired("api")
rootCmd.PersistentFlags().StringVarP(
&jiraAPIUsername, "username", "u", "",
"Username to use to connect to JIRA",
)
rootCmd.MarkPersistentFlagRequired("username")
rootCmd.PersistentFlags().StringVarP(
&jiraAPIToken, "token", "t", "",
"API token to use to connect to JIRA",
)
rootCmd.MarkPersistentFlagRequired("token")
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}