replaced archived survey dep with osutils.YesNoPrompt helper

This commit is contained in:
Gani Georgiev
2025-01-21 21:03:35 +02:00
parent a4a228b368
commit 91d4ca5c06
8 changed files with 112 additions and 63 deletions
+6 -10
View File
@@ -5,9 +5,9 @@ import (
"strings"
"time"
"github.com/AlecAivazis/survey/v2"
"github.com/fatih/color"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/tools/osutils"
"github.com/spf13/cast"
)
@@ -80,15 +80,11 @@ func (r *MigrationsRunner) Run(args ...string) error {
return err
}
confirm := false
prompt := &survey.Confirm{
Message: fmt.Sprintf(
"\n%v\nDo you really want to revert the last %d applied migration(s)?",
strings.Join(names, "\n"),
toRevertCount,
),
}
survey.AskOne(prompt, &confirm)
confirm := osutils.YesNoPrompt(fmt.Sprintf(
"\n%v\nDo you really want to revert the last %d applied migration(s)?",
strings.Join(names, "\n"),
toRevertCount,
), false)
if !confirm {
fmt.Println("The command has been cancelled")
return nil