2016-09-22 17:04:34 -04:00
|
|
|
package prune
|
|
|
|
|
|
|
|
import (
|
2017-04-17 18:07:56 -04:00
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/docker/cli/cli/command/container"
|
|
|
|
"github.com/docker/cli/cli/command/image"
|
|
|
|
"github.com/docker/cli/cli/command/network"
|
|
|
|
"github.com/docker/cli/cli/command/volume"
|
2016-12-07 17:02:13 -05:00
|
|
|
"github.com/docker/docker/opts"
|
2016-09-22 17:04:34 -04:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// NewContainerPruneCommand returns a cobra prune command for containers
|
2017-05-03 17:58:52 -04:00
|
|
|
func NewContainerPruneCommand(dockerCli command.Cli) *cobra.Command {
|
2016-09-22 17:04:34 -04:00
|
|
|
return container.NewPruneCommand(dockerCli)
|
|
|
|
}
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// NewVolumePruneCommand returns a cobra prune command for volumes
|
2017-05-03 17:58:52 -04:00
|
|
|
func NewVolumePruneCommand(dockerCli command.Cli) *cobra.Command {
|
2016-09-22 17:04:34 -04:00
|
|
|
return volume.NewPruneCommand(dockerCli)
|
|
|
|
}
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// NewImagePruneCommand returns a cobra prune command for images
|
2017-05-03 17:58:52 -04:00
|
|
|
func NewImagePruneCommand(dockerCli command.Cli) *cobra.Command {
|
2016-09-22 17:04:34 -04:00
|
|
|
return image.NewPruneCommand(dockerCli)
|
|
|
|
}
|
|
|
|
|
2016-10-18 00:36:52 -04:00
|
|
|
// NewNetworkPruneCommand returns a cobra prune command for Networks
|
2017-05-03 17:58:52 -04:00
|
|
|
func NewNetworkPruneCommand(dockerCli command.Cli) *cobra.Command {
|
2016-10-18 00:36:52 -04:00
|
|
|
return network.NewPruneCommand(dockerCli)
|
|
|
|
}
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// RunContainerPrune executes a prune command for containers
|
2017-05-03 17:58:52 -04:00
|
|
|
func RunContainerPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
|
2016-12-07 17:02:13 -05:00
|
|
|
return container.RunPrune(dockerCli, filter)
|
2016-09-22 17:04:34 -04:00
|
|
|
}
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// RunVolumePrune executes a prune command for volumes
|
2017-05-03 17:58:52 -04:00
|
|
|
func RunVolumePrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
|
2017-02-04 12:10:05 -05:00
|
|
|
return volume.RunPrune(dockerCli, filter)
|
2016-09-22 17:04:34 -04:00
|
|
|
}
|
|
|
|
|
2016-10-08 06:38:25 -04:00
|
|
|
// RunImagePrune executes a prune command for images
|
2017-05-03 17:58:52 -04:00
|
|
|
func RunImagePrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
|
2016-12-07 17:02:13 -05:00
|
|
|
return image.RunPrune(dockerCli, all, filter)
|
2016-09-22 17:04:34 -04:00
|
|
|
}
|
2016-10-18 00:36:52 -04:00
|
|
|
|
|
|
|
// RunNetworkPrune executes a prune command for networks
|
2017-05-03 17:58:52 -04:00
|
|
|
func RunNetworkPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
|
2016-12-07 17:02:13 -05:00
|
|
|
return network.RunPrune(dockerCli, filter)
|
2016-10-18 00:36:52 -04:00
|
|
|
}
|