Merge pull request #345 from vdemeester/remove-prune-package

Remove useless prune package 👼
This commit is contained in:
Kenfe-Mickaël Laventure 2017-07-18 14:46:53 +02:00 committed by GitHub
commit 19efbc85f4
2 changed files with 28 additions and 35 deletions

View File

@ -1,30 +0,0 @@
package prune
import (
"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"
"github.com/docker/cli/opts"
)
// RunContainerPrune executes a prune command for containers
func RunContainerPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return container.RunPrune(dockerCli, filter)
}
// RunVolumePrune executes a prune command for volumes
func RunVolumePrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return volume.RunPrune(dockerCli, filter)
}
// RunImagePrune executes a prune command for images
func RunImagePrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
return image.RunPrune(dockerCli, all, filter)
}
// RunNetworkPrune executes a prune command for networks
func RunNetworkPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return network.RunPrune(dockerCli, filter)
}

View File

@ -7,7 +7,10 @@ import (
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
"github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/prune" "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"
"github.com/docker/cli/opts" "github.com/docker/cli/opts"
"github.com/docker/docker/api/types/versions" "github.com/docker/docker/api/types/versions"
units "github.com/docker/go-units" units "github.com/docker/go-units"
@ -54,6 +57,26 @@ const confirmationTemplate = `WARNING! This will remove:
{{- end }} {{- end }}
Are you sure you want to continue?` Are you sure you want to continue?`
// runContainerPrune executes a prune command for containers
func runContainerPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return container.RunPrune(dockerCli, filter)
}
// runNetworkPrune executes a prune command for networks
func runNetworkPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return network.RunPrune(dockerCli, filter)
}
// runVolumePrune executes a prune command for volumes
func runVolumePrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return volume.RunPrune(dockerCli, filter)
}
// runImagePrune executes a prune command for images
func runImagePrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
return image.RunPrune(dockerCli, all, filter)
}
func runPrune(dockerCli command.Cli, options pruneOptions) error { func runPrune(dockerCli command.Cli, options pruneOptions) error {
if versions.LessThan(dockerCli.Client().ClientVersion(), "1.31") { if versions.LessThan(dockerCli.Client().ClientVersion(), "1.31") {
options.pruneBuildCache = false options.pruneBuildCache = false
@ -64,11 +87,11 @@ func runPrune(dockerCli command.Cli, options pruneOptions) error {
var spaceReclaimed uint64 var spaceReclaimed uint64
pruneFuncs := []func(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error){ pruneFuncs := []func(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error){
prune.RunContainerPrune, runContainerPrune,
prune.RunNetworkPrune, runNetworkPrune,
} }
if options.pruneVolumes { if options.pruneVolumes {
pruneFuncs = append(pruneFuncs, prune.RunVolumePrune) pruneFuncs = append(pruneFuncs, runVolumePrune)
} }
for _, pruneFn := range pruneFuncs { for _, pruneFn := range pruneFuncs {
@ -82,7 +105,7 @@ func runPrune(dockerCli command.Cli, options pruneOptions) error {
} }
} }
spc, output, err := prune.RunImagePrune(dockerCli, options.all, options.filter) spc, output, err := runImagePrune(dockerCli, options.all, options.filter)
if err != nil { if err != nil {
return err return err
} }