Exit with non-zero code when trying to do interactive onboarding and --batch is set
This commit is contained in:
@@ -13,7 +13,8 @@ func Run() {
|
||||
root.Cmd.Version(ooni.Version)
|
||||
_, err := root.Cmd.Parse(os.Args[1:])
|
||||
if err != nil {
|
||||
log.WithError(err).Error("failed to parse arguments")
|
||||
log.WithError(err).Error("failure in main command")
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package onboard
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/internal/cli/root"
|
||||
@@ -29,6 +31,9 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if ctx.IsBatch == true {
|
||||
return errors.New("cannot do onboarding in batch mode")
|
||||
}
|
||||
|
||||
return onboard.Onboarding(ctx.Config)
|
||||
})
|
||||
|
||||
@@ -48,6 +48,9 @@ func init() {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if *isBatch {
|
||||
ctx.IsBatch = true
|
||||
}
|
||||
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user