[PD] bash_completion file for Pd

Frank Barknecht fbar at footils.org
Mon Dec 26 17:29:19 CET 2005


Hi,

attached is a 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> as in: 

$ ls
LICENSE.txt  README  alt/  doc/  lib/  patch.pd sound.pat

$ pd <TAB><TAB>
alt/  doc/  lib/  patch.pd  sound.pat

$ pd -<TAB><TAB>
-32bit        -audiooutdev  -helppath     -midioutdev   -nomidiin     -path         -stdpath
-alsa         -blocksize    -inchannels   -noadc        -nomidiout    -r            -typeface
-alsaadd      -channels     -jack         -noaudio      -nostdpath    -realtime     -verbose
-alsamidi     -d            -lib          -nodac        -nrt          -rt           -version
-audiobuf     -font         -listdev      -nogui        -open         -send         
-audiodev     -guicmd       -mididev      -noloadbang   -oss          -sleepgrain   
-audioindev   -guiport      -midiindev    -nomidi       -outchannels  -stderr

$ pd -al<TAB><TAB>
-alsa      -alsaadd   -alsamidi

Later I might 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: 

http://www.debian-administration.org/articles/316
http://www.debian-administration.org/articles/317

The file also is in CVS at: /cvsroot/pure-data/scripts/bash_completion/pd

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
# 
# 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>.
#
# 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:
# 
# 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

have pd && 
_pd() 
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    #prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="-r \
    -audioindev \
    -audiooutdev \
    -audiodev \
    -inchannels \
    -outchannels \
    -channels \
    -audiobuf \
    -blocksize \
    -sleepgrain \
    -nodac \
    -noadc \
    -noaudio \
    -listdev \
    -oss \
    -32bit \
    -alsa \
    -alsaadd \
    -jack \
    -midiindev \
    -midioutdev \
    -mididev \
    -nomidiin \
    -nomidiout \
    -nomidi \
    -alsamidi \
    -path \
    -nostdpath \
    -stdpath \
    -helppath \
    -open \
    -lib \
    -font \
    -typeface \
    -verbose \
    -version \
    -d \
    -noloadbang \
    -stderr \
    -nogui \
    -guiport \
    -guicmd \
    -send \
    -rt \
    -realtime \
    -nrt"

    if [[ ${cur} == -* ]] ; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
    else
        _filedir '@(pd|pat)'
    fi
}
[ "${have:-}" ] &&  complete -F _pd $filenames pd


More information about the Pd-list mailing list