summaryrefslogtreecommitdiff
path: root/website.bashcomp
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2009-09-07 11:58:23 +0200
committerdakkar <dakkar@thenautilus.net>2009-09-07 11:58:23 +0200
commit772349cd4aa9f92080e26ffcdf8acb33312cc723 (patch)
tree24d48c77018b0425b4b309b009c5d29058acc277 /website.bashcomp
parentfix spacing in translation (diff)
downloadthenautilus-772349cd4aa9f92080e26ffcdf8acb33312cc723.tar.gz
thenautilus-772349cd4aa9f92080e26ffcdf8acb33312cc723.tar.bz2
thenautilus-772349cd4aa9f92080e26ffcdf8acb33312cc723.zip
bash programmable completion for new-* scripts
Diffstat (limited to 'website.bashcomp')
-rw-r--r--website.bashcomp19
1 files changed, 19 insertions, 0 deletions
diff --git a/website.bashcomp b/website.bashcomp
new file mode 100644
index 0000000..ba04385
--- /dev/null
+++ b/website.bashcomp
@@ -0,0 +1,19 @@
+_website_newdoc() {
+ local dir='src'
+ local excl='[._]*'
+ if [[ "$COMP_CWORD" -gt 1 ]]; then
+ dir="${dir}/tags"
+ else
+ excl="@(${excl}|tags)"
+ fi
+ pushd "$dir" >/dev/null
+ COMPREPLY=($(compgen -o filenames -o nospace -d -X "$excl" -- "${COMP_WORDS[COMP_CWORD]}" | sed 's,$,/,'))
+ popd >/dev/null
+}
+
+_website_newtag() {
+ false
+}
+
+complete -o filenames -o nospace -F _website_newdoc ./new-doc
+complete -o filenames -o nospace -F _website_newtag ./new-tag