[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:1.8.1.16) Gecko/20080723 Fedora/2.0.0.16-1.fc9 Thunderbird/2.0.0.16 Mnenhy/0.7.5.0 |
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'.
--
Matthew
For great justice!! -- Captain (Zero Wing)
- completing dir names for a certain path?,
Matthew Woehlke <=