@@ -24,7 +24,7 @@ type DeleteCmd[T any] struct {
2424 NameSuggestions func (client hcapi2.Client ) func () []string
2525 AdditionalFlags func (* cobra.Command )
2626 Fetch FetchFunc [T ]
27- Delete func (s state.State , cmd * cobra.Command , resource T ) (* hcloud.Action , error )
27+ Delete func (s state.State , cmd * cobra.Command , resource T ) ([] * hcloud.Action , error )
2828
2929 // FetchFunc is a factory function that produces [DeleteCmd.Fetch]. Should be set in case the resource has
3030 // more than a single identifier that is used in the positional arguments.
@@ -115,7 +115,7 @@ func (dc *DeleteCmd[T]) Run(s state.State, cmd *cobra.Command, args []string) er
115115
116116 for batch := range slices .Chunk (toDelete , deleteBatchSize ) {
117117 results := make ([]util.ResourceState , len (batch ))
118- actions := make ( []* hcloud.Action , 0 , len ( batch ))
118+ var actions []* hcloud.Action
119119
120120 for i , idOrName := range batch {
121121 results [i ] = util.ResourceState {IDOrName : idOrName }
@@ -130,14 +130,12 @@ func (dc *DeleteCmd[T]) Run(s state.State, cmd *cobra.Command, args []string) er
130130 continue
131131 }
132132
133- action , err := dc .Delete (s , cmd , resource )
133+ deleteActions , err := dc .Delete (s , cmd , resource )
134134 if err != nil {
135135 results [i ].Error = err
136136 continue
137137 }
138- if action != nil {
139- actions = append (actions , action )
140- }
138+ actions = append (actions , deleteActions ... )
141139 }
142140
143141 for _ , result := range results {
0 commit comments