...
1
2
3 package runhcs
4
5 import (
6 "context"
7 )
8
9
10 type DeleteOpts struct {
11
12 Force bool
13 }
14
15 func (opt *DeleteOpts) args() ([]string, error) {
16 var out []string
17 if opt.Force {
18 out = append(out, "--force")
19 }
20 return out, nil
21 }
22
23
24
25 func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) error {
26 args := []string{"delete"}
27 if opts != nil {
28 oargs, err := opts.args()
29 if err != nil {
30 return err
31 }
32 args = append(args, oargs...)
33 }
34 return r.runOrError(r.command(context, append(args, id)...))
35 }
36
View as plain text