mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
add {{.RunningFor}} placeholder in ps --format
For docker compatibility Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
@ -307,6 +307,10 @@ func (l psReporter) Status() string {
|
|||||||
return l.State()
|
return l.State()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l psReporter) RunningFor() string {
|
||||||
|
return l.CreatedHuman()
|
||||||
|
}
|
||||||
|
|
||||||
// Command returns the container command in string format
|
// Command returns the container command in string format
|
||||||
func (l psReporter) Command() string {
|
func (l psReporter) Command() string {
|
||||||
command := strings.Join(l.ListContainer.Command, " ")
|
command := strings.Join(l.ListContainer.Command, " ")
|
||||||
|
@ -476,5 +476,13 @@ var _ = Describe("Podman ps", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("echo very long cr..."))
|
Expect(session.OutputToString()).To(ContainSubstring("echo very long cr..."))
|
||||||
})
|
})
|
||||||
|
It("podman ps --format {{RunningFor}}", func() {
|
||||||
|
_, ec, _ := podmanTest.RunLsContainer("")
|
||||||
|
Expect(ec).To(Equal(0))
|
||||||
|
|
||||||
|
result := podmanTest.Podman([]string{"ps", "-a", "--format", "{{.RunningFor}}"})
|
||||||
|
result.WaitWithDefaultTimeout()
|
||||||
|
Expect(result.ExitCode()).To(Equal(0))
|
||||||
|
Expect(result.OutputToString()).To(ContainSubstring("ago"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user