Add --format to docker service ls#28199
Conversation
|
SGTM, can you add tests? |
|
Design SGTM 👼 |
cli/command/service/list.go
Outdated
There was a problem hiding this comment.
I wonder if we should consider introducing ShortID and/or TruncID placeholders. The TruncID placeholder has the behavior of what ID has now (so, truncated by default, but show full ID if --trunc is added. That way people can define a template where the output always has the full-id, or has an ID that can be truncated or full.
There was a problem hiding this comment.
@thaJeztah does that mean we will leave ID alone regardless of --no-trunc=false/true, and only trunc TruncID based on --no-trunc=true?
There was a problem hiding this comment.
@yongtang perhaps, yes. My initial thought was "do we need a --no-trunc flag? That's when I started thinking if we perhaps need other options for the format.
It's just a thought though, so perhaps @vdemeester or @dnephin has some thoughts
There was a problem hiding this comment.
Same though as @thaJeztah, I don't really like --no-trunc flag, especially since format uses go template. We could provide a function that shorten "or not" the ID : --format="{{ .ID | shorten }}" or something like that.
1e001a5 to
c5ba328
Compare
|
@AkihiroSuda Added a test for the PR. |
|
Design LGTM, let's keep #28199 (comment) for another discussion |
|
ping @yongtang, needs a rebase 👼 |
c5ba328 to
9113044
Compare
|
Thanks @vdemeester. The PR has been rebased. |
|
9113044 to
c411a9b
Compare
|
Thanks @AkihiroSuda. The PR has been updated with golint issue addressed. |
vdemeester
left a comment
There was a problem hiding this comment.
Few comments 👼
I do agree with @thaJeztah on the --no-trunc flags (on other commands as well but 😅)
cli/command/service/list.go
Outdated
There was a problem hiding this comment.
Same though as @thaJeztah, I don't really like --no-trunc flag, especially since format uses go template. We could provide a function that shorten "or not" the ID : --format="{{ .ID | shorten }}" or something like that.
cli/command/service/list.go
Outdated
There was a problem hiding this comment.
This else is empty right ? should go 👼
cli/command/service/list.go
Outdated
There was a problem hiding this comment.
Should/Could this return a map of struct instead, with mode and replica in the struct, instead of two maps ? 👼
45533cd to
09edc91
Compare
|
@vdemeester @thaJeztah Thanks for the review. The PR has been updated and now |
There was a problem hiding this comment.
I wonder this test can be moved to UT, but it can be another PR in the future
There was a problem hiding this comment.
I wonder we should have two separate placeholders e.g. RunningReplicas and AllReplicas.
WDYT?
There was a problem hiding this comment.
@AkihiroSuda I feel like that means we introduce new concepts that does not necessary match the existing Table header. Should we change the table header to RUNNING/ALL REPLICAS? Or maybe we could leave it alone for now?
There was a problem hiding this comment.
I think it is ok to introduce all .Replicas, .RunningReplicas, and .AllReplicas.
But it is ok to leave it alone for now.
09edc91 to
6bf3b16
Compare
|
@yongtang hm, okay discussed this in the maintainers meeting, and we think it would be better to put the (sorry 😄) |
6bf3b16 to
e60ec5d
Compare
|
Thanks @thaJeztah. The PR has been updated. Also created another PR #30484 for Also in this PR I didn't add the |
|
Moving to docs-review |
vdemeester
left a comment
There was a problem hiding this comment.
@yongtang Could you update docs/reference/commandline/cli.md to add an example for ServicesFormat ?
|
Thanks @vdemeester. The docs has been updated in the PR. Please take a look and let me know if there are any issues. |
e60ec5d to
90e4711
Compare
This fix tries to improve the display of `docker service ls` and adds `--format` flag to `docker service ls`. In addition to `--format` flag, several other improvement: 1. Updates `docker stacks service`. 2. Adds `servicesFormat` to config file. Related docs has been updated. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
90e4711 to
000f040
Compare
vdemeester
left a comment
There was a problem hiding this comment.
docs LGTM 🐸
/cc @thaJeztah for docs revisit
Add `--format` to `docker service ls`
- What I did
This fix tries to improve the display of
docker service lsand adds--formatflag todocker service ls.In addition to
--formatflag, several other improvement:--no-trunctodocker service lsdocker stacks service.servicesFormatto config file.Related docs has been updated.
cc @thaJeztah @vdemeester @dnephin
- A picture of a cute animal (not mandatory but encouraged)
Signed-off-by: Yong Tang yong.tang.github@outlook.com