For macOS, you could install openconnect via brew
Then create openconnect script to connect and disconnect
#!/bin/bash
sudo openconnect -b -q --protocol=anyconnect <your-host-domain> << delimiter
<your-ocserv-username>
<your-ocserv-password>
delimiter
At last, you could grant the scripts and create link and a shell command
sudo ln -s <your-connect-script> /usr/local/bin/anyconnect
sudo ln -s <your-disconnect-script> /usr/local/bin/kill-anyconnect
Now you could use shell command anyconnect and kill-anyconnect to manage your connect.
For macOS, you could install openconnect via brew
Then create openconnect script to connect and disconnect
At last, you could grant the scripts and create link and a shell command
Now you could use shell command
anyconnectandkill-anyconnectto manage your connect.