[PD-cvs] scripts/bash_completion pd,1.2,1.3

Frank Barknecht fbar at users.sourceforge.net
Mon Dec 26 19:29:52 CET 2005


Update of /cvsroot/pure-data/scripts/bash_completion
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14941

Modified Files:
	pd 
Log Message:
added completion for -path, -helppath and -open

Index: pd
===================================================================
RCS file: /cvsroot/pure-data/scripts/bash_completion/pd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pd	26 Dec 2005 16:41:18 -0000	1.2
--- pd	26 Dec 2005 18:29:50 -0000	1.3
***************
*** 2,18 ****
  # 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 && 
--- 2,16 ----
  # 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>.
  #
! # 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 && 
***************
*** 22,26 ****
      COMPREPLY=()
      cur="${COMP_WORDS[COMP_CWORD]}"
!     #prev="${COMP_WORDS[COMP_CWORD-1]}"
      opts="-help \
      -r \
--- 20,26 ----
      COMPREPLY=()
      cur="${COMP_WORDS[COMP_CWORD]}"
!     prev="${COMP_WORDS[COMP_CWORD-1]}"
!     
!     # Pd's options:
      opts="-help \
      -r \
***************
*** 71,74 ****
--- 71,96 ----
      -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}) )





More information about the Pd-cvs mailing list