fish-shell/share/functions/__fish_print_interfaces.fish

14 lines
498 B
Fish
Raw Normal View History

function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net
2017-01-19 01:50:43 +08:00
set -l interfaces /sys/class/net/*
string replace /sys/class/net/ '' $interfaces
else # OSX/BSD
2017-12-11 22:16:52 +08:00
set -l os (uname)
if string match -e -q BSD -- $os
2017-12-11 22:16:52 +08:00
command ifconfig | string match -e -r '^[a-z]' | string replace -r ':.*' '' | string split ' '
else
command ifconfig -l | string split ' '
end
end
end