diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/common/create_opts.go | 1 | ||||
-rw-r--r-- | cmd/podman/common/createparse.go | 1 | ||||
-rw-r--r-- | cmd/podman/containers/attach.go | 1 | ||||
-rw-r--r-- | cmd/podman/containers/ps.go | 22 | ||||
-rw-r--r-- | cmd/podman/containers/restore.go | 1 | ||||
-rw-r--r-- | cmd/podman/containers/wait.go | 1 | ||||
-rw-r--r-- | cmd/podman/generate/systemd.go | 1 | ||||
-rw-r--r-- | cmd/podman/images/list.go | 1 | ||||
-rw-r--r-- | cmd/podman/images/prune.go | 1 | ||||
-rw-r--r-- | cmd/podman/images/pull.go | 2 | ||||
-rw-r--r-- | cmd/podman/images/search.go | 10 | ||||
-rw-r--r-- | cmd/podman/images/trust_show.go | 1 | ||||
-rw-r--r-- | cmd/podman/networks/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/networks/inspect.go | 1 | ||||
-rw-r--r-- | cmd/podman/networks/list.go | 1 | ||||
-rw-r--r-- | cmd/podman/play/kube.go | 1 | ||||
-rw-r--r-- | cmd/podman/pods/inspect.go | 1 | ||||
-rw-r--r-- | cmd/podman/secrets/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/secrets/list.go | 2 | ||||
-rw-r--r-- | cmd/podman/shell_completion_test.go | 4 | ||||
-rw-r--r-- | cmd/podman/system/df.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/prune.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/renumber.go | 1 |
24 files changed, 20 insertions, 39 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index d8935628e..fe43967a2 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -804,5 +804,4 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) { "Configure cgroup v2 (key=value)", ) _ = cmd.RegisterFlagCompletionFunc(cgroupConfFlagName, completion.AutocompleteNone) - } diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 67d40ac43..430354ee9 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -269,7 +269,6 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup endpointsConfig := cc.NetworkingConfig.EndpointsConfig cniNetworks := make([]string, 0, len(endpointsConfig)) for netName, endpoint := range endpointsConfig { - cniNetworks = append(cniNetworks, netName) if endpoint == nil { diff --git a/cmd/podman/common/createparse.go b/cmd/podman/common/createparse.go index 3a69f11b6..140518cf7 100644 --- a/cmd/podman/common/createparse.go +++ b/cmd/podman/common/createparse.go @@ -26,5 +26,4 @@ func (c *ContainerCLIOpts) validate() error { return errors.Errorf("invalid image-volume type %q. Pick one of bind, tmpfs, or ignore", c.ImageVolume) } return nil - } diff --git a/cmd/podman/containers/attach.go b/cmd/podman/containers/attach.go index f00c5378b..7c7d780bc 100644 --- a/cmd/podman/containers/attach.go +++ b/cmd/podman/containers/attach.go @@ -68,7 +68,6 @@ func init() { }) attachFlags(containerAttachCommand) validate.AddLatestFlag(containerAttachCommand, &attachOpts.Latest) - } func attach(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index 31f44d92f..bfb821159 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -142,11 +142,19 @@ func checkFlags(c *cobra.Command) error { } func jsonOut(responses []entities.ListContainer) error { - r := make([]entities.ListContainer, 0) + type jsonFormat struct { + entities.ListContainer + Created int64 + } + r := make([]jsonFormat, 0) for _, con := range responses { con.CreatedAt = units.HumanDuration(time.Since(con.Created)) + " ago" con.Status = psReporter{con}.Status() - r = append(r, con) + jf := jsonFormat{ + ListContainer: con, + Created: con.Created.UnixNano(), + } + r = append(r, jf) } b, err := json.MarshalIndent(r, "", " ") if err != nil { @@ -243,12 +251,12 @@ func ps(cmd *cobra.Command, _ []string) error { // responses will grow to the largest number of processes reported on, but will not thrash the gc var responses []psReporter for ; ; responses = responses[:0] { - if ctnrs, err := getResponses(); err != nil { + ctnrs, err := getResponses() + if err != nil { return err - } else { - for _, r := range ctnrs { - responses = append(responses, psReporter{r}) - } + } + for _, r := range ctnrs { + responses = append(responses, psReporter{r}) } tm.Clear() diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go index 49c0be88e..61bd84219 100644 --- a/cmd/podman/containers/restore.go +++ b/cmd/podman/containers/restore.go @@ -118,5 +118,4 @@ func restore(_ *cobra.Command, args []string) error { } } return errs.PrintErrors() - } diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go index 7a531b98a..7831ef1c9 100644 --- a/cmd/podman/containers/wait.go +++ b/cmd/podman/containers/wait.go @@ -56,7 +56,6 @@ func waitFlags(cmd *cobra.Command) { conditionFlagName := "condition" flags.StringVar(&waitCondition, conditionFlagName, "stopped", "Condition to wait on") _ = cmd.RegisterFlagCompletionFunc(conditionFlagName, common.AutocompleteWaitCondition) - } func init() { diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go index f9099d3b8..7b2d9ebb7 100644 --- a/cmd/podman/generate/systemd.go +++ b/cmd/podman/generate/systemd.go @@ -128,7 +128,6 @@ func systemd(cmd *cobra.Command, args []string) error { default: return errors.Errorf("unknown --format argument: %s", format) } - } func printDefault(units map[string]string) error { diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go index 8a7951923..65486e3ba 100644 --- a/cmd/podman/images/list.go +++ b/cmd/podman/images/list.go @@ -275,7 +275,6 @@ func tokenRepoTag(ref string) (string, string, error) { } return name, tag, nil - } func sortFunc(key string, data []imageReporter) func(i, j int) bool { diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go index 268a68681..8ded8d352 100644 --- a/cmd/podman/images/prune.go +++ b/cmd/podman/images/prune.go @@ -48,7 +48,6 @@ func init() { flags.StringArrayVar(&filter, filterFlagName, []string{}, "Provide filter values (e.g. 'label=<key>=<value>')") //TODO: add completion for filters _ = pruneCmd.RegisterFlagCompletionFunc(filterFlagName, completion.AutocompleteNone) - } func prune(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go index fe92baebe..3b2595757 100644 --- a/cmd/podman/images/pull.go +++ b/cmd/podman/images/pull.go @@ -110,11 +110,9 @@ func pullFlags(cmd *cobra.Command) { _ = cmd.RegisterFlagCompletionFunc(authfileFlagName, completion.AutocompleteDefault) if !registry.IsRemote() { - certDirFlagName := "cert-dir" flags.StringVar(&pullOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys") _ = cmd.RegisterFlagCompletionFunc(certDirFlagName, completion.AutocompleteDefault) - } _ = flags.MarkHidden("signature-policy") } diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go index c8ea4b04a..b8274cfce 100644 --- a/cmd/podman/images/search.go +++ b/cmd/podman/images/search.go @@ -156,12 +156,12 @@ func imageSearch(cmd *cobra.Command, args []string) error { return errors.Errorf("filters are not applicable to list tags result") } if report.IsJSON(searchOptions.Format) { - listTagsEntries := buildListTagsJson(searchReport) - return printJson(listTagsEntries) + listTagsEntries := buildListTagsJSON(searchReport) + return printArbitraryJSON(listTagsEntries) } row = "{{.Name}}\t{{.Tag}}\n" case report.IsJSON(searchOptions.Format): - return printJson(searchReport) + return printArbitraryJSON(searchReport) case cmd.Flags().Changed("format"): renderHeaders = parse.HasTable(searchOptions.Format) row = report.NormalizeFormat(searchOptions.Format) @@ -186,7 +186,7 @@ func imageSearch(cmd *cobra.Command, args []string) error { return tmpl.Execute(w, searchReport) } -func printJson(v interface{}) error { +func printArbitraryJSON(v interface{}) error { prettyJSON, err := json.MarshalIndent(v, "", " ") if err != nil { return err @@ -195,7 +195,7 @@ func printJson(v interface{}) error { return nil } -func buildListTagsJson(searchReport []entities.ImageSearchReport) []listEntryTag { +func buildListTagsJSON(searchReport []entities.ImageSearchReport) []listEntryTag { entries := []listEntryTag{} ReportLoop: diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go index dc35dc6a1..89733a1aa 100644 --- a/cmd/podman/images/trust_show.go +++ b/cmd/podman/images/trust_show.go @@ -42,7 +42,6 @@ func init() { _ = showFlags.MarkHidden("policypath") showFlags.StringVar(&showTrustOptions.RegistryPath, "registrypath", "", "") _ = showFlags.MarkHidden("registrypath") - } func showTrust(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go index 1a091f111..d1cbe253f 100644 --- a/cmd/podman/networks/create.go +++ b/cmd/podman/networks/create.go @@ -80,7 +80,6 @@ func init() { Parent: networkCmd, }) networkCreateFlags(networkCreateCommand) - } func networkCreate(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go index 671b0265f..bd9f76ea9 100644 --- a/cmd/podman/networks/inspect.go +++ b/cmd/podman/networks/inspect.go @@ -39,5 +39,4 @@ func init() { func networkInspect(_ *cobra.Command, args []string) error { inspectOpts.Type = inspect.NetworkType return inspect.Inspect(args, *inspectOpts) - } diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go index 16ae980dc..6f63e97cc 100644 --- a/cmd/podman/networks/list.go +++ b/cmd/podman/networks/list.go @@ -51,7 +51,6 @@ func networkListFlags(flags *pflag.FlagSet) { filterFlagName := "filter" flags.StringArrayVarP(&filters, filterFlagName, "f", nil, "Provide filter values (e.g. 'name=podman')") _ = networklistCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteNetworkFilters) - } func init() { diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go index 4c44fa30f..511e208cf 100644 --- a/cmd/podman/play/kube.go +++ b/cmd/podman/play/kube.go @@ -77,7 +77,6 @@ func init() { _ = kubeCmd.RegisterFlagCompletionFunc(authfileFlagName, completion.AutocompleteDefault) if !registry.IsRemote() { - certDirFlagName := "cert-dir" flags.StringVar(&kubeOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys") _ = kubeCmd.RegisterFlagCompletionFunc(certDirFlagName, completion.AutocompleteDefault) diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go index e809be0c9..0fbb730ce 100644 --- a/cmd/podman/pods/inspect.go +++ b/cmd/podman/pods/inspect.go @@ -50,7 +50,6 @@ func init() { } func inspect(cmd *cobra.Command, args []string) error { - if len(args) < 1 && !inspectOptions.Latest { return errors.Errorf("you must provide the name or id of a running pod") } diff --git a/cmd/podman/secrets/create.go b/cmd/podman/secrets/create.go index ef5d703ca..8f3ebc3ec 100644 --- a/cmd/podman/secrets/create.go +++ b/cmd/podman/secrets/create.go @@ -59,7 +59,6 @@ func create(cmd *cobra.Command, args []string) error { } if (stat.Mode() & os.ModeNamedPipe) == 0 { return errors.New("if `-` is used, data must be passed into stdin") - } reader = os.Stdin } else { diff --git a/cmd/podman/secrets/list.go b/cmd/podman/secrets/list.go index dff4bfdca..d79e125e8 100644 --- a/cmd/podman/secrets/list.go +++ b/cmd/podman/secrets/list.go @@ -48,7 +48,6 @@ func init() { formatFlagName := "format" flags.StringVar(&listFlag.format, formatFlagName, "{{.ID}}\t{{.Name}}\t{{.Driver}}\t{{.CreatedAt}}\t{{.UpdatedAt}}\t\n", "Format volume output using Go template") _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat) - } func ls(cmd *cobra.Command, args []string) error { @@ -65,7 +64,6 @@ func ls(cmd *cobra.Command, args []string) error { UpdatedAt: units.HumanDuration(time.Since(response.UpdatedAt)) + " ago", Driver: response.Spec.Driver.Name, }) - } return outputTemplate(cmd, listed) } diff --git a/cmd/podman/shell_completion_test.go b/cmd/podman/shell_completion_test.go index d2b500b09..3f6f56fbe 100644 --- a/cmd/podman/shell_completion_test.go +++ b/cmd/podman/shell_completion_test.go @@ -26,14 +26,11 @@ import ( ) func TestShellCompletionFunctions(t *testing.T) { - rootCmd := parseCommands() checkCommand(t, rootCmd) - } func checkCommand(t *testing.T, cmd *cobra.Command) { - if cmd.HasSubCommands() { for _, childCmd := range cmd.Commands() { checkCommand(t, childCmd) @@ -46,7 +43,6 @@ func checkCommand(t *testing.T, cmd *cobra.Command) { // loop over all local flags cmd.LocalFlags().VisitAll(func(flag *pflag.Flag) { - // an error means that there is a completion function for this flag err := cmd.RegisterFlagCompletionFunc(flag.Name, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return nil, cobra.ShellCompDirectiveDefault diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go index a9eab24bb..68b244e35 100644 --- a/cmd/podman/system/df.go +++ b/cmd/podman/system/df.go @@ -50,7 +50,6 @@ func init() { formatFlagName := "format" flags.StringVar(&dfOptions.Format, formatFlagName, "", "Pretty-print images using a Go template") _ = dfSystemCommand.RegisterFlagCompletionFunc(formatFlagName, completion.AutocompleteNone) - } func df(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go index 5e96a654a..7ec08366e 100644 --- a/cmd/podman/system/prune.go +++ b/cmd/podman/system/prune.go @@ -51,7 +51,6 @@ func init() { filterFlagName := "filter" flags.StringArrayVar(&filters, filterFlagName, []string{}, "Provide filter values (e.g. 'label=<key>=<value>')") _ = pruneCommand.RegisterFlagCompletionFunc(filterFlagName, completion.AutocompleteNone) - } func prune(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go index b1683395f..37f9a5865 100644 --- a/cmd/podman/system/renumber.go +++ b/cmd/podman/system/renumber.go @@ -39,7 +39,6 @@ func init() { Command: renumberCommand, Parent: systemCmd, }) - } func renumber(cmd *cobra.Command, args []string) { // Shutdown all running engines, `renumber` will hijack all methods |