feat: add "key-rotate" command (#709)

This commit is contained in:
Alessandro (Ale) Segala
2025-07-03 13:23:24 -07:00
committed by GitHub
parent 15ece0ab30
commit 8c8fc2304d
9 changed files with 465 additions and 87 deletions

View File

@@ -0,0 +1,24 @@
package utils
import (
"bufio"
"fmt"
"os"
"strings"
)
// PromptForConfirmation prompts the user to answer "y" in the terminal
func PromptForConfirmation(prompt string) (bool, error) {
fmt.Print(prompt + " [y/N]: ")
reader := bufio.NewReader(os.Stdin)
r, err := reader.ReadString('\n')
if err != nil {
return false, fmt.Errorf("failed to read response: %w", err)
}
r = strings.TrimSpace(strings.ToLower(r))
ok := r == "yes" || r == "y"
return ok, nil
}