MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / pkgShowTagCmd

Function pkgShowTagCmd

src/cmd/linuxkit/pkg_showtag.go:10–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8)
9
10func pkgShowTagCmd() *cobra.Command {
11 var canonical bool
12 cmd := &cobra.Command{
13 Use: "show-tag",
14 Short: "show the tag for packages based on its source directory",
15 Long: `Show the tag for one or more packages based on their source directories.
16 'path' specifies the path to the package source directory.
17`,
18 Args: cobra.MinimumNArgs(1),
19 Example: "linuxkit pkg show-tag path/to/package [path/to/another/package] [path/to/yet/another/package]",
20 RunE: func(cmd *cobra.Command, args []string) error {
21 pkgs, err := pkglib.NewFromConfig(pkglibConfig, args...)
22 if err != nil {
23 return err
24 }
25 for _, p := range pkgs {
26 tag := p.Tag()
27 if canonical {
28 tag = p.FullTag()
29 }
30 fmt.Println(tag)
31 }
32 return nil
33 },
34 }
35 cmd.Flags().BoolVar(&canonical, "canonical", false, "Show canonical name, e.g. docker.io/linuxkit/foo:1234, instead of the default, e.g. linuxkit/foo:1234")
36
37 return cmd
38}

Callers 1

pkgCmdFunction · 0.85

Calls 2

FullTagMethod · 0.80
TagMethod · 0.65

Tested by

no test coverage detected