Skip to content

Carry #10255: Docker ps format#14699

Merged
calavera merged 3 commits intomoby:masterfrom
estesp:docker-ps-format
Jul 22, 2015
Merged

Carry #10255: Docker ps format#14699
calavera merged 3 commits intomoby:masterfrom
estesp:docker-ps-format

Conversation

@estesp
Copy link
Contributor

@estesp estesp commented Jul 17, 2015

Include original #10255 PR content, replace field selection/output implementation with Go template version from @calavera PR #12931

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we should have this here since this info, I think, is just specific for one command and should probably live in the ps.go file. If we ever get to the point where each command is an independent exe then the common/config-info shouldn't have any cmd specific info as that would break composibility.
Is there any reason this must be in here instead of ps.go?

Copy link
Contributor

Choose a reason for hiding this comment

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

never mind - I see now that this is part of the config file - so this makes sense!

@calavera
Copy link
Contributor

thanks for adding all those tests ❤️

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test with multiple Names to verify that with --no-trunc we see 'em all but w/o it we only see one?

@duglin
Copy link
Contributor

duglin commented Jul 17, 2015

Just one suggestion about an additional test but aside from that LGTM!

@estesp
Copy link
Contributor Author

estesp commented Jul 20, 2015

@duglin FYI--test added for mutli-names with --no-trunc and using formatter

@calavera
Copy link
Contributor

@estesp it looks like there is a racy test. Maps are not guaranteed to be ordered.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked and I couldn't find a test that used --link and didn't use --no-trunc - do you see one? If not it might be good to add one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the test to do both given we already have linked containers running in the same test

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!!

@estesp estesp force-pushed the docker-ps-format branch from 219f042 to ff2bc19 Compare July 21, 2015 02:40
* api/client/ps.go: Refactor CmdPs to use a fields list of
  characters to determine which columns to print on `docker ps`
  invocation.

This adds an ability for the docker command to print the columns of
output in arbitrary order.

Signed-off-by: Jeff Mickey <[email protected]>

Docker-DCO-1.1-Signed-off-by: Jeff Mickey <[email protected]>
@estesp estesp force-pushed the docker-ps-format branch from ff2bc19 to a397cfb Compare July 21, 2015 02:46
Docker-DCO-1.1-Signed-off-by: David Calavera <[email protected]>
@estesp estesp force-pushed the docker-ps-format branch from a397cfb to b362891 Compare July 21, 2015 02:54
@estesp
Copy link
Contributor Author

estesp commented Jul 21, 2015

@calavera thanks for catching that; I've updated the test to use maps with reflect.DeepEqual if there are comma-separated values in the expected and actual result--given this code is only used for this test, I did not add a lot of error checking/validation of input as the inputs are well-known and hardcoded a few lines above.

@SvenDowideit
Copy link
Contributor

@estesp can you please add the same documentation to docs/reference/commandline/ps.md ?

@estesp estesp force-pushed the docker-ps-format branch from b362891 to 0811286 Compare July 21, 2015 13:58
@estesp
Copy link
Contributor Author

estesp commented Jul 21, 2015

@SvenDowideit good catch; I've added text to reference/commandline/ps.md -- please let me know if sufficient or any review comments.

@duglin
Copy link
Contributor

duglin commented Jul 21, 2015

code LGTM

Copy link
Member

Choose a reason for hiding this comment

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

Could you add a reference here / describe that the psFormat is a string containing a Go template?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a link to the Formatting section in ps.md is actually best; it describes the format in detail

@tiborvass
Copy link
Contributor

@estesp I'm +1 on removing -F, --format should suffice. We can always change our minds later if we have to.

@calavera
Copy link
Contributor

It looks like everyone agrees to remove -F. @estesp can you make that change?

Re-add the docs from @calavera's PR to the moved cli cmd reference docs.
Fix gofmt and vet issues from carried commits
Add integration test for using format with --no-trunc and multi-names
Fix custom_test map order dependency on expected value check
Add docs to reference/commandline/ps.md
Remove "-F" flag option from original carried PR content

Docker-DCO-1.1-Signed-off-by: Phil Estes <[email protected]> (github: estesp)
@estesp estesp force-pushed the docker-ps-format branch from cc807e9 to 542b58d Compare July 22, 2015 16:51
@estesp
Copy link
Contributor Author

estesp commented Jul 22, 2015

Thanks everyone-- -F is gone from implementation and docs, and link from "cliconfig" settings section to ps.md is added (and tested with make docs).

@thaJeztah
Copy link
Member

Thanks @estesp! re-LGTM for the docs (and removal of -F)

@calavera
Copy link
Contributor

LGTM

calavera added a commit that referenced this pull request Jul 22, 2015
@calavera calavera merged commit 40b9224 into moby:master Jul 22, 2015
@calavera
Copy link
Contributor

🎉 💃

Copy link
Member

Choose a reason for hiding this comment

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

We're getting a side-effect from this PR (and I think it's this specific line causing it) where docker ps when you have no containers now prints a single blank line instead of an empty header row (like docker ps used to and docker images still does).

Copy link
Member

Choose a reason for hiding this comment

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

I have an idea to fix it and am working on a PR now.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @tianon!

@vieux
Copy link
Contributor

vieux commented Aug 6, 2015

@calavera can we have the same in images :D

@thaJeztah
Copy link
Member

@vieux PRs are always welcome 😉

@thaJeztah
Copy link
Member

@tianon is #14699 (comment) still an issue?

@estesp
Copy link
Contributor Author

estesp commented Aug 6, 2015

@thaJeztah that problem was fixed in #14919

@calavera
Copy link
Contributor

calavera commented Aug 6, 2015

@vieux so needy! 😝

However, I'm pretty sure we can make that logic work for several commands with a couple of interfaces more.

@thaJeztah
Copy link
Member

thanks @estesp! I noticed the comment, but no PR linked

@duglin
Copy link
Contributor

duglin commented Aug 6, 2015

@vieux see #14570

@duglin
Copy link
Contributor

duglin commented Aug 6, 2015

@vieux oops, never mind - slightly different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.