aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/images/list.go
Commit message (Collapse)AuthorAge
* Scrub podman commands to use report packageJhon Honce2021-06-16
| | | | | | | | | | | | | | | | Refactor podman commands that have drifted from using c/common report pkg. Report pkg is needed to implement go template functions. Removed obsolete code from podman which exists in c/common. Latest template library added default newlines and method to remove them. Incorporated needed changes in c/common PR below. Depends on https://github.com/containers/common/pull/624 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1855983 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* [Techinal Debt] Cleanup ABI vs. Tunnel CLI commandsJhon Honce2021-05-27
| | | | | | | | | | | | | | | | | | [NO TESTS NEEDED] This commit cleans up two issues: * Most commands support all EngineModes so default to that. Let outlayers declare their intent. * Use cobra.Annotations to set supported EngineMode. This simplies instantiating commands as there is now one method to communicate a commands requirements rather than two. * Combined aliased commands into one file * Fixed aliased commands where Args field did not match * Updated examples in README.md for writing commands * Remove redundant flag DisableFlagsInUseLine in cobra.Command initialization. Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Add go template shell completion for --formatPaul Holzinger2021-04-22
| | | | | | | | | | | | | | | | | | | The --format flags accepts go template strings. I use this often but I consistently forget the field names. This commit adds a way to provide shell completion for the --format flag. It works by automatically receiving the field names with the reflect package from the given struct. This requires almost no maintenance since this ensures that we always use the correct field names. This also works for nested structs. ``` $ podman ps --format "{{.P" {{.Pid}} {{.PIDNS}} {{.Pod}} {{.PodName}} {{.Ports}} ``` NOTE: This only works when you use quotes otherwise the shell does not provide completions. Also this does not work for fish at the moment. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* bump go module to v3Valentin Rothberg2021-02-22
| | | | | | | | | We missed bumping the go module, so let's do it now :) * Automated go code with github.com/sirkon/go-imports-rename * Manually via `vgrep podman/v2` the rest Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Enable whitespace linterPaul Holzinger2021-02-11
| | | | | | | | Use the whitespace linter and fix the reported problems. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Fix `podman images...` missing headers in table templatesJhon Honce2020-12-02
| | | | Signed-off-by: Jhon Honce <jhonce@redhat.com>
* more shell completion improvementsPaul Holzinger2020-11-23
| | | | | | | | | | * podman image ls --filter * podman network ls --filter * podman volume ls --filter * podman network connect/disconnect * podman events --filter Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Add shell completion with cobraPaul Holzinger2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow automatic generation for shell completion scripts with the internal cobra functions (requires v1.0.0+). This should replace the handwritten completion scripts and even adds support for fish. With this approach it is less likley that completions and code are out of sync. We can now create the scripts with - podman completion bash - podman completion zsh - podman completion fish To test the completion run: source <(podman completion bash) The same works for podman-remote and podman --remote and it will complete your remote containers/images with the correct endpoints values from --url/--connection. The completion logic is written in go and provided by the cobra library. The completion functions lives in `cmd/podman/completion/completion.go`. The unit test at cmd/podman/shell_completion_test.go checks if each command and flag has an autocompletion function set. This prevents that commands and flags have no shell completion set. This commit does not replace the current autocompletion scripts. Closes #6440 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Restore --format table header supportJhon Honce2020-10-29
| | | | Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Merge pull request #8077 from jwhonce/wip/reportOpenShift Merge Robot2020-10-21
|\ | | | | Refactor podman to use c/common/pkg/report
| * Refactor podman to use c/common/pkg/reportJhon Honce2020-10-21
| | | | | | | | | | | | | | All formatting for containers stack moved into one package The does not correct issue with headers when using custom tables Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | Switch use of Flags to OptionsDaniel J Walsh2020-10-21
|/ | | | | | | | Want to have man pages match commands, since we have lots of printed man pages with using Options, we will change the command line to use Options in --help. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Restore "table" --format from V1Jhon Honce2020-10-02
| | | | | | | | | | | | | * --format "table {{.field..." will print fields out in a table with headings. Table keyword is removed, spaces between fields are converted to tabs * Update parse.MatchesJSONFormat()'s regex to be more inclusive * Add report.Headers(), obtain all the field names to be used as column headers, a map of field name to column headers may be provided to override the field names * Update several commands to use new functions Signed-off-by: Jhon Honce <jhonce@redhat.com>
* image list: return all associated namesValentin Rothberg2020-09-17
| | | | | | | | | | | | | | | | Always return all associated names / repo tags of an image and fix a bug with malformed repo tags. Previously, Podman returned all names only with `--all` but this flag only instructs to list intermediate images and should not alter associated names. With `--all` Podman queried the repo tags of an image which splits all *tagged* names into repository and tag which is then reassembled to eventually be parsed again in the frontend. Lot's of redundant CPU heat and buggy as the reassembly didn't consider digests which ultimately broke parsing in the frontend. Fixes: #7651 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Default .Repository and .Tag values to <none>Jhon Honce2020-08-10
| | | | | | | | | | Refactor the processing of Repository and Tag fields to default to <none> when printing via --format flag. Previously, the default format would print <none> but --format {{.Tag}} would not in some cases. Fixes #7123 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Don't crash when giving bogus format commandsDaniel J Walsh2020-07-29
| | | | | | | | | | | | | | | | Currently if you give a bogus flag to --format it will crash the formatter. With this change we will get a nice error. podman images --format '{{ bogus }}' Error: template: list:1: function "bogus" not defined versus /bin/podman.old images --format '{{ bogus }}' panic: template: list:1: function "bogus" not defined goroutine 1 [running]: Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Switch all references to github.com/containers/libpod -> podmanDaniel J Walsh2020-07-28
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Used reference package with errors for parsing tagParker Van Roy2020-07-17
| | | | Signed-off-by: Parker Van Roy <pvanroy@redhat.com>
* move go module to v2Valentin Rothberg2020-07-06
| | | | | | | | | | | | | | | With the advent of Podman 2.0.0 we crossed the magical barrier of go modules. While we were able to continue importing all packages inside of the project, the project could not be vendored anymore from the outside. Move the go module to new major version and change all imports to `github.com/containers/libpod/v2`. The renaming of the imports was done via `gomove` [1]. [1] https://github.com/KSubedi/gomove Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Created timestamp returned by imagelist should be in unix formatDaniel J Walsh2020-06-30
| | | | | | | | In the API, we are currently returning the image time of creation as a string, in time.Time format. The API is for a 64 bit integer representing Unix time. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* BATS tests: new too-many-arguments testEd Santiago2020-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | ...plus a few others. And fixes to actual parsing. If a command's usage message includes '...' in the argument list, assume it can take unlimited arguments. Nothing we can check. For all others, though, the ALL-CAPS part on the right-hand side of the usage message will define an upper bound on the number of arguments accepted by the command. So in our 'podman --help' test, generate N+1 args and run that command. We expect a 125 exit status and a suitably helpful error message. Not all podman commands or subcommands were checking, so I fixed that. And, fixed some broken usage messages (all-caps FLAGS, and '[flags]' at the end of 'ARGS'). Add new checks to the help test to prevent those in the future. Plus a little refactoring/cleanup where necessary. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Merge pull request #6676 from lsm5/tag-correctionOpenShift Merge Robot2020-06-20
|\ | | | | Account for non-default port number in image name
| * Account for non-default port number in image nameLokesh Mandvekar2020-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if an image was tagged with the format $REGISTRY:$PORT/$REPO:$TAG, then `podman images` would display $PORT/$REPO:$TAG under the "TAG" field. This commit correctly displays $REGISTRY:$PORT/$REPO under the "REPOSITORY" field while the "TAG" field only displays $TAG. Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org> Fixes: gh#6665
* | Fixes #6670Jhon Honce2020-06-19
|/ | | | | | | * Sort images for -q option, removing duplicate id's * Sort images for --format json Signed-off-by: Jhon Honce <jhonce@redhat.com>
* podman images --format json: pretty printValentin Rothberg2020-06-19
| | | | | | | | | Pretty print the JSON output when listing images. We regressed on that during v2 development. The indentation is now identical to the one of Podman v1.9.3. Fixes: #6687 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Fixup issues found by golintDaniel J Walsh2020-06-10
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* images --no-trunc: fix ID formattingValentin Rothberg2020-06-02
| | | | | | | Remove the redundant `sha256:` prefix from the image IDs. Fixes: #6459 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Attempt to turn on additional build testsDaniel J Walsh2020-05-22
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix remote handling of podman images callsDaniel J Walsh2020-05-21
| | | | | | | Enable three more tests Fix handling of image filters Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* V2 Restore images list testsJhon Honce2020-04-29
| | | | | | | | * Fix history --quiet formatting * Fix image inspect --format=json * Fix image list --sort Signed-off-by: Jhon Honce <jhonce@redhat.com>
* system tests must passBrent Baude2020-04-28
| | | | Signed-off-by: Brent Baude <bbaude@redhat.com>
* Provide a json variable pointing to a configured json APIJhon Honce2020-04-21
| | | | | | | | * All commands now using the same instance of json API * `json` variable created in each package to prevent `encoding/json` from being re-introduced Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Fixes for system testsBrent Baude2020-04-17
| | | | | | Various fixes to protect against regressions in system tests Signed-off-by: Brent Baude <bbaude@redhat.com>
* Podman V2 birthBrent Baude2020-04-16
remote podman v1 and replace with podman v2. Signed-off-by: Brent Baude <bbaude@redhat.com>