Better handling of DEBUG
Closed this issue · 0 comments
pirog commented
We need to improve the way we handle --debug
over here: https://github.com/lando/hyperdrive/blob/main/bin/hyperdrive#L8-L10
We need to handle the following cases
hyperdrive --debug
hyperdrive --debug="some string"
hyperdrive --debug "some string"
If no string is set then debug should be enabled with *
otherwise debug should be enabled with the string that is passed in.
Some constraints on this are:
- We should do this in pure javascript eg no dependencies should be required like lodash or minimist
- if the
DEBUG
envvar is set and not empty we should skip our debug handling. it would be nice if in ourinit.js
hook we had some debug output that indicated this eg something likeDEBUG envvar is set, ignoring --debug in favor of that
In terms of development order of operations i would recommend
- just proof of concept the must haves above directly in
bin/hyperdrive
- when that works as expected move it into its own module/file in
utils/argv.js
or something - require it in
/bin/hyperdrive
and use it that way - consider whether you want to make it a bit more generic eg can you pass in the name of the flag you want or should it only handle
--debug
- write unit tests for it