summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/prune.go4
-rw-r--r--cmd/podman/images/prune.go4
-rw-r--r--cmd/podman/manifest/add.go12
-rw-r--r--cmd/podman/manifest/annotate.go16
-rw-r--r--cmd/podman/manifest/create.go3
-rw-r--r--cmd/podman/manifest/inspect.go5
-rw-r--r--cmd/podman/manifest/remove.go17
-rw-r--r--cmd/podman/manifest/rm.go4
-rw-r--r--cmd/podman/networks/list.go14
-rw-r--r--cmd/podman/networks/prune.go4
10 files changed, 28 insertions, 55 deletions
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go
index e13b9e7f6..f58e37fd1 100644
--- a/cmd/podman/containers/prune.go
+++ b/cmd/podman/containers/prune.go
@@ -9,11 +9,11 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/common"
+ "github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/containers/podman/v3/pkg/specgenutil"
"github.com/spf13/cobra"
)
@@ -64,7 +64,7 @@ func prune(cmd *cobra.Command, args []string) error {
}
}
- pruneOptions.Filters, err = specgenutil.ParseFilters(filter)
+ pruneOptions.Filters, err = parse.FilterArgumentsIntoFilters(filter)
if err != nil {
return err
}
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index fc7451c41..e4c320a55 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -8,11 +8,11 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/common"
+ "github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/containers/podman/v3/pkg/specgenutil"
"github.com/spf13/cobra"
)
@@ -66,7 +66,7 @@ func prune(cmd *cobra.Command, args []string) error {
return nil
}
}
- filterMap, err := specgenutil.ParseFilters(filter)
+ filterMap, err := parse.FilterArgumentsIntoFilters(filter)
if err != nil {
return err
}
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go
index 9d219601c..d09533967 100644
--- a/cmd/podman/manifest/add.go
+++ b/cmd/podman/manifest/add.go
@@ -26,14 +26,14 @@ type manifestAddOptsWrapper struct {
var (
manifestAddOpts = manifestAddOptsWrapper{}
addCmd = &cobra.Command{
- Use: "add [options] LIST LIST",
+ Use: "add [options] LIST IMAGE [IMAGE...]",
Short: "Add images to a manifest list or image index",
Long: "Adds an image to a manifest list or image index.",
RunE: add,
+ Args: cobra.MinimumNArgs(2),
ValidArgsFunction: common.AutocompleteImages,
Example: `podman manifest add mylist:v1.11 image:v1.11-amd64
podman manifest add mylist:v1.11 transport:imageName`,
- Args: cobra.ExactArgs(2),
}
)
@@ -93,10 +93,6 @@ func add(cmd *cobra.Command, args []string) error {
return err
}
- // FIXME: (@vrothberg) this interface confuses me a lot. Why are they
- // not two arguments?
- manifestAddOpts.Images = []string{args[1], args[0]}
-
if manifestAddOpts.CredentialsCLI != "" {
creds, err := util.ParseRegistryCreds(manifestAddOpts.CredentialsCLI)
if err != nil {
@@ -114,10 +110,10 @@ func add(cmd *cobra.Command, args []string) error {
manifestAddOpts.SkipTLSVerify = types.NewOptionalBool(!manifestAddOpts.TLSVerifyCLI)
}
- listID, err := registry.ImageEngine().ManifestAdd(context.Background(), manifestAddOpts.ManifestAddOptions)
+ listID, err := registry.ImageEngine().ManifestAdd(context.Background(), args[0], args[1:], manifestAddOpts.ManifestAddOptions)
if err != nil {
return err
}
- fmt.Printf("%s\n", listID)
+ fmt.Println(listID)
return nil
}
diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go
index d806ce9e6..a032a1fe5 100644
--- a/cmd/podman/manifest/annotate.go
+++ b/cmd/podman/manifest/annotate.go
@@ -1,14 +1,12 @@
package manifest
import (
- "context"
"fmt"
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -20,8 +18,8 @@ var (
Short: "Add or update information about an entry in a manifest list or image index",
Long: "Adds or updates information about an entry in a manifest list or image index.",
RunE: annotate,
- Example: `podman manifest annotate --annotation left=right mylist:v1.11 image:v1.11-amd64`,
Args: cobra.ExactArgs(2),
+ Example: `podman manifest annotate --annotation left=right mylist:v1.11 image:v1.11-amd64`,
ValidArgsFunction: common.AutocompleteImages,
}
)
@@ -63,18 +61,10 @@ func init() {
}
func annotate(cmd *cobra.Command, args []string) error {
- listImageSpec := args[0]
- instanceSpec := args[1]
- if listImageSpec == "" {
- return errors.Errorf(`invalid image name "%s"`, listImageSpec)
- }
- if instanceSpec == "" {
- return errors.Errorf(`invalid image digest "%s"`, instanceSpec)
- }
- updatedListID, err := registry.ImageEngine().ManifestAnnotate(context.Background(), args, manifestAnnotateOpts)
+ id, err := registry.ImageEngine().ManifestAnnotate(registry.Context(), args[0], args[1], manifestAnnotateOpts)
if err != nil {
return err
}
- fmt.Printf("%s\n", updatedListID)
+ fmt.Println(id)
return nil
}
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index 95c9f89b0..acef53045 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -1,7 +1,6 @@
package manifest
import (
- "context"
"fmt"
"github.com/containers/podman/v3/cmd/podman/common"
@@ -36,7 +35,7 @@ func init() {
}
func create(cmd *cobra.Command, args []string) error {
- imageID, err := registry.ImageEngine().ManifestCreate(context.Background(), args[:1], args[1:], manifestCreateOpts)
+ imageID, err := registry.ImageEngine().ManifestCreate(registry.Context(), args[0], args[1:], manifestCreateOpts)
if err != nil {
return err
}
diff --git a/cmd/podman/manifest/inspect.go b/cmd/podman/manifest/inspect.go
index d444f9066..ac8ee3dc4 100644
--- a/cmd/podman/manifest/inspect.go
+++ b/cmd/podman/manifest/inspect.go
@@ -1,7 +1,6 @@
package manifest
import (
- "context"
"fmt"
"github.com/containers/podman/v3/cmd/podman/common"
@@ -29,10 +28,10 @@ func init() {
}
func inspect(cmd *cobra.Command, args []string) error {
- buf, err := registry.ImageEngine().ManifestInspect(context.Background(), args[0])
+ buf, err := registry.ImageEngine().ManifestInspect(registry.Context(), args[0])
if err != nil {
return err
}
- fmt.Printf("%s\n", buf)
+ fmt.Println(string(buf))
return nil
}
diff --git a/cmd/podman/manifest/remove.go b/cmd/podman/manifest/remove.go
index c44c0991e..4716af201 100644
--- a/cmd/podman/manifest/remove.go
+++ b/cmd/podman/manifest/remove.go
@@ -1,7 +1,6 @@
package manifest
import (
- "context"
"fmt"
"github.com/containers/podman/v3/cmd/podman/common"
@@ -16,9 +15,9 @@ var (
Short: "Remove an entry from a manifest list or image index",
Long: "Removes an image from a manifest list or image index.",
RunE: remove,
+ Args: cobra.ExactArgs(2),
ValidArgsFunction: common.AutocompleteImages,
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
- Args: cobra.ExactArgs(2),
}
)
@@ -30,18 +29,10 @@ func init() {
}
func remove(cmd *cobra.Command, args []string) error {
- listImageSpec := args[0]
- instanceSpec := args[1]
- if listImageSpec == "" {
- return errors.Errorf(`invalid image name "%s"`, listImageSpec)
- }
- if instanceSpec == "" {
- return errors.Errorf(`invalid image digest "%s"`, instanceSpec)
- }
- updatedListID, err := registry.ImageEngine().ManifestRemove(context.Background(), args)
+ updatedListID, err := registry.ImageEngine().ManifestRemoveDigest(registry.Context(), args[0], args[1])
if err != nil {
- return errors.Wrapf(err, "error removing from manifest list %s", listImageSpec)
+ return errors.Wrapf(err, "error removing from manifest list %s", args[0])
}
- fmt.Printf("%s\n", updatedListID)
+ fmt.Println(updatedListID)
return nil
}
diff --git a/cmd/podman/manifest/rm.go b/cmd/podman/manifest/rm.go
index 5e78197ed..b4a52653b 100644
--- a/cmd/podman/manifest/rm.go
+++ b/cmd/podman/manifest/rm.go
@@ -12,13 +12,13 @@ import (
var (
rmCmd = &cobra.Command{
- Use: "rm LIST",
+ Use: "rm LIST [LIST...]",
Short: "Remove manifest list or image index from local storage",
Long: "Remove manifest list or image index from local storage.",
RunE: rm,
+ Args: cobra.MinimumNArgs(1),
ValidArgsFunction: common.AutocompleteImages,
Example: `podman manifest rm mylist:v1.11`,
- Args: cobra.ExactArgs(1),
}
)
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index b84c9f5d3..be61d72d8 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -10,10 +10,10 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
+ "github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -61,14 +61,12 @@ func init() {
}
func networkList(cmd *cobra.Command, args []string) error {
- networkListOptions.Filters = make(map[string][]string)
- for _, f := range filters {
- split := strings.SplitN(f, "=", 2)
- if len(split) == 1 {
- return errors.Errorf("invalid filter %q", f)
- }
- networkListOptions.Filters[split[0]] = append(networkListOptions.Filters[split[0]], split[1])
+ var err error
+ networkListOptions.Filters, err = parse.FilterArgumentsIntoFilters(filters)
+ if err != nil {
+ return err
}
+
responses, err := registry.ContainerEngine().NetworkList(registry.Context(), networkListOptions)
if err != nil {
return err
diff --git a/cmd/podman/networks/prune.go b/cmd/podman/networks/prune.go
index 311d098cd..e113cd359 100644
--- a/cmd/podman/networks/prune.go
+++ b/cmd/podman/networks/prune.go
@@ -7,11 +7,11 @@ import (
"strings"
"github.com/containers/podman/v3/cmd/podman/common"
+ "github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/containers/podman/v3/pkg/specgenutil"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -68,7 +68,7 @@ func networkPrune(cmd *cobra.Command, _ []string) error {
return nil
}
}
- networkPruneOptions.Filters, err = specgenutil.ParseFilters(filter)
+ networkPruneOptions.Filters, err = parse.FilterArgumentsIntoFilters(filter)
if err != nil {
return err
}