Allow to specify custom software name and version (#94)

In turn, this allows us to identify as ooniprobe-cli v3.0.0-rc.5.

Closes #41.
This commit is contained in:
Simone Basso
2019-12-29 14:07:57 +01:00
committed by GitHub
parent c4a87eaab7
commit 1e8b482c23
4 changed files with 18 additions and 7 deletions
+8 -1
View File
@@ -25,6 +25,13 @@ func init() {
isVerbose := Cmd.Flag("verbose", "Enable verbose log output.").Short('v').Bool()
isBatch := Cmd.Flag("batch", "Enable batch command line usage.").Bool()
softwareName := Cmd.Flag(
"software-name", "Override application name",
).Default("ooniprobe-cli").String()
softwareVersion := Cmd.Flag(
"software-version", "Override the application version",
).Default(version.Version).String()
Cmd.PreAction(func(ctx *kingpin.ParseContext) error {
if *isBatch {
log.SetHandler(batch.Default)
@@ -45,7 +52,7 @@ func init() {
}
ctx := ooni.NewContext(*configPath, homePath)
err = ctx.Init()
err = ctx.Init(*softwareName, *softwareVersion)
if err != nil {
return nil, err
}