3

I am creating a custom completion for my command ipadd which will automatically complete all the network devices for OS X. It has a parameter --device which allows you to specify the network devices on the system.

The command to list the network devices in OS X is

networksetup -listallnetworkservices

The output for it is;

An asterisk (*) denotes that a network service is disabled.
Ethernet
Wi-Fi

However the first line of the command isn't the network interface and I have modified that command about so that it only shows Ethernet and Wi-Fi

networksetup -listallnetworkservices | sed -n '2,$p'

The output for this is;

Ethernet
Wi-Fi

My question is how can I store that command and use it for auto completion for my ipadd command. I know that you can use the _files but that is for completing files within the system.

Thanks in advance :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.