Closed phlogistonjohn closed 5 months ago
cc: @avanthakkar - for an additional review & peek into this code base
:tada: All dependencies have been resolved !
I noticed a stray debugging print statement was still in the unit test file. It's now removed.
Depends on: #119
Previously, sambacc had the
--skip-if-file=
command line option that would skip running a command if a named file exists. I have a need for doing something similar for environment variable contents. In order to avoid needing to add a plethora of new --skip-if-x type options over time, add a more generic--skip-if=
option and have the value contain an initial prefix likefile:
orenv:
that determines how the rest of the value will be parsed and how the skip will be determined (or not). Deprecate--skip-if-file
.Maybe it's a case of over engineering, but at least it's easy to unit test.
Examples:
--skip-if=env:CHAT==yes
, if the environment variableCHAT
contains a value equal to "yes" the command will be skipped--skip-if=file:/foo/bar
if the file/foo/bar
exists the command will be skipped--skip-if=file:!/foo/bar
if the file/foo/bar
does not exist the command will be skipped--skip-if=env:MODE!=777
, if the environment variableMODE
contains a value not equal to "777" the command will be skipped--skip-if=always:
, always skip this command (mainly to be used for testing/hacking on things)