Make port arg optional in `docker compose port`
What I did
This comand no longer needs a mandatory port. If no port is provided it will instead list all published ports. This behavior falls in line with the behavior provided by docker port.
Related issue Closes #11859.
Thanks for the review, I have taken care of your observations.
while not strictly required, I think we should use this opportunity while revisiting this command to add support for app_protocol and port name (https://github.com/compose-spec/compose-spec/blob/master/05-services.md#long-syntax-3)
while not strictly required, I think we should use this opportunity while revisiting this command to add support for app_protocol and port name (https://github.com/compose-spec/compose-spec/blob/master/05-services.md#long-syntax-3)
Wow, did not even know those existed. How do you envision it? Allow filtering? Or just displaying the name and app_protocol if they exist for the given port?
Went ahead and changed backend.Port so it returns a slice of publishers. That should fix other issues like dealing with --index. Since I was modifying PortPublisher I went ahead and also changed its port members to be uint16 so it falls in line with types.Port
I think the only thing left is the question about --index incompatibility, and support for app_protocol and port name,
--index is used to select service replica, already implemented in backend.Port calling getSpecifiedContainer
Adding support for app_protocol would not be that simple, as such metadata only exists in compose model, not in actual resources. Let's keep this for a future improvement