feat(bonfire): add FlagBool and read every bare switch with it (IN-04, quick-261028-rqd)
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -84,10 +83,8 @@ scheduled queue.`,
|
||||
Bare: true,
|
||||
}},
|
||||
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
|
||||
if v, ok := in.Flag("once"); ok {
|
||||
if once, _ := strconv.ParseBool(v); once {
|
||||
return scheduleRunOnce(ctx, app, plugins, scheduleNow(), out)
|
||||
}
|
||||
if bonfire.FlagBool(in, "once") {
|
||||
return scheduleRunOnce(ctx, app, plugins, scheduleNow(), out)
|
||||
}
|
||||
return withDB(ctx, app, func() error {
|
||||
return runScheduler(ctx, app, plugins, out)
|
||||
@@ -382,12 +379,8 @@ func clearQueue(ctx context.Context, app *backpack.App, queue string, out bonfir
|
||||
// --force is set (D-28). Off a terminal, under -n or -q and in
|
||||
// bonfire.Call it never asks. A "no" returns a Reported error (exit 1).
|
||||
func confirmProduction(app *backpack.App, in bonfire.Input, out bonfire.Output, question string) error {
|
||||
if in != nil {
|
||||
if v, ok := in.Flag("force"); ok {
|
||||
if force, _ := strconv.ParseBool(v); force {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if bonfire.FlagBool(in, "force") {
|
||||
return nil
|
||||
}
|
||||
if app == nil || app.Config == nil || app.Config.Environment() != "production" {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user