mirror of
https://github.com/containers/skopeo.git
synced 2026-05-19 05:23:08 +00:00
buildah delete should be able to delete multiple containers
Simple change to allow users to specify multiple containers to delete. This would support cleaning up all containers buildah delete $( buildah list -q) Closes: #43 Approved by: rhatdan
This commit is contained in:
committed by
Atomic Bot
parent
547afe50a0
commit
56f61d944a
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
deleteDescription = "Deletes a working container, unmounting it if necessary"
|
||||
deleteDescription = "Deletes working container(s), unmounting them if necessary"
|
||||
)
|
||||
|
||||
func deleteCmd(c *cli.Context) error {
|
||||
@@ -15,24 +15,21 @@ func deleteCmd(c *cli.Context) error {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
for _, name := range args {
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
err = builder.Delete()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting container %q: %v", builder.Container, err)
|
||||
err = builder.Delete()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting container %q: %v", builder.Container, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -140,10 +140,10 @@ func main() {
|
||||
},
|
||||
{
|
||||
Name: "delete",
|
||||
Usage: "Delete a working container",
|
||||
Usage: "Delete working container(s)",
|
||||
Description: deleteDescription,
|
||||
Action: deleteCmd,
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID",
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID [...]",
|
||||
},
|
||||
}
|
||||
err := app.Run(os.Args)
|
||||
|
||||
Reference in New Issue
Block a user