[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: programmable completions?
From: |
Chris F.A. Johnson |
Subject: |
Re: programmable completions? |
Date: |
Sun, 29 Aug 2004 06:50:18 -0400 (EDT) |
On Sun, 29 Aug 2004, Aharon Robbins wrote:
Are there any examples in the bash 3.0 dist on how to use the programmable
completion features. The man page explains the commands and such, but
a few examples would sure help.
There's a "bash_completion" script floating around (it's included
in the Mandrake Linux distro, and probably others). It's at:
<http://www.dreamind.de/files/bash-stuff/bash_completion>.
It gave me enough information to write this, to complete arguments
to my cpsh script with files in my scripts directory that end in
"-sh":
_cpsh() {
COMPREPLY=( `cd $HOME/scripts || return 3
printf "%s\n" ${COMP_WORDS[$COMP_CWORD]}*-sh`
)
COMPREPLY=( "${COMPREPLY[@]%-sh}" )
}
complete -F _cpsh cpsh
--
Chris F.A. Johnson http://cfaj.freeshell.org
=================================================================
Everything in moderation -- including moderation