Skip to content

Commit

Permalink
fix: update based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantam committed Jul 12, 2023
1 parent 26856f8 commit 7fbea81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/store/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ var deleteCmd = &cobra.Command{
// First, confirm whether this is intended
force, err := cmd.Flags().GetBool("force")
if err != nil {
return fmt.Errorf("failed to obtain force flag %w", err)
return fmt.Errorf("failed to parse force flag due to %w", err)
}
if !force {
confirmation, err := confirmation.AskForConfirmation("Confirm you want to delete store:")
confirmation, err := confirmation.AskForConfirmation("Are you sure you want to delete the store:")
if err != nil {
return fmt.Errorf("prompt failed due to %w", err)
}
Expand Down
4 changes: 1 addition & 3 deletions internal/confirmation/confirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ func askForConfirmation(ioReader *bufio.Reader, question string) (bool, error) {

trimmedString := strings.ToLower(strings.TrimSpace(s))
switch trimmedString {
case "":
return false, nil
case "y", "yes":
return true, nil
case "n", "no":
case "n", "no", "":
return false, nil
}
}
Expand Down

0 comments on commit 7fbea81

Please sign in to comment.