[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

completing dir names for a certain path?

From: Matthew Woehlke
Subject: completing dir names for a certain path?
Date: Fri, 22 Aug 2008 17:47:24 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20080723 Fedora/ Thunderbird/ Mnenhy/

I have a function 'cs' that roughly looks like 'cd /some/prefix/$*', that I would like to have completion for. Any tips? (For some reason, non-trivial completions never seem to want to work for me :-(.)

IOW, if /some/prefix has the directories 'foo' and 'bar', I would like:
$ cs b<tab>
...to complete to...
$ cs bar

I've tried this and it doesn't work:
complete -C 'cd /some/prefix && compgen -d "$@"' cs

In fact, this doesn't seem to work either, meaning, generates no completions:
complete -C 'compgen -d' cs
...which implies that either the doc fails to explain how to use 'complete -C', or else it just plain doesn't work.

Note that compgen works as expected, I just can't get anything to work with 'complete -C'.

For great justice!! -- Captain (Zero Wing)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]