terminal – How to script Network Preferences using the CLI

As the title implies for development I enable/disable Web proxies, however doing it through the UI is slow and cumbersome its also pretty inflexible.

I’m looking to control the following checked settings:

Advanced Network Settings

I tried using the following script to identify any changes but it did not work:

defaults read > current-defaults.txt

# Do change in UI and then run the following:
defaults read > changed-defaults.txt

diff current-defaults.txt changed-defaults.txt

This answer has information but is not as specific to solve solve my needs