Merge pull request #856 from umohnani8/kpod_ps
Slight modification to kpod ps based on QE feedback
This commit is contained in:
commit
77db25f5bb
2 changed files with 3 additions and 3 deletions
|
@ -85,6 +85,7 @@ var (
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "last, n",
|
Name: "last, n",
|
||||||
Usage: "Print the n last created containers (all states)",
|
Usage: "Print the n last created containers (all states)",
|
||||||
|
Value: -1,
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "latest, l",
|
Name: "latest, l",
|
||||||
|
@ -149,7 +150,7 @@ func psCmd(c *cli.Context) error {
|
||||||
|
|
||||||
// all, latest, and last are mutually exclusive. Only one flag can be used at a time
|
// all, latest, and last are mutually exclusive. Only one flag can be used at a time
|
||||||
exclusiveOpts := 0
|
exclusiveOpts := 0
|
||||||
if opts.last > 0 {
|
if opts.last >= 0 {
|
||||||
exclusiveOpts++
|
exclusiveOpts++
|
||||||
}
|
}
|
||||||
if opts.latest {
|
if opts.latest {
|
||||||
|
@ -225,7 +226,7 @@ func (p *psTemplateParams) headerMap() map[string]string {
|
||||||
// getContainers gets the containers that match the flags given
|
// getContainers gets the containers that match the flags given
|
||||||
func getContainers(containers []*libkpod.ContainerData, opts psOptions) []*libkpod.ContainerData {
|
func getContainers(containers []*libkpod.ContainerData, opts psOptions) []*libkpod.ContainerData {
|
||||||
var containersOutput []*libkpod.ContainerData
|
var containersOutput []*libkpod.ContainerData
|
||||||
if opts.last > 0 && opts.last < len(containers) {
|
if opts.last >= 0 && opts.last < len(containers) {
|
||||||
for i := 0; i < opts.last; i++ {
|
for i := 0; i < opts.last; i++ {
|
||||||
containersOutput = append(containersOutput, containers[i])
|
containersOutput = append(containersOutput, containers[i])
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ Valid placeholders for the Go template are listed below:
|
||||||
| .Size | Size of container |
|
| .Size | Size of container |
|
||||||
| .Names | Name of container |
|
| .Names | Name of container |
|
||||||
| .Labels | All the labels assigned to the container |
|
| .Labels | All the labels assigned to the container |
|
||||||
| .Label | Value of the specific label provided by the user |
|
|
||||||
| .Mounts | Volumes mounted in the container |
|
| .Mounts | Volumes mounted in the container |
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue