2012-06-16 00:30:10 +00:00
|
|
|
function __fish_print_mounted --description 'Print mounted devices'
|
2015-07-24 10:35:10 +00:00
|
|
|
if test -r /etc/mtab
|
2015-07-21 09:47:10 +00:00
|
|
|
# In mtab, spaces are replaced by a literal '\040'
|
|
|
|
# So it's safe to get the second "field" and then replace it
|
2015-12-17 11:14:03 +00:00
|
|
|
# \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 "\\\\" "\\"
|
2015-07-24 10:35:10 +00:00
|
|
|
else
|
2015-09-09 18:55:04 +00:00
|
|
|
mount | cut -d " " -f 1-3|tr " " \n|sed -e "s/[0-9\.]*:\//\//"| __fish_sgrep "^/"
|
2013-09-05 18:40:51 +00:00
|
|
|
end
|
2012-06-16 00:30:10 +00:00
|
|
|
end
|