#compdef networksetup
# J. A. Kyle
# March 05 2009
_networksetup() {
local expl curcontext
zstyle -T ":completion:${curcontext}:files" prefix-needed && \
[[ "$PREFIX" != /* && compstate[nmatches] -ne 0 ]] && return 1
_arguments -C \
'-listnetworkserviceorder[Display services with corresponding port and device in order they are tried for connecting to a network. An asterisk (*) denotes that a service is disabled.]' \
'-listallnetworkservices[Display list of services. An asterisk (*) denotes that a network service is disabled.]' \
'-listallhardwareports[Display list of hardware ports with corresponding device name and ethernet address.]' \
'-detectnewhardware[Detect new network hardware and create a default network service on the hardware.]'\
'-getmacaddress <hardwareport or device name>[Display ethernet (or AirPort) address for hardwareport or device specified.]'\
'-getcomputername[Display the computer name.]'\
"-setcomputername <name>[Set the computer's name (if valid) to <name>.]"\
'-getinfo <networkservice>[Display IPv4 address, IPv6 address, subnet mask, router address, ethernet address for <networkservice>.]'\
'-setmanual <networkservice><ip><subnet><router>[Set the <networkservice> TCP\IP configuration to manual with IP address set to ip, Subnet Mask set to subnet, and Router address set to router.]'\
'-setdhcp <networkservice><clientid>[Set the <networkservice> TCP\IP configuration to DHCP. You can set the DHCP client id to the optional <clientid>. Specify "Empty" for <clientid> to clear the DHCP client id.]'\
'-setbootp <networkservice>[Set the <networkservice> TCP\IP configuration to BOOTP.]'\
'-setmanualwithdhcprouter <networkservice><ip> [Set the <networkservice> TCP\IP configuration to manual with DHCP router with IP address set to ip.]'\
'-setv4off <networkservice> [Turn IPv4 off on <networkservice>. ]'\
'-setv6off <networkservice> [Turn IPv6 off on <networkservice>. ]'\
'-setv6automatic <networkservice> [Set the service to get its IPv6 info automatically. ]'\
'-setv6manual <networkservice><address><prefixlength><router>[Set the service to get its IPv6 info manually. Specify <address><prefixLength> and <router>.]'\
'-getdnsservers <networkservice>[Display DNS info for <networkservice>.]'\
'-setdnsservers <networkservice><dns1><dns2><...> [Set the <networkservice> DNS servers to <dns1><dns2><...>. Any number of dns servers can be specified. Specify "Empty" for <dns1> to clear all DSN entries.]'\
'-getsearchdomains <networkservice>[Display Domain Name info for <networkservice>.]'\
'-setsearchdomains <networkservice><domain1><domain2><...> [Set the <networkservice> Domain Name servers to <domain1w <domain2><...>. Any number of Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries.]'\
'-create6to4service <newnetworkservicename> [Create a 6 to 4 service with name <newnetworkservicename>.]'\
'-set6to4automatic <networkservice> [Set the service to get its 6 to 4 info automatically. ]'\
'-set6to4manual <networkservice><relayaddress>[Set the service to get its 6 to 4 info manually. Specify <relayaddress> for the relay address.]'\
'-getftpproxy <networkservice>[Display FTP proxy (server, port, enabled value) info for <networkservice>.]'\
'-setftpproxy <networkservice><domain><port number><authenticated><username><password>[Set FTP proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setftpproxystate <networkservice><on off>[Set FTP proxy to either <on> or <off>.]'\
'-getwebproxy <networkservice>[Display Web proxy (server, port, enabled value) info for <networkservice>.]'\
'-setwebproxy <networkservice><domain><port number><authenticated><username><password>[Set Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setwebproxystate <networkservice><on off>[Set Web proxy to either <on> or <off>.]'\
'-getsecurewebproxy <networkservice>[Display Secure Web proxy (server, port, enabled value) info for <networkservice>.]'\
'-setsecurewebproxy <networkservice><domain><port number><authenticated><username><password>[Set Secure Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setsecurewebproxystate <networkservice><on off>[Set SecureWeb proxy to either <on> or <off>.]'\
'-getstreamingproxy <networkservice>[Display Streaming proxy (server, port, enabled value) info for <networkservice>.]'\
'-setstreamingproxy <networkservice><domain><port number><authenticated><username><password>[Set Streaming proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setstreamingproxystate <networkservice><on off>[Set Streaming proxy to either <on> or <off>.]'\
'-getgopherproxy <networkservice>[Display Gopher proxy (server, port, enabled value) info for <networkservice>.]'\
'-setgopherproxy <networkservice><domain><port number><authenticated><username><password>[Set Gopher proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setgopherproxystate <networkservice><on off>[Set Gopher proxy to either <on> or <off>.]'\
'-getsocksfirewallproxy <networkservice>[Display SOCKS Firewall proxy (server, port, enabled value) info for <networkservice>.]'\
'-setsocksfirewallproxy <networkservice><domain><port number><authenticated><username><password>[Set SOCKS Firewall proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setsocksfirewallproxystate <networkservice><on off>[Set SOCKS Firewall proxy to either <on> or <off>.]'\
'-getproxybypassdomains <networkservice>[Display Bypass Domain Names for <networkservice>.]'\
'-setproxybypassdomains <networkservice><domain1><domain2><...>[Set the Bypass Domain Name Servers for <networkservice> to <domain1><domain2><...>. Any number of Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries.]'\
'-getpassiveftp <networkservice>[Display whether Passive FTP is on or off for <networkservice>.]'\
'-setpassiveftp <networkservice><on off>[Set Passive FTP to either <on> or <off>.]'\
'-setautoproxyurl <networkservice><url>[Set proxy auto-config to url for <networkservice> and enable it.]'\
'-getautoproxyurl <networkservice>[Display proxy auto-config (url, enabled) info for <networkservice>.]'\
'-setautoproxystate <networkservice><on off>[Set proxy auto-config to either <on> or <off>.]'\
'-getairportnetwork[Display current AirPort Network.]'\
'-setairportnetwork <network><password>[Set AirPort Network to <network> using optional <password> if specified.]'\
'-getairportpower[Display whether AirPort power is on or off.]'\
'-setairportpower <on off>[Set AirPort power to either <on> or <off>.]'\
'-getnetworkserviceenabled <networkservice>[Display whether a service is on or off (enabled or disabled).]'\
'-setnetworkserviceenabled <networkservice><on off>[Set <networkservice> to either <on> or <off> (enabled or disabled).]'\
'-createnetworkservice <newnetworkservicename><hardwareport>[Create a service named <networkservice> on port <hardwareport>. The new service will be enabled by default.]'\
'-renamenetworkservice <networkservice><newnetworkservicename>[Rename <networkservice> to <newnetworkservicename>.]'\
'-duplicatenetworkservice <networkservice><newnetworkservicename>[Duplicate <networkservice> and name it with <newnetworkservicename>.]'\
'-removenetworkservice <networkservice>[Remove the service named <networkservice>. Will fail if this is the only service on the hardware port that <networkservice> is on.]'\
'-ordernetworkservices <service1><service2><service3><...>[Order the services in order specified. Use "-listnetworkserviceorder" to view service order. Note: use quotes around service names which contain spaces (ie. "Built-in Ethernet").]'\
'-getappletalk <networkservice>[Display whether AppleTalk is on or off (enabled or disabled) on <networkservice>.]'\
'-setappletalk <networkservice><on off>[Set AppleTalk to either <on> or <off> (enabled or disabled) on <networkservice>.]'\
'-setMTUAndMediaAutomatically <hardwareport or device name>[Set hardwareport or device specified back to automatically setting the MTU and Media.]'\
'-getMTU <hardwareport or device name>[Get the MTU value for hardwareport or device specified.]'\
'-setMTU <hardwareport or device name><value>[Set MTU for hardwareport or device specified.]'\
'-listvalidMTUrange <hardwareport or device name>[List the valid MTU range for hardwareport or device specified.]'\
'-getmedia <hardwareport or device name>[Show both the current setting for media and the active media on hardwareport or device specified.]'\
'-setmedia <hardwareport or device name><subtype><option1><option2><...>[Set media for hardwareport or device specified to subtype. Specify optional <option1> and additional options depending on subtype. Any number of valid options can be specified.]'\
'-listvalidmedia <hardwareport or device name>[List valid media options for hardwareport or device name. Enumerates available subtypes and options per subtype.]'\
'-createVLAN <VLAN name><device name><tag>[Create a VLAN with name <VLAN name> over device <device name> with unique tag <tag>. A default network service will be created over the VLAN.]'\
'-deleteVLAN <VLAN name><device name><tag>[Delete the VLAN with name <VLAN name> over the parent device <device name> with unique tag <tag>. If there are network services running over the VLAN they will be deleted.]'\
'-listVLANs[List the VLANs that have been created.]'\
'-listdevicesthatsupportVLAN[List the devices that support VLANs.]'\
'-isBondSupported <device name ie., en0>[Return YES if the specified device can be added to a bond. NO if it cannot.]'\
'-createBond <user defined name><device name 1><device name 2><...>[Create a new bond and give it the user defined name. Add the specified devices, if any, to the bond.]'\
'-deleteBond <bond name ie., bond0>[Delete the bond with the specified device-name.]'\
'-addDeviceToBond <device name><bond name> [Add the specified device to the specified bond.]'\
'-removeDeviceFromBond <device name><bond name>[Remove the specified device from the specified bond]'\
'-listBonds[List all of the bonds.]'\
'-showBondStatus <bond name ie., bond0>[Display the status of the specified bond.]'\
'-listpppoeservices[List all of the PPPoE services in the current set.]'\
'-showpppoestatus <service name ie., MyPPPoEService>[Display the status of the specified PPPoE service.]'\
'-createpppoeservice <device name ie., en0><service name><account name><password><pppoe service name>[Create a PPPoE service on the specified device with the service name specified. The "pppoe service name" is optional and may not be supported by the service provider.]'\
'-deletepppoeservice <service name>[Delete the PPPoE service.]'\
'-setpppoeaccountname <service name><account name>[Sets the account name for the specified service.]'\
'-setpppoepassword <service name><password>[Sets the password stored in the keychain for the specified service.]'\
'-connectpppoeservice <service name>[Connect the PPPoE service.]'\
'-disconnectpppoeservice <service name>[Disconnect the PPPoE service.]'\
'-version[Display version of networksetup tool.]'\
'-help[Display these help listings.]'\
'-printcommands[Displays a quick listing of commands (without explanations).]'
}