Skip to content

Commit

Permalink
Add version flag to worker command
Browse files Browse the repository at this point in the history
[skip-codecov]
  • Loading branch information
jraddaoui committed May 21, 2024
1 parent 0ce0188 commit 0ea2e92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ import (
"github.com/artefactual-sdps/preprocessing-sfa/internal/version"
)

const appName = "preprocessing-sfa-worker"

func main() {
p := pflag.NewFlagSet(workercmd.Name, pflag.ExitOnError)
p.String("config", "", "Configuration file")
p.Bool("version", false, "Show version information")
if err := p.Parse(os.Args[1:]); err == flag.ErrHelp {
os.Exit(1)
} else if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

if v, _ := p.GetBool("version"); v {
fmt.Println(version.Info(appName))
os.Exit(0)
}

var cfg config.Configuration
configFile, _ := p.GetString("config")
configFileFound, configFileUsed, err := config.Read(&cfg, configFile)
Expand Down

0 comments on commit 0ea2e92

Please sign in to comment.