docker-compose
docker-compose copied to clipboard
Streamline the all, many, one commands
Hello,
Thanks for helping us use compose through Node.JS :-).
Looking at the API, I was wondering why many functions are tripled with All
, Many
and One
instead of using a TS signature close to command(services?: string | string[], options?)
.
I am not fluent in TS, I basically use plain JS for my day to day programming so I might be wrong...
I was also wondering why there is no pushOne
or pushMany
.
TypeScript is similar to JavaScript. After all, it's a superset of it.
Commands being split like that help detect issues while writing code. While one could argue that One
is variation of Many
, where you pass an array containing only a single element (kinda), All
removes any ambiguity in the initial argument (does empty array mean all services, or none? Maybe null
means all?).
Other than that, there is no specific reason. It was easier to write them like that, since then there was no need for any logic inside that would handle the cases.
I'm not sure about push
though :sweat_smile:
Spring cleaning time! I completely forgot to close this one, doing it now as the PR has been merged for quite some time now.