[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Completion with -W fails if words contain ':'
From: |
Martin D Kealey |
Subject: |
Re: Completion with -W fails if words contain ':' |
Date: |
Thu, 5 Dec 2024 17:04:36 +1000 |
On Wed, 4 Dec 2024 at 14:48, Keith Thompson <Keith.S.Thompson@gmail.com>
wrote:
> On Tue, Dec 3, 2024 at 10:20 AM Chet Ramey <chet.ramey@case.edu> wrote:
> > An easier workaround might have been removing `:' from COMP_WORDBREAKS.
>
> Sure, but that would affect all completions. I only want to change how
> completions
> work for my one custom command.
>
Write a custom completion function that localizes COMP_WORDBREAKS without
colon, and invokes compgen with the desired args.
If you meant escaping colons on the command line with the "say" command,
> that's not useful
> to me (and I haven't been able to get it to work anyway).
>
> Can you clarify with an example? So far, I haven't found a solution
> that's easier than just changing the syntax of my command to use '/'
> rather than ':' (which I've done).
>
The point of this special behaviour for colons is to allow you to get
reasonable behaviour when you type
PATH=$PATH:~/bi<TAB>
Quoting the colon allows you to write:
cd ~/foo\:ba<TAB>
or
cd ~/'foo:ba'<TAB>
It looks like "-o filenames" is pretty close to what I want. I'd
> rather not have the backslashes appear when I type <TAB>, but I
> can live with that.
>
Yeah, I wrote a tab completion package for iproute2, and getting slashes
before the colons in IPv6 addresses makes them unreadable. It drove me nuts
initially.
And then I want to wrap that in the zcomp visual menu
<https://github.com/kurahaupo/zcomp>, which adds a whole 'nother layer of
pain.
-Martin