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

Function pkgCmd

src/cmd/linuxkit/pkg.go:15–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13)
14
15func pkgCmd() *cobra.Command {
16 var (
17 argDisableCache bool
18 argEnableCache bool
19 argNoNetwork bool
20 argNetwork bool
21 argOrg string
22 buildYML string
23 hash string
24 hashCommit string
25 hashPath string
26 dirty bool
27 devMode bool
28 tag string
29 )
30
31 cmd := &cobra.Command{
32 Use: "pkg",
33 Short: "package building and pushing",
34 Long: `Package building and pushing.`,
35 PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
36 if parent := cmd.Parent(); parent != nil {
37 if parent.PersistentPreRunE != nil {
38 if err := parent.PersistentPreRunE(parent, args); err != nil {
39 return err
40 }
41 }
42 }
43
44 pkglibConfig = pkglib.PkglibConfig{
45 BuildYML: buildYML,
46 Hash: hash,
47 HashCommit: hashCommit,
48 HashPath: hashPath,
49 Dirty: dirty,
50 Dev: devMode,
51 }
52 if cmd.Flags().Changed("disable-cache") && cmd.Flags().Changed("enable-cache") {
53 return errors.New("cannot set but disable-cache and enable-cache")
54 }
55
56 if cmd.Flags().Changed("nonetwork") && cmd.Flags().Changed("network") {
57 return errors.New("cannot set but nonetwork and network")
58 }
59
60 // these should be set only for overrides
61 if cmd.Flags().Changed("disable-cache") {
62 pkglibConfig.DisableCache = &argDisableCache
63 }
64 if cmd.Flags().Changed("enable-cache") {
65 val := !argEnableCache
66 pkglibConfig.DisableCache = &val
67 }
68 if cmd.Flags().Changed("nonetwork") {
69 val := !argNoNetwork
70 pkglibConfig.Network = &val
71 }
72 if cmd.Flags().Changed("network") {

Callers 1

newCmdFunction · 0.85

Calls 6

pkgBuildCmdFunction · 0.85
pkgBuilderCmdFunction · 0.85
pkgPushCmdFunction · 0.85
pkgShowTagCmdFunction · 0.85
pkgManifestCmdFunction · 0.85
pkgRemoteTagCmdFunction · 0.85

Tested by

no test coverage detected