Skip to content

Commit

Permalink
added basic sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurvinder Singh committed Apr 23, 2017
1 parent c2f206f commit 409f4f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const srcExtension = "pep.xml"

var (
pepxml = flag.String("pepxml", "test.pep.xml", "path to the pepxml file to index")
pepxml = flag.String("pepxml", "", "path to the pepxml file to index")
host = flag.String("host", "http://localhost:9200", "Elasticsearch host with port and protocol information")
index = flag.String("index", "promec", "Index name in elasticsearch where xml data will be indexed")
dataType = flag.String("datatype", "search_hit", "Data type to be used under index")
Expand Down Expand Up @@ -47,6 +47,12 @@ func main() {
log.SetLevel(lvl)
}

if *dirName == "" && *pepxml == "" {
log.Fatal("Provide atleast directory path or Pep XML file to index")
} else if *dirName != "" && *pepxml != "" {
log.Fatal("Provide only one directory path or Pep XML file to index, not both")
}

interval := time.Duration(*sleepInterval)

// Create elasticsearch client
Expand Down

0 comments on commit 409f4f0

Please sign in to comment.