2007-09-22 04:52:12 +08:00
|
|
|
function __fish_print_interfaces --description "Print a list of known network interfaces"
|
2016-11-28 13:27:22 +08:00
|
|
|
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
|
2016-11-28 13:27:22 +08:00
|
|
|
else # OSX/BSD
|
2017-12-11 22:16:52 +08:00
|
|
|
set -l os (uname)
|
|
|
|
if string match -e -q "BSD" -- $os
|
|
|
|
command ifconfig | string match -e -r '^[a-z]' | string replace -r ':.*' '' | string split ' '
|
|
|
|
else
|
|
|
|
command ifconfig -l | string split ' '
|
|
|
|
end
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2007-09-22 04:52:12 +08:00
|
|
|
end
|