Selecting exit node from a Mac via scripting?

Hi,

I’m using https://www.hammerspoon.org/ on my Mac and would like to be able to enable and disable using an exit node with a script - is this possible. Either a bash script or something around MacOS Automator?

OK just realised there are MacOS shortcuts which work perfectly with Hammerspoon if anyone finds this and needs the answer!