Closed OddBloke closed 3 years ago
For a native way to do this, you could PR new operator (!
or negate
?) that works similar to grab, but only for booleans, and flips the value.
For a non-native way, you could move that boolean out of settings.yml, and set it as two environment variables, one for the setting, and one using logic in bash to negate it.
We're using
spruce
to merge asettings.yml
into a Concoursepipeline.yml
template (a la https://github.com/starkandwayne/pipeline-templates). I want to add a meta boolean flag to control a behaviour which requires setting boolean values in multiple places in the template. Of course, I'm usinggrab
to handle this, but I've run into a problem: some of the values I want to set should match the flag value (i.e.my_bool
istrue
=> those settings aretrue
), but some are negated (i.e.my_bool
istrue
=> those settings arefalse
). AFAICT, I can only usegrab
to fill in the matching settings: I would also like to be able to fill in the negated settings.(Apologies if I missed existing support for this!)