diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-24 12:50:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 12:50:59 -0400 |
commit | 2dc4f752c67e8e8c1035d6e2d689779cdc00004b (patch) | |
tree | 69557b4f1002fb85a3cb3c32401adeb7a4484c5b /cmd | |
parent | 7391bdfbbc418adbc85f6643cb67cdbd87fd0b7b (diff) | |
parent | 2400d1d52ff4199778781446445eef39a6e2c6b9 (diff) | |
download | podman-2dc4f752c67e8e8c1035d6e2d689779cdc00004b.tar.gz podman-2dc4f752c67e8e8c1035d6e2d689779cdc00004b.tar.bz2 podman-2dc4f752c67e8e8c1035d6e2d689779cdc00004b.zip |
Merge pull request #14341 from vrothberg/todo-part-1
TODO's and FIXME's [PART 1]
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/completion.go | 6 | ||||
-rw-r--r-- | cmd/podman/images/mount.go | 15 | ||||
-rw-r--r-- | cmd/podman/images/search.go | 3 |
3 files changed, 12 insertions, 12 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index 099fc267e..c29218d01 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" + libimageDefine "github.com/containers/common/libimage/define" "github.com/containers/common/libnetwork/types" "github.com/containers/common/pkg/config" "github.com/containers/image/v5/pkg/sysregistriesv2" @@ -496,6 +497,11 @@ func AutocompleteImages(cmd *cobra.Command, args []string, toComplete string) ([ return getImages(cmd, toComplete) } +// AutocompleteImageSearchFilters - Autocomplate `search --filter`. +func AutocompleteImageSearchFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return libimageDefine.SearchFilters, cobra.ShellCompDirectiveNoFileComp +} + // AutocompletePodExitPolicy - Autocomplete pod exit policy. func AutocompletePodExitPolicy(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return config.PodExitPolicies, cobra.ShellCompDirectiveNoFileComp diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go index d5ab3d274..532d96196 100644 --- a/cmd/podman/images/mount.go +++ b/cmd/podman/images/mount.go @@ -7,7 +7,6 @@ import ( "github.com/containers/common/pkg/report" "github.com/containers/podman/v4/cmd/podman/common" "github.com/containers/podman/v4/cmd/podman/registry" - "github.com/containers/podman/v4/cmd/podman/utils" "github.com/containers/podman/v4/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -71,16 +70,12 @@ func mount(cmd *cobra.Command, args []string) error { return err } - if len(args) > 0 || mountOpts.All { - var errs utils.OutputErrors - for _, r := range reports { - if r.Err == nil { - fmt.Println(r.Path) - continue - } - errs = append(errs, r.Err) + if len(args) == 1 && mountOpts.Format == "" && !mountOpts.All { + if len(reports) != 1 { + return fmt.Errorf("internal error: expected 1 report but got %d", len(reports)) } - return errs.PrintErrors() + fmt.Println(reports[0].Path) + return nil } switch { diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go index 335ea2b5a..a18f7a11d 100644 --- a/cmd/podman/images/search.go +++ b/cmd/podman/images/search.go @@ -83,8 +83,7 @@ func searchFlags(cmd *cobra.Command) { filterFlagName := "filter" flags.StringSliceVarP(&searchOptions.Filters, filterFlagName, "f", []string{}, "Filter output based on conditions provided (default [])") - // TODO add custom filter function - _ = cmd.RegisterFlagCompletionFunc(filterFlagName, completion.AutocompleteNone) + _ = cmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteImageSearchFilters) formatFlagName := "format" flags.StringVar(&searchOptions.Format, formatFlagName, "", "Change the output format to JSON or a Go template") |