forked from SkobelevIgor/stackexchange-xml-converter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
executable file
·27 lines (22 loc) · 976 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
package main
import (
"flag"
"log"
"github.com/SkobelevIgor/stackexchange-xml-converter/converter"
)
func main() {
var cfg converter.Config
flag.StringVar(&cfg.ResultFormat, "result-format", "", "Result format (csv or json)")
flag.StringVar(&cfg.SourcePath, "source-path", "", "Path to XML file(s)")
flag.StringVar(&cfg.StoreToDir, "store-to-dir", "", "Path where to store CSV file(s)")
flag.BoolVar(&cfg.SkipHTMLDecoding, "skip-html-decoding", false, "Path where to store CSV file(s)")
flag.StringVar(&cfg.FilterByTagId, "filter-by-tag-id", "", "Filter for tags, space sperated list")
flag.BoolVar(&cfg.FilterExactMatch, "filter-no-exact-match", false, "Match tags that contain the keywords specified by filter-by-tag-id instead of matching by exact matches only")
flag.BoolVar(&cfg.JsonOneLine, "json-one-line", false, "Save json file as one object per line")
flag.Parse()
var err error
err = converter.Convert(cfg)
if err != nil {
log.Fatal(err)
}
}