[ditz-talk] [PATCH] fix completion bug on strings like '-n'

Christian Garbs mitch at cgarbs.de
Mon Aug 11 16:47:48 EDT 2008

On Mon, Aug 11, 2008 at 01:08:22PM -0700, William Morgan wrote:
> Hi Christian,
> Reformatted excerpts from Christian Garbs's message of 2008-08-09:
> > This fixes a bug in the bash completion that can be triggered by
> > entering something like "ditz -n" and pressing tab.
> After applying this patch and re-sourcing the completion file, "ditz -n
> <tab>" still falls back to listing the files in the current directory.
> Am I doing something wrong?

Before my change, "ditz -n<tab" (no space!) brought this error:

$ ditz -nbash: compgen: -n: invalid option
compgen: usage: compgen [-abcdefgjksuv] [-o option] [-A action] [-G
globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F
function] [-C command] [word]

The patch expands "-n<tab>" correctly to an empty list, as there is no
ditz command or option that starts with "-n".

"ditz -n <tab>" (with space) would expand to the first parameter of the
"-n" option.  "-n" is unkown to ditz, so falling back to the bash
default should be the right thing to do.
If you typed ">" instead of "-n" which is also unkown to ditz,
the default expansion to filenames and directories is quite useful.

This behaviour is unchanged by my patch.


Corry's Law:
        Paper is always strongest at the perforations.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://rubyforge.org/pipermail/ditz-talk/attachments/20080811/98377393/attachment.bin>

More information about the ditz-talk mailing list