Add _is_beta flag to config file

This commit is contained in:
Arturo Filastò
2018-07-30 18:51:44 +02:00
parent f343a2a1bd
commit 247d128b19
4 changed files with 37 additions and 20 deletions
+15
View File
@@ -2,6 +2,7 @@ package onboard
import (
"github.com/alecthomas/kingpin"
"github.com/apex/log"
"github.com/ooni/probe-cli/internal/cli/root"
"github.com/ooni/probe-cli/internal/onboard"
)
@@ -9,12 +10,26 @@ import (
func init() {
cmd := root.Command("onboard", "Starts the onboarding process")
yes := cmd.Flag("yes", "Answer yes to all the onboarding questions.").Bool()
cmd.Action(func(_ *kingpin.ParseContext) error {
ctx, err := root.Init()
if err != nil {
return err
}
if *yes == true {
ctx.Config.Lock()
ctx.Config.InformedConsent = true
ctx.Config.Unlock()
if err := ctx.Config.Write(); err != nil {
log.WithError(err).Error("failed to write config file")
return err
}
return nil
}
return onboard.Onboarding(ctx.Config)
})
}