Skip to content

Commit

Permalink
version output
Browse files Browse the repository at this point in the history
  • Loading branch information
jakopako committed May 19, 2024
1 parent 81410c5 commit c58fb36
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log/slog"
"math"
"os"
"runtime/debug"
"sync"

"github.com/jakopako/goskyr/autoconfig"
Expand Down Expand Up @@ -48,17 +49,24 @@ func main() {
wordsDir := flag.String("w", "word-lists", "The directory that contains a number of files containing words of different languages. This is needed for the ML part (use with -e or -b).")
buildModel := flag.String("t", "", "Train a ML model based on the given csv features file. This will generate 2 files, goskyr.model and goskyr.class")
modelPath := flag.String("model", "", "Use a pre-trained ML model to infer names of extracted fields. Works in combination with the -g flag.")
debug := flag.Bool("debug", false, "Prints debug logs and writes scraped html's to files.")
debugFlag := flag.Bool("debug", false, "Prints debug logs and writes scraped html's to files.")

flag.Parse()

if *printVersion {
buildInfo, ok := debug.ReadBuildInfo()
if ok {
if buildInfo.Main.Version != "" {
fmt.Println(buildInfo.Main.Version)
return
}
}
fmt.Println(version)
return
}

var logLevel slog.Level
if *debug {
if *debugFlag {
logLevel = slog.LevelDebug
} else {
logLevel = slog.LevelInfo
Expand Down Expand Up @@ -162,7 +170,7 @@ func main() {
go func() {
for _, s := range config.Scrapers {
if *singleScraper == "" || *singleScraper == s.Name {
s.Debug = *debug
s.Debug = *debugFlag
sc <- s
}
}
Expand Down

0 comments on commit c58fb36

Please sign in to comment.