Configure secure web proxy on macOS via command line

Set secure web proxy on Wi-Fi
networksetup -setsecurewebproxy Wi-Fi "127.0.0.1" "1234"
Set secure web proxy on Ethernet
networksetup -setsecurewebproxy Ethernet "127.0.0.1" "1234"
Turn secure web proxy on
networksetup -setsecurewebproxystate Ethernet 1
Turn secure web proxy off
networksetup -setsecurewebproxystate Ethernet 0
To get more interesting things about network automation read this note.