diff --git a/Dockerfile b/Dockerfile index ab656d0..8586a12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM golang:1.17-alpine -RUN apk add poppler-utils gcc musl-dev xmlstarlet libxml2-utils +RUN apk add bash poppler-utils gcc musl-dev xmlstarlet libxml2-utils # build WORKDIR /app diff --git a/README.md b/README.md index d4d0305..f645d43 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ ### Install it on local 1. Download the latest Sisyphe-go version -2. Just do : `go build .` +2. Just do : `go build .` 3. ... that's it. ### Help @@ -31,12 +31,13 @@ ### Options - --help Output usage - -c Configuration folder path - -n Corpus name (default "test") - -o Output directory where results are written - -p Corpus path - -w Counting word on pdf + --help Output usage + -c Configuration folder path + -n Corpus name (default "test") + -o Output directory where results are written + -p Corpus path + -w Counting word on pdf + -noindex Disable indexation after process ### How it works ? @@ -58,5 +59,5 @@ ### Modules -- XML -Usage of poppler function (`pdftotext` and `pdfinfo`) +- XML + Usage of poppler function (`pdftotext` and `pdfinfo`) diff --git a/main.go b/main.go index 1892a38..da36f95 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ var corpusName = flag.String("n", "test", "Corpus name") var configurationFolder = flag.String("c", "", "Configuration folder path") var withWordCount = flag.Bool("w", false, "Enable word count") +var noIndexation = flag.Bool("noindex", false, "Disable indexation after process") // regex var regexMime = regexp.MustCompile(`(.*); charset=(.*)`) @@ -194,9 +195,13 @@ log.Println(color.Green + "End of program with " + strconv.Itoa(numberFiles) + " files processed" + color.Reset) log.Printf("Total time %s", elapsed) - _, err := exec.Command("/bin/bash", "indexCorpus.sh", logPath+"/analyse-logs.json", importType).CombinedOutput() - if err != nil { - fmt.Println(color.InRed("Error indexCorpus.sh")) - panic(err) + // after process index analyze file + if !*noIndexation { + log.Println(color.InBlue("Run indexation process")) + _, err := exec.Command("/bin/bash", "indexCorpus.sh", logPath+"/analyse-logs.json", importType).CombinedOutput() + if err != nil { + fmt.Println(color.InRed("Error indexCorpus.sh")) + panic(err) + } } }