From f4f58003fb49633c78e2d6d90f8ed0d0b1ab2af9 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 2 May 2020 21:14:46 +0200 Subject: [PATCH] Add -f shorthand flag for prune --force The docker builder prune command has a shorthand `-f` flag for `--force`: docker builder prune --help Usage: docker builder prune Remove build cache Options: -a, --all Remove all unused build cache, not just dangling ones --filter filter Provide filter values (e.g. 'until=24h') -f, --force Do not prompt for confirmation --keep-storage bytes Amount of disk space to keep for cache Given that `buildx` can be used as a drop-in replacement for the native build commands, it should match the UI, and also have a shorthand flag. This patch also updates the flag's description to be in line with the docker commandline With this patch applied; buildx prune --help Remove build cache Usage: buildx prune [flags] Flags: -a, --all Remove all unused images, not just dangling ones --filter filter Provide filter values (e.g. 'until=24h') -f, --force Do not prompt for confirmation -h, --help help for prune --keep-storage bytes Amount of disk space to keep for cache --verbose Provide a more verbose output Global Flags: --builder string Override the configured builder instance Signed-off-by: Sebastiaan van Stijn --- commands/prune.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/prune.go b/commands/prune.go index 2c2138ab..cb8a58bd 100644 --- a/commands/prune.go +++ b/commands/prune.go @@ -143,7 +143,7 @@ func pruneCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=24h')") flags.Var(&options.keepStorage, "keep-storage", "Amount of disk space to keep for cache") flags.BoolVar(&options.verbose, "verbose", false, "Provide a more verbose output") - flags.BoolVar(&options.force, "force", false, "Skip the warning messages") + flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") return cmd }