Skip to content

Commit

Permalink
Fixed bug with user confirmation exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderaleksic committed Feb 12, 2021
1 parent e218e6f commit cdc17e7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion command/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package command
import "github.com/urfave/cli/v2"

// Version is a version number.
var version = "0.1.5"
var version = "0.1.6"

func GetApp() *cli.App {
var applyCommand = ApplyCommand{}
Expand Down
2 changes: 1 addition & 1 deletion common/user_confirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func AskUserToConfirm() bool {
fmt.Print("insert y if you would like to continue: \n")
fmt.Print("insert y or yes if you would like to continue: \n")
input := bufio.NewScanner(os.Stdin)
input.Scan()
return input.Text() == "y" || input.Text() == "yes"
Expand Down
2 changes: 1 addition & 1 deletion migration/migration_reverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r Reverter) revert(migration history.AppliedStorageHistoryObject) error {
fmt.Printf("\t- key: %s, version: %s\n", obj.Key, obj.ToVersionId)
}
fmt.Printf("Are you sure you would like to continue?\n")
if common.AskUserToConfirm() {
if !common.AskUserToConfirm() {
fmt.Printf("Cancelled by user, will not delete objects.\n")
os.Exit(0)
}
Expand Down
2 changes: 1 addition & 1 deletion state/s3_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s S3State) ListAllObjects() ([]*s3.ObjectVersion, error) {

err := s.S3.ListObjectVersionsPages(&s3.ListObjectVersionsInput{
Bucket: aws.String(s.State.Bucket),
Prefix: aws.String(*s.State.Prefix),
Prefix: s.State.Prefix,
}, func(output *s3.ListObjectVersionsOutput, b bool) bool {
versions = append(versions, output.Versions...)
return output.NextKeyMarker != nil //Continue until no more pages
Expand Down

0 comments on commit cdc17e7

Please sign in to comment.