refactor: move Confirm logic to common place from caddy deployment

This commit is contained in:
Pavel Sviderski
2025-03-15 20:42:44 +10:00
parent a907fdb1af
commit c7355afa3d
2 changed files with 24 additions and 22 deletions
+23
View File
@@ -0,0 +1,23 @@
package cli
import "github.com/charmbracelet/huh"
func Confirm() (bool, error) {
var confirmed bool
form := huh.NewForm(
huh.NewGroup(
huh.NewConfirm().
Title(
"Do you want to continue?",
).
Affirmative("Yes!").
Negative("No").
Value(&confirmed),
),
)
if err := form.Run(); err != nil {
return false, err
}
return confirmed, nil
}