OpenOCD is scriptable/configurable using a small variant of TCL called JimTcl.
https://openocd.org
https://jim.tcl.tk/index.html/doc/www/www/index.html