lando/hyperdrive

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:

  1. We should do this in pure javascript eg no dependencies should be required like lodash or minimist
  2. if the DEBUG envvar is set and not empty we should skip our debug handling. it would be nice if in our init.js hook we had some debug output that indicated this eg something like DEBUG envvar is set, ignoring --debug in favor of that

In terms of development order of operations i would recommend

  1. just proof of concept the must haves above directly in bin/hyperdrive
  2. when that works as expected move it into its own module/file in utils/argv.js or something
  3. require it in /bin/hyperdrive and use it that way
  4. 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
  5. write unit tests for it