summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2016-10-21 14:58:30 +0200
committerJean Delvare <jdelvare@suse.de>2016-10-21 14:58:30 +0200
commit2829bc90687fe9f07ab662e2883742fc481abca7 (patch)
tree2980459606696f6e9eedcb4520e52f02ce1d5534
parent78b86cb1aedef51e2aac33a796150bedc3245772 (diff)
downloadquilt-2829bc90687fe9f07ab662e2883742fc481abca7.tar.gz
bash_completion: Handle spaces in file names
Set IFS in _quilt_comfile so that file names containing spaces are properly handled. Also quote ${COMPREPLY[@]} everywhere so that such file names are preserved. This closes Debian bug #640551.
-rw-r--r--bash_completion23
1 files changed, 12 insertions, 11 deletions
diff --git a/bash_completion b/bash_completion
index 562594f..fa1d6d5 100644
--- a/bash_completion
+++ b/bash_completion
@@ -82,7 +82,8 @@ fi
#
_quilt_comfile()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -- "$cur" ) )
+ local IFS=$'\t\n'
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -f -- "$cur" ) )
}
_quilt_completion()
@@ -126,7 +127,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-P -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-P -h" -- $cur ) )
;;
esac
;;
@@ -137,7 +138,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-P -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-P -h" -- $cur ) )
;;
esac
;;
@@ -159,13 +160,13 @@ _quilt_completion()
;;
*)
_filedir
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -P -u -U -c -C -R -z -h --snapshot --diff --no-timestamps --no-index --combine --sort" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-p -P -u -U -c -C -R -z -h --snapshot --diff --no-timestamps --no-index --combine --sort" -- $cur ) )
;;
esac
;;
edit)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-h" -- $cur ) )
;;
files)
case $prev in
@@ -184,7 +185,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-p" -- $cur ) )
;;
esac
;;
@@ -203,7 +204,7 @@ _quilt_completion()
;;
grep)
_longopt grep
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-h" -- $cur ) )
;;
header)
COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat --strip-trailing-whitespace $(quilt --quiltrc - series)" -- $cur ) )
@@ -220,7 +221,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -P -f -d -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-p -P -f -d -h" -- $cur ) )
;;
esac
;;
@@ -232,7 +233,7 @@ _quilt_completion()
;;
patches)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-v -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-v -h" -- $cur ) )
;;
pop)
COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
@@ -259,7 +260,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-P -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-P -h" -- $cur ) )
;;
esac
;;
@@ -283,7 +284,7 @@ _quilt_completion()
;;
*)
_quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-d -v -h" -- $cur ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "-d -v -h" -- $cur ) )
;;
esac
;;