Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2413 - cli/command: fix docstring for ContainerFormat.CreatedAt and add CreatedAtTimestamp #4379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonathanJamesRasmussen
Copy link

- What I did
Fixed docstring error and added function as described in #2413

- How I did it
Same as above

- How to verify it
See code diff

- Description for the changelog

Fixed ContainerFormat.CreatedAt() docstring and added ContainerFormat.CreatedAtTimestamp()

- A picture of a cute animal (not mandatory but encouraged)
baby turtle

…dAtTimestamp

Signed-off-by: Jonathan Rasmussen <contact@jonathanjrasmussen.com>
func (c *ContainerContext) CreatedAt() string {
return time.Unix(c.c.Created, 0).String()
}

// CreatedAtTimestamp returns the "Created" date/time of the container as a unix timestamp.
func (c *ContainerContext) CreatedAtTimestamp() time.Time {
return time.Unix(c.c.Created, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should just return c.Created as-is (and perhaps the function be named Created(), and probably needs an entry in the "headers" (when used for table-view). Do we need to look at other formatters?

I'm slightly considering if we should have an option to expose the Container itself for formatting (have .Container() function that returns c.c)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. What benefit would there be to simply returning the Container directly as opposed to presenting these APIs? That feels like a potential leaky abstraction to me, but that's just a gut feeling.

I could definitely see these as redundant since the Container does have Created accessible, but having other modules do the formatting seems like we could end up with a lot of duplication unless we had an interface to standardize that. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants