Comments for bash programmable completion

03 Jul 2003 07:28 mgiorget

Re: mac os x
The problem is that the differences may not be only
about the fstab file (well I'm kinda sure of that...).
As I can list the features needed for mac os x I'll send
them to you ok?
Late,
Marco

01 Jul 2003 02:43 ianmacd

Re: mac os x

> Hi all. i'm trying to get this magical
> bash_completion
> feature working on my mac os x 10.2
> (with no
> success). i tryed to source directly
> from the file I
> dowloaded from the bash homepage, and if
> I run it as
> root it sources it but has some problems
> (like mount
> <tab><tab> looks for
> /etc/fstab, which doesn't exist in
> mac os), so i was wondering if you knew
> some
> "sourceable" file suitable for
> mac os x.
> thanks
> george
>
> (sorry for the previous reply I just
> didn't see the "add
> comment" button...)


There's a Fink package (http://fink.sourceforge.net/pdb/package.php/bash-completion) that may be what you're looking for. As for the absence of /etc/fstab, if you send me details of what the Mac's file-system table looks like, I'll be happy to add support for it.

30 Jun 2003 14:37 mgiorget

Re: mac os x
Well i've had a look at the code of bash_completion and
i've seen that Darwin is contemplated only in the
completion of the command "man". this is quite
disappointing for me :-(
do you know if anyone has started to work on bash
completion for darwin?
thanks

30 Jun 2003 14:27 mgiorget

mac os x
Hi all. i'm trying to get this magical bash_completion
feature working on my mac os x 10.2 (with no
success). i tryed to source directly from the file I
dowloaded from the bash homepage, and if I run it as
root it sources it but has some problems (like mount
<tab><tab> looks for /etc/fstab, which doesn't exist in
mac os), so i was wondering if you knew some
"sourceable" file suitable for mac os x.
thanks
george

(sorry for the previous reply I just didn't see the "add
comment" button...)

23 Jun 2003 23:32 BSDwolf

RE: cd in CDPATH does not add trailing slash...

> Found the fix:
>
> in _cd(), At line 2466, add a slash to
> the end of the line,
> i.e. the line should look like:
>
> COMPREPLY[$k]=${j#$i/}/
>
> Voila.
>
> [I will also note that bash_completion
> does some annoying things under version
> < 2.05b, but that's not your problem.
> :-)]


Bah.

Spoke too soon. That'll teach me.

23 Jun 2003 23:28 BSDwolf

Re: cd does not add trailing slashes if going thru CDPATH

>
> % I note that if I use cd and
> completion
> % to complete dirs in CDPATH somewhere,
> % the trailing slash does not get
> added;
> % how could this be fixed?
>
>
>
> Please see the Troubleshooting section
> of the README that comes with the tar
> file.
>
> Basically, you need to upgrade your copy
> of bash.


I'm running 2.05b; I'm behind already?

23 Jun 2003 23:25 BSDwolf

RE: cd in CDPATH does not add trailing slash...
Found the fix:

in _cd(), At line 2466, add a slash to the end of the line,
i.e. the line should look like:

COMPREPLY[$k]=${j#$i/}/

Voila.

[I will also note that bash_completion does some annoying things under version < 2.05b, but that's not your problem. :-)]

23 Jun 2003 23:16 ianmacd

Re: cd does not add trailing slashes if going thru CDPATH

> I note that if I use cd and completion
> to complete dirs in CDPATH somewhere,
> the trailing slash does not get added;
> how could this be fixed?


Please see the Troubleshooting section of the README that comes with the tar file.

Basically, you need to upgrade your copy of bash.

23 Jun 2003 21:46 BSDwolf

cd does not add trailing slashes if going thru CDPATH
I note that if I use cd and completion to complete dirs in CDPATH somewhere, the trailing slash does not get added; how could this be fixed?

18 Apr 2003 18:37 ianmacd

Re: Automatic change directory

> Would it be possible to add the
> automatic change directory feature to
> Bash Completion?
>
> If a directory called /usr/local/lib/foo
> exists and the command line is:
> $ /usr/local/lib/foo <return>
>
> Then the action is to change to that
> directory instead of reporting that
> "/usr/local/lib/foo" is a
> directory.
>
> I've used this feature in other shells.
> Can this be done at the command
> completion level or does it call for a
> more fundamental change in bash
> itself?
>


bash can't really do this, since it has no pre-execution hook for you to tap into with code.


Nevertheless, to my surprise, I managed to botch together the following hack:

trap '{ d=$_; [ -d "$d" ] && cd $d; unset d; }' ERR

This does what you want, but won't stop the attempt to run a directory from displaying an error before changing to the directory.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.