Skip to content

Commit

Permalink
fix: Honour 'ctrl+c' in the UI progress model
Browse files Browse the repository at this point in the history
Also, fixes a minor bug in deployment deletion
  • Loading branch information
Praveenrajmani committed May 4, 2023
1 parent 5c14dd1 commit 1b8376e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/kubectl-directpv/progress_model.go
Expand Up @@ -82,6 +82,11 @@ func (m progressModel) Init() tea.Cmd {

func (m progressModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
if msg.String() == "ctrl+c" {
return m, tea.Batch(tea.Sequence(finalPause(), tea.Quit))
}
return m, nil
case tea.WindowSizeMsg:
if m.model != nil {
m.model.Width = msg.Width - padding*2 - 4
Expand Down
6 changes: 5 additions & 1 deletion pkg/installer/deployment.go
Expand Up @@ -275,7 +275,11 @@ func doDeleteDeployment(ctx context.Context, name string) error {
return err
}

return deploymentClient.Delete(ctx, name, metav1.DeleteOptions{})
if err = deploymentClient.Delete(ctx, name, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
return err
}

return nil
}

func deleteDeployment(ctx context.Context) error {
Expand Down

0 comments on commit 1b8376e

Please sign in to comment.