Making client.output
required across all functions for output consistency
#10815
Unanswered
mikedidomizio
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Idea
I was tinkering with the CLI code and I found that
output
being an optional argument for some functions was kind of odd. If I want tooutput
something, I don't want to have it dependent on if the calling function passes it in or not. It can makes things harder to debug when issues arise.I'm wondering if there's improvements to be made by having consistent passing of the
client.output
into functions? By having it required, it ensures consistent output for current and future function usages. All around better DX and debugging (also removes the need for optional chaining).getLatestVersion
For instance
getLatestVersion
hasoutput
as optional, the only place it is being used in code has output as a defined variable. The only place it's actually used as an optional arg is in the tests, but the types could be updated to have it required if we simple update the tests to useMockClient
similar togetProjectByDeployment
tests.getProjectByDeployment
getProjectByDeployment
also hasoutput
as optional. All use cases pass it in. On top of that the argument probably could be eliminated since theClient
is passed as an argument as well, andoutput
is a required part of client, you getoutput
for free.The two places it's used are here and here. Tests for this function already pass in output. So Types could be updated to make it required, optionally going the extra step and eliminating output as a separate parameter altogether.
TL;DR
output
shouldn't be optional inside functions where it's used. It can make debugging harder. Regardless, all use cases currently pass it.getProjectByDeployment
could removeoutput
altogether sinceclient
is already passed in, andoutput
is part ofclient
.P.S. I put this under ideas, not a new CLI feature, but felt better here than General
Beta Was this translation helpful? Give feedback.
All reactions