summaryrefslogtreecommitdiffstats
path: root/bash_completion
diff options
context:
space:
mode:
authorMartin Quinson <mquinson@debian.org>2005-01-20 11:35:22 +0000
committerMartin Quinson <mquinson@debian.org>2005-01-20 11:35:22 +0000
commit24ac012f24003a332633928464602c365286e2a1 (patch)
tree9df313f8f0f1651e7fb67bd3fc7ceaaa9f6736f6 /bash_completion
parentf6e5916e8a0a88103c15e351f2d439e56fb076e1 (diff)
downloadquilt-24ac012f24003a332633928464602c365286e2a1.tar.gz
Fix file completion; use string comparison when dealing with BASH_VERSION (may contain letters)
Diffstat (limited to 'bash_completion')
-rw-r--r--bash_completion29
1 files changed, 21 insertions, 8 deletions
diff --git a/bash_completion b/bash_completion
index 46229a6..68d1b51 100644
--- a/bash_completion
+++ b/bash_completion
@@ -73,6 +73,19 @@ if ! type _longopt &> /dev/null ; then
}
fi
+# Complete on files, not on directories
+#
+# Directories are shown in completion, but with their trailing / so that
+# user can go in them. It ought to be a more standard way to achieve this.
+#
+_quilt_comfile()
+{
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -- "$cur" ) )
+ echo $( compgen -d -- "$cur" ) | while read d ; do
+ COMPREPLY=( ${COMPREPLY[@]:-} "$d/" )
+ done
+}
+
_quilt_completion()
{
local cur prev cmds command_matches
@@ -113,7 +126,7 @@ _quilt_completion()
COMPREPLY=( $( compgen -W "$(quilt applied)" -- $cur ) )
;;
*)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -h" -- $cur ) )
;;
esac
@@ -142,7 +155,7 @@ _quilt_completion()
esac
;;
edit)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) )
;;
files)
@@ -176,7 +189,7 @@ _quilt_completion()
-n)
;;
*)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -n -f -h" -- $cur ) )
;;
esac
@@ -187,7 +200,7 @@ _quilt_completion()
COMPREPLY=( $( compgen -W "-n $(quilt series)" -- $cur ) )
;;
patches)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-v -n -h" -- $cur ) )
;;
pop)
@@ -212,7 +225,7 @@ _quilt_completion()
COMPREPLY=( $( compgen -W "$(quilt applied)" -- $cur ) )
;;
*)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -h" -- $cur ) )
;;
esac
@@ -226,7 +239,7 @@ _quilt_completion()
_filedir -d
;;
*)
- _filedir
+ _quilt_comfile
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-d -v -h" -- $cur ) )
;;
esac
@@ -245,8 +258,8 @@ _quilt_completion()
return 0
}
-[ ${BASH_VERSINFO[0]} -gt 2 -o \
- ${BASH_VERSINFO[0]} = 2 -a ${BASH_VERSINFO[1]} -gt 04 ] \
+[ ${BASH_VERSINFO[0]} '>' 2 -o \
+ ${BASH_VERSINFO[0]} = 2 -a ${BASH_VERSINFO[1]} '>' 04 ] \
&& _quilt_complete_opt="-o filenames"
complete -F _quilt_completion $_quilt_complete_opt quilt
unset -v _quilt_complete_opt