-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (39 loc) · 910 Bytes
/
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
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"github.com/Chyroc/generate_blog_by_issues/internal"
)
var version = "v0.3.0"
func getCommandLine() (string, string, []byte) {
repo := flag.String("repo", "", "where the repo is")
token := flag.String("token", "", "github token")
config := flag.String("config", "", "json config file")
v := flag.Bool("v", false, "generate_blog_by_issues version")
flag.Parse()
if *v {
fmt.Printf("generate_blog_by_issues %s\n", version)
os.Exit(0)
}
if *repo == "" {
log.Fatal("must set github repo where issue is")
}
if *token == "" {
log.Fatal("must set github token")
}
if *config == "" {
log.Fatal("must set json config file")
}
file, err := ioutil.ReadFile(*config)
if err != nil {
log.Fatal(err)
}
return *repo, *token, file
}
func main() {
repo, token, config := getCommandLine()
internal.Run(repo, token, config)
}