Skip to content

Commit

Permalink
Revert breaking change introduced by #235 (#248)
Browse files Browse the repository at this point in the history
Drop command shouldn't need a confirmation, but we should help
to prevent bad mistakes.
  • Loading branch information
stanislas-m committed Sep 20, 2018
1 parent 104ee93 commit aa008a3
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions soda/cmd/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ package cmd

import (
"fmt"
"strings"

"bufio"
"os"

"github.com/gobuffalo/pop"
"github.com/spf13/cobra"
)

var all bool
var confirmed bool

var dropCmd = &cobra.Command{
Use: "drop",
Expand All @@ -25,18 +22,6 @@ var dropCmd = &cobra.Command{
os.Exit(1)
}

if !confirmed {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Do you really want to drop the database [y/N]? ")
r, _ := reader.ReadString('\n')
r = strings.TrimSpace(r)
if r != "y" && r != "Y" {
fmt.Println("Aborting due to lack of user confirmation.")
os.Exit(0)
}

}

if all {
for _, conn := range pop.Connections {
err = pop.DropDB(conn)
Expand All @@ -54,6 +39,5 @@ var dropCmd = &cobra.Command{

func init() {
dropCmd.Flags().BoolVarP(&all, "all", "a", false, "Drops all of the databases in the database.yml")
dropCmd.Flags().BoolVarP(&confirmed, "yes", "y", false, "Runs without asking the user for confirmation")
RootCmd.AddCommand(dropCmd)
}

0 comments on commit aa008a3

Please sign in to comment.