aboutsummaryrefslogtreecommitdiff
path: root/scripts/bash_completion
diff options
context:
space:
mode:
authorFrank Barknecht <fbar@users.sourceforge.net>2005-12-26 18:29:50 +0000
committerFrank Barknecht <fbar@users.sourceforge.net>2005-12-26 18:29:50 +0000
commitdc89617cdda10aad9ebd4d8aae7d86ff032374b8 (patch)
tree13ab870b0c647594101784cef970f64af5a8e88d /scripts/bash_completion
parentb89c9dfb553bbda2c8627ac73fdb4cd5b5e628a1 (diff)
added completion for -path, -helppath and -open
svn path=/trunk/; revision=4299
Diffstat (limited to 'scripts/bash_completion')
-rw-r--r--scripts/bash_completion/pd40
1 files changed, 31 insertions, 9 deletions
diff --git a/scripts/bash_completion/pd b/scripts/bash_completion/pd
index 9210fcdd..e7af0011 100644
--- a/scripts/bash_completion/pd
+++ b/scripts/bash_completion/pd
@@ -1,19 +1,17 @@
#
# bash_completion file for Pd.
#
-# Save as: /etc/bash_completion.d/pd or ~/.bash_completion and enjoy
-# never having to type any full command line option anymore. Instead you
-# can press <TAB>.
+# Save as: /etc/bash_completion.d/pd or ~/.bash_completion and enjoy never
+# having to type any full command line option anymore. Instead you can press
+# <TAB>.
#
-# Later add some more fine grained settings, like having "-path"
-# only complete on directory names etc. If you want to help, these are
-# fine introductions to bash's completion feature:
+# If you want to help, these are fine introductions to bash's completion
+# feature:
#
# http://www.debian-administration.org/articles/316
# http://www.debian-administration.org/articles/317
#
-# First version written by Frank Barknecht <fbar AT footils.org>
-# Dec 26 2005
+# First version written by Frank Barknecht <fbar AT footils.org> Dec 26 2005
have pd &&
_pd()
@@ -21,7 +19,9 @@ _pd()
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
- #prev="${COMP_WORDS[COMP_CWORD-1]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ # Pd's options:
opts="-help \
-r \
-audioindev \
@@ -70,6 +70,28 @@ _pd()
-realtime \
-nrt"
+
+ # options that require an argument:
+ case "${prev}" in
+ # directory argument:
+ # TODO: colon-separated paths as in "/usr/lib/pd/extra:/home/user/pd"
+ -path)
+ COMPREPLY=( $(compgen -d ${cur}) )
+ return 0
+ ;;
+ -helppath)
+ COMPREPLY=( $(compgen -d ${cur}) )
+ return 0
+ ;;
+ # patch file argument:
+ -open)
+ _filedir '@(pd|pat)'
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
else