summaryrefslogtreecommitdiff
path: root/website.bashcomp
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2009-09-07 12:15:06 +0200
committerdakkar <dakkar@thenautilus.net>2009-09-07 12:15:06 +0200
commitb9064540b3f335cbb363e65ab0d571ebd77678bf (patch)
tree32f4ef61980dd45a9d01b32af6ac3d816c365fa9 /website.bashcomp
parentbash programmable completion for new-* scripts (diff)
downloadthenautilus-b9064540b3f335cbb363e65ab0d571ebd77678bf.tar.gz
thenautilus-b9064540b3f335cbb363e65ab0d571ebd77678bf.tar.bz2
thenautilus-b9064540b3f335cbb363e65ab0d571ebd77678bf.zip
better expansion using pre-defined functions
Diffstat (limited to 'website.bashcomp')
-rw-r--r--website.bashcomp24
1 files changed, 23 insertions, 1 deletions
diff --git a/website.bashcomp b/website.bashcomp
index ba04385..04682ed 100644
--- a/website.bashcomp
+++ b/website.bashcomp
@@ -1,3 +1,22 @@
+_website_filedir() {
+ local IFS=$'\n' xspec
+
+ _expand || return 0
+
+ local -a toks
+ local tmp
+
+ toks=( ${toks[@]-} $(
+ compgen -d -X "$1" -- "$(quote_readline "$cur")" | {
+ while read -r tmp; do
+ [ -n "$tmp" ] && echo "${tmp}/"
+ done
+ }
+ ))
+
+ COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+}
+
_website_newdoc() {
local dir='src'
local excl='[._]*'
@@ -6,8 +25,11 @@ _website_newdoc() {
else
excl="@(${excl}|tags)"
fi
+
+ local cur="$(_get_cword)"
+
pushd "$dir" >/dev/null
- COMPREPLY=($(compgen -o filenames -o nospace -d -X "$excl" -- "${COMP_WORDS[COMP_CWORD]}" | sed 's,$,/,'))
+ _website_filedir "$excl"
popd >/dev/null
}