Open vanstee opened 8 years ago
I wonder if commands should receive a list of args, a map of options, and the input... things we've already extracted from ENV
and STDIN
. That might also make testing easier, since you wouldn't need to manually reproduce all the various COG_X
variables.
Yeah, that's essentially what's happening since those are bundled up in a request
object. I'd be ok with breaking those out though. I'm pretty much a fan of anything that helps us remove random access to ENV
from inside an instance.
initialize
should receive request as argumentrender("users", json)
run_command
return render("users", json)
, althoughrender("users", json) and return
should currently workfail
abort
it does the same thing (prints message and exit 1)run_command
Most of these improvements are to make testing simpler as most data can be more easily mocked out. Warning untested sudo-y code below, but notice there aren't any crazy mocks and stubs other than just a client being stubbed out.