MCPcopy Create free account
hub / github.com/containerd/nerdctl / pruneOptions

Function pruneOptions

cmd/nerdctl/system/system_prune.go:50–81  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

48}
49
50func pruneOptions(cmd *cobra.Command) (types.SystemPruneOptions, error) {
51 globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
52 if err != nil {
53 return types.SystemPruneOptions{}, err
54 }
55
56 all, err := cmd.Flags().GetBool("all")
57 if err != nil {
58 return types.SystemPruneOptions{}, err
59 }
60
61 vFlag, err := cmd.Flags().GetBool("volumes")
62 if err != nil {
63 return types.SystemPruneOptions{}, err
64 }
65
66 buildkitHost, err := builder.GetBuildkitHost(cmd, globalOptions.Namespace)
67 if err != nil {
68 log.L.WithError(err).Warn("BuildKit is not running. Build caches will not be pruned.")
69 buildkitHost = ""
70 }
71
72 return types.SystemPruneOptions{
73 Stdout: cmd.OutOrStdout(),
74 Stderr: cmd.ErrOrStderr(),
75 GOptions: globalOptions,
76 All: all,
77 Volumes: vFlag,
78 BuildKitHost: buildkitHost,
79 NetworkDriversToKeep: network.NetworkDriversToKeep,
80 }, nil
81}
82
83func grantSystemPrunePermission(cmd *cobra.Command, options types.SystemPruneOptions) (bool, error) {
84 force, err := cmd.Flags().GetBool("force")

Callers 1

pruneActionFunction · 0.70

Calls 2

ProcessRootCmdFlagsFunction · 0.92
GetBuildkitHostFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…