From 5306fce16eec40e31386024b4e936ab94bf7bd8c Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 17 Dec 2015 12:35:16 +0100 Subject: [PATCH] mount completions: Support spaces in mountpoints This turns '\040' into a space. /etc/mtab also supports other escapes ("\\" for backslash, "\011" for tab), but I can't find documentation for those in fstab. --- share/completions/mount.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/mount.fish b/share/completions/mount.fish index cb945f8d5..ba0d985fc 100644 --- a/share/completions/mount.fish +++ b/share/completions/mount.fish @@ -10,8 +10,8 @@ end complete -x -c mount -a '(__fish_complete_blockdevice)' # In case `mount UUID=` and similar also works -complete -x -c mount -a "(test -r /etc/fstab; and string replace -r '#.*' '' < /etc/fstab | string match -r '.+' | string replace -r ' ([^\s]*) .*' '\tMount point \$1')" -complete -x -c mount -a "(test -r /etc/fstab; and string replace -r '#.*' '' < /etc/fstab | string match -r '.+' | string replace -r '(^[^\s]*) ([^\s]*) .*' '\$2\tDevice \$1')" +complete -x -c mount -a "(test -r /etc/fstab; and string replace -r '#.*' '' < /etc/fstab | string match -r '.+' | string replace -r ' (\S*) .*' '\tMount point \$1' | string replace -a '\040' ' ')" +complete -x -c mount -a "(test -r /etc/fstab; and string replace -r '#.*' '' < /etc/fstab | string match -r '.+' | string replace -r '(\S*) (\S*) .*' '\$2\tDevice \$1' | string replace -a '\040' ' ')" # In case it doesn't # complete -x -c mount -a "(test -r /etc/fstab; and string match -r '^/.*' < /etc/fstab | string replace -r ' ([^\s]*) .*' '\tMount point \$1')" # complete -x -c mount -a "(test -r /etc/fstab; and string match -r '^/.*' < /etc/fstab | string replace -r '(^/[^\s]*) ([^\s]*) .*' '\$2\tDevice \$1')"