(args []string)
| 44 | } |
| 45 | |
| 46 | func (cmd *removeCommand) Run(args []string) (err error) { |
| 47 | reexec() |
| 48 | |
| 49 | // Create the context. |
| 50 | id := identity.NewID() |
| 51 | ctx := session.NewContext(context.Background(), id) |
| 52 | ctx = namespaces.WithNamespace(ctx, "buildkit") |
| 53 | |
| 54 | // Create the client. |
| 55 | c, err := client.New(stateDir, backend, nil) |
| 56 | if err != nil { |
| 57 | return err |
| 58 | } |
| 59 | defer c.Close() |
| 60 | |
| 61 | // Loop over the arguments as images and run remove. |
| 62 | for _, image := range args { |
| 63 | fmt.Printf("Removing %s...\n", image) |
| 64 | |
| 65 | err = c.RemoveImage(ctx, image) |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | |
| 70 | fmt.Printf("Successfully removed %s\n", image) |
| 71 | } |
| 72 | |
| 73 | return nil |
| 74 | } |
no test coverage detected