bolt
bolt copied to clipboard
Programmatic filtering
Idea:
bolt ws --when [ -f ./tsconfig.json ] -- tsc
Would we attempt to parse the test block there, or allow it to run in the shell? Any idea how we could read the return code of that with passing it in as a string 🤔?
I've written a shell script to solve my need here:
index=0
split=-1
for arg in "$@"
do
if [ "$arg" = '--' ]; then
split=$index
break
fi
index=$(expr $index + 1)
done
if [ $split -eq -1 ]; then
echo "Invalid usage, expected: run-if condition -- command"
exit 1
fi
cond=${@:0:$(expr $split + 1)}
cmd=${@:$(expr $split + 2)}
if eval $cond; then
exec $cmd
fi
Which you can then run as:
bolt ws exec -- run-if [ -f tsconfig.json ] -- tsc
Maybe bolt could have something like this built in
Never mind, the above script shits itself in different places