Respect -y for packwiz init (#290)

This commit is contained in:
James Groom 2024-04-21 11:41:22 +00:00 committed by GitHub
parent 7545d9a777
commit 069d32c5de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -222,6 +222,10 @@ func init() {
func initReadValue(prompt string, def string) string { func initReadValue(prompt string, def string) string {
fmt.Print(prompt) fmt.Print(prompt)
if viper.GetBool("non-interactive") {
fmt.Printf("%s\n", def)
return def
}
value, err := bufio.NewReader(os.Stdin).ReadString('\n') value, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil { if err != nil {
fmt.Printf("Error reading input: %s\n", err) fmt.Printf("Error reading input: %s\n", err)