MCPcopy
hub / github.com/genuinetools/img / Run

Method Run

remove.go:46–74  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

44}
45
46func (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}

Callers 1

newRemoveCommandFunction · 0.95

Calls 4

NewFunction · 0.92
reexecFunction · 0.85
CloseMethod · 0.80
RemoveImageMethod · 0.80

Tested by

no test coverage detected