resholve icon indicating copy to clipboard operation
resholve copied to clipboard

idiom for errors conditional on other resolutions?

Open abathur opened this issue 4 years ago • 0 comments

I'll start off by saying that I suspect this fruit is too high up the tree to bother with.

I stumbled on the following in bats-core:

local hostname="${HOST:-}"
[[ -z "$hostname" ]] && hostname="${HOSTNAME:-}"
[[ -z "$hostname" ]] && hostname="$(uname -n)"
[[ -z "$hostname" ]] && hostname="$(hostname -f)"

The most-principled resolution would be to only require one of these (since the idea of needing to try multiple is exactly the kind of problem resholve eats for lunch). resholve can't know about the initial environment, the best it could do is stop after the first that it finds in the script/env.

The simple approach is to just make the user choose whether they want to supply/exempt each--this will inevitably be the only choice for a while.

For resholve to do this on its own, it'd need to evaluate these conditionals--and I'm very sure that's too far up the tree.

abathur avatar Jan 12 '21 03:01 abathur