mirror of
https://github.com/apple/container.git
synced 2026-08-28 02:24:17 -05:00
Feat: container image delete force option (#1096)
- Fixed #1087 Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,9 @@ extension Application {
|
||||
@Flag(name: .shortAndLong, help: "Delete all images")
|
||||
var all: Bool = false
|
||||
|
||||
@Flag(name: .shortAndLong, help: "Ignore errors for images that are not found")
|
||||
var force: Bool = false
|
||||
|
||||
@Argument
|
||||
var images: [String] = []
|
||||
}
|
||||
@@ -51,7 +54,7 @@ extension Application {
|
||||
}
|
||||
return try await ClientImage.get(names: options.images)
|
||||
}()
|
||||
var failures: [String] = notFound
|
||||
var failures: [String] = options.force ? [] : notFound
|
||||
var didDeleteAnyImage = false
|
||||
for image in found {
|
||||
guard !Utility.isInfraImage(name: image.reference) else {
|
||||
|
||||
@@ -538,7 +538,7 @@ Deletes one or more images. If no images are provided, `--all` can be used to de
|
||||
**Usage**
|
||||
|
||||
```bash
|
||||
container image delete [--all] [--debug] [<images> ...]
|
||||
container image delete [--all] [--force] [--debug] [<images> ...]
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
@@ -548,6 +548,7 @@ container image delete [--all] [--debug] [<images> ...]
|
||||
**Options**
|
||||
|
||||
* `-a, --all`: Delete all images
|
||||
* `-f, --force`: Ignore errors for images that are not found
|
||||
|
||||
### `container image prune`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user