Skip to content

Commit

Permalink
Remove unnecessary prune function aliases.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
Upstream-commit: ff350a04cba8dd7c9304f1a59702a2efd3114eaa
Component: cli
  • Loading branch information
dnephin committed Jul 18, 2017
1 parent 29e4b60 commit 7c2dc55
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions components/cli/cli/command/system/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,6 @@ const confirmationTemplate = `WARNING! This will remove:
{{- end }}
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)
}

// runBuildCachePrune executes a prune command for build cache
func runBuildCachePrune(dockerCli command.Cli, _ opts.FilterOpt) (uint64, string, error) {
report, err := dockerCli.Client().BuildCachePrune(context.Background())
Expand All @@ -94,14 +74,14 @@ func runPrune(dockerCli command.Cli, options pruneOptions) error {
return nil
}
imagePrune := func(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return runImagePrune(dockerCli, options.all, options.filter)
return image.RunPrune(dockerCli, options.all, options.filter)
}
pruneFuncs := []func(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error){
runContainerPrune,
runNetworkPrune,
container.RunPrune,
network.RunPrune,
}
if options.pruneVolumes {
pruneFuncs = append(pruneFuncs, runVolumePrune)
pruneFuncs = append(pruneFuncs, volume.RunPrune)
}
pruneFuncs = append(pruneFuncs, imagePrune)
if options.pruneBuildCache {
Expand Down

0 comments on commit 7c2dc55

Please sign in to comment.