2012-06-15 17:30:10 -07:00
|
|
|
function __fish_print_mounted --description 'Print mounted devices'
|
2018-11-17 14:06:15 +01:00
|
|
|
if test -r /etc/mtab
|
2016-11-27 21:27:22 -08:00
|
|
|
# In mtab, spaces are replaced by a literal '\040'
|
|
|
|
# So it's safe to get the second "field" and then replace it
|
|
|
|
# \011 encodes a tab, \012 encodes a newline and \\ encodes a backslash
|
|
|
|
# This will probably break on newlines because of our splitting, though
|
|
|
|
# and tabs because of descriptions
|
|
|
|
string replace -r '\S+ (\S+) .*' '$1' </etc/mtab | string replace -a "\040" " " | string replace -a "\011" \t | string replace -a "\012" \n | string replace -a "\\\\" "\\"
|
|
|
|
else
|
2018-11-17 14:06:15 +01:00
|
|
|
mount | string replace -r '^(\S+) \S+ (\S+) .*' '$1\n$2' | string replace -r '[\d.]*:/' '/' | string match '/*'
|
2016-11-27 21:27:22 -08:00
|
|
|
end
|
2012-06-15 17:30:10 -07:00
|
|
|
end
|