mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 01:17:45 +00:00
mount completions: don't truncate mounts with spaces in them
This commit is contained in:
parent
31d17f4559
commit
1c364722a7
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
function __fish_print_mounted --description 'Print mounted devices'
|
function __fish_print_mounted --description 'Print mounted devices'
|
||||||
if test -r /etc/mtab
|
if [ -r /etc/mtab ]
|
||||||
# In mtab, spaces are replaced by a literal '\040'
|
# In mtab, spaces are replaced by a literal '\040'
|
||||||
# So it's safe to get the second "field" and then replace it
|
# 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
|
# \011 encodes a tab, \012 encodes a newline and \\ encodes a backslash
|
||||||
|
@ -7,6 +7,6 @@ function __fish_print_mounted --description 'Print mounted devices'
|
||||||
# and tabs because of descriptions
|
# 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 "\\\\" "\\"
|
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
|
else
|
||||||
mount | string replace -r '^(\S+) \S+ (\S+) .*' '$1\n$2' | string replace -r '[\d.]*:/' '/' | string match '/*'
|
mount | string replace -r '^(\S+) \S+ ([\ \S]+) \(.*\)' '$1\n$2' | string replace -r '[\d.]*:/' '/' | string match '/*'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue