Add format flag to network inspect#17481
Conversation
|
Thanks, @vdemeester. Two things, first: Second, not all keys are available.
|
|
@albers It's probably because it needs to be Agreed, this is stinky, really we have the same issue on |
|
Maybe we can just inspect against the raw json? |
|
@cpuguy83 not sure what you mean on that ; reading the json and applying our template/format ? I did the simplest implementation ever (which looks almost exactly as |
|
Yeah, but volume inspect's json output matches the struct type...for now. |
|
If you unmarshal to |
|
@cpuguy83 ok, sounds pretty good to me, I'll try that 😉 |
|
@cpuguy83 Using All lowercase, feels a little bit strange compared to others Edit: oh well, that's how it's specified in https://github.com/docker/docker/blob/master/api/types/types.go#L337 so.. might be ok then 😅. |
7d1fe9e to
c61052f
Compare
|
I created an issue (#17519) that the output of |
|
The api respects the types now and we don't need to use interfaces or maps here anymore 🎉 |
api/client/network.go
Outdated
There was a problem hiding this comment.
you shouldn't execute directly on cli.out, otherwise you might end up printing partial results.
There was a problem hiding this comment.
@calavera I should put it into a buffer and push it to cli.out at the end ?
c61052f to
4de1002
Compare
|
Rebased against master. @calavera did the same as |
4de1002 to
7126b87
Compare
|
I just found another issue on this, since this PR hasn't been merged yet, I think it's better to modify in this commit. I think it's better for them to have consistent behavior. |
|
I agree with you @WeiZhang555. I think the best consistent behavior is to not print any inspect output if the object doesn't exist, like the volume command does. |
|
This would mean : $ docker network inspect aaaa bbbbb # where bbbbb exists
Error response from daemon: no such network: aaaa
[{
# // …
}]I'm ok with that 😉. I'll update this PR to reflect that, and probably open more to get the behavior consistent on other inspect if needed. |
7126b87 to
acc9154
Compare
|
❤️ ❤️ |
|
LGTM. It will need documentation though 😜 |
acc9154 to
0c80a36
Compare
|
@calavera updated with some docs 😉 ping @thaJeztah for docs, ping @albers @sdurrheimer for completion I just added 😉 |
|
thanks @vdemeester . LGTM |
contrib/completion/bash/docker
Outdated
There was a problem hiding this comment.
This is not sufficient: As this option takes an argument, you also have to deal with that, see https://github.com/docker/docker/blob/master/contrib/completion/bash/docker#L985 for an example.
There was a problem hiding this comment.
Ah I see, will update 😉
0c80a36 to
a8cdc38
Compare
|
Updated, thanks guys @albers @sdurrheimer |
|
LGTM |
|
Thanks a lot, Vincent. |
a8cdc38 to
0368d61
Compare
|
LGTM |
|
moving to docs review ping @thaJeztah @moxiegirl |
There was a problem hiding this comment.
can you add this text to the man page as well?
|
Thanks @vdemeester one note, but LGTM otherwise! |
|
LGTM @vdemeester thank you! ⭐ |
…for consistency as docker inspect and docker volume inspect supports it too Signed-off-by: Vincent Demeester <[email protected]>
0368d61 to
295c273
Compare
|
@thaJeztah @moxiegirl updated 😉 |
|
Thanks! LGTM! |
Add format flag to network inspect
…for consistency as docker inspect and docker volume inspect supports it too 🐙.
$ docker network inspect -f "{{.Name}}" bridge host bridge hostCloses #17446
/ping @albers @mavenugo
🐸
Signed-off-by: Vincent Demeester [email protected]