Skip to content

Commit

Permalink
feat: Bypass confirmation dialog railway down (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guergeiro authored Sep 13, 2022
1 parent 112651c commit bbee757
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ func (h *Handler) Down(ctx context.Context, req *entity.CommandRequest) error {
return err
}

shouldDelete, err := ui.PromptYesNo(fmt.Sprintf("Delete latest deployment for project %s?", project.Name))
if err != nil || !shouldDelete {
return err
bypass, err := req.Cmd.Flags().GetBool("yes")
if err != nil {
bypass = false
}
if !bypass {
shouldDelete, err := ui.PromptYesNo(fmt.Sprintf("Delete latest deployment for project %s?", project.Name))
if err != nil || !shouldDelete {
return err
}
}

err = h.ctrl.Down(ctx, &entity.DownRequest{
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ func init() {
})

downCmd.Flags().StringP("environment", "e", "", "Specify an environment to delete from")
downCmd.Flags().Bool("yes", false, "Skip all confirmation dialogs")

addRootCmd(&cobra.Command{
Use: "logs",
Expand Down

0 comments on commit bbee757

Please sign in to comment.