Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cmd/bbctl/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var deleteCommand = &cli.Command{
&cli.BoolFlag{
Name: "force",
Aliases: []string{"f"},
Usage: "Force delete the bridge, even if it's not self-hosted or doesn't seem to exist.",
Usage: "Force delete the bridge without confirmation, even if it's not self-hosted or doesn't seem to exist.",
},
},
}
Expand Down Expand Up @@ -79,12 +79,14 @@ func deleteBridge(ctx *cli.Context) error {
}
}

var confirmation bool
err = survey.AskOne(&survey.Confirm{Message: fmt.Sprintf("Are you sure you want to permanently delete %s?", bridge)}, &confirmation)
if err != nil {
return err
} else if !confirmation {
return fmt.Errorf("bridge delete cancelled")
if !ctx.Bool("force") {
var confirmation bool
err = survey.AskOne(&survey.Confirm{Message: fmt.Sprintf("Are you sure you want to permanently delete %s?", bridge)}, &confirmation)
if err != nil {
return err
} else if !confirmation {
return fmt.Errorf("bridge delete cancelled")
}
}
err = beeperapi.DeleteBridge(homeserver, bridge, accessToken)
if err != nil {
Expand Down