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

Method Run

tag.go:49–75  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

47}
48
49func (cmd *tagCommand) Run(args []string) (err error) {
50 reexec()
51
52 // Get the specified image and target.
53 cmd.image = args[0]
54 cmd.target = args[1]
55
56 // Create the context.
57 id := identity.NewID()
58 ctx := session.NewContext(context.Background(), id)
59 ctx = namespaces.WithNamespace(ctx, "buildkit")
60
61 // Create the client.
62 c, err := client.New(stateDir, backend, nil)
63 if err != nil {
64 return err
65 }
66 defer c.Close()
67
68 if err := c.TagImage(ctx, cmd.image, cmd.target); err != nil {
69 return err
70 }
71
72 fmt.Printf("Successfully tagged %s as %s\n", cmd.image, cmd.target)
73
74 return nil
75}

Callers 2

newTagCommandFunction · 0.95
TestMainFunction · 0.45

Calls 4

NewFunction · 0.92
reexecFunction · 0.85
CloseMethod · 0.80
TagImageMethod · 0.80

Tested by 1

TestMainFunction · 0.36