tech-pkg archive

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

Fwd: Question about bash completion directory



I forgot to send the reply to tech-pkg. Forwarded.
In short, "/usr/pkg/share/bash-completion/completions" is the directory where "bash-completion" upstream expects
completion scripts to be placed.
I will continue to use the directory to install bash completion scripts.

---------- Forwarded message ---------
From: iquiw <iku.iwasa%gmail.com@localhost>
Date: Thu, Feb 13, 2020 at 12:57 PM
Subject: Re: Question about bash completion directory
To: Greg Troxel <gdt%lexort.com@localhost>


Thank you for the reply!

On Thu, Feb 13, 2020 at 12:48 AM Greg Troxel <gdt%lexort.com@localhost> wrote:
> I'm not entirely sure.  There is a question about what upstream does,
> and practice on Linux.   Arguably there should be some mk file in bash
> that sets a variable, or perhaps in some mk/defaults/ place, and
> packages should use that variable.

I just checked the upstream FAQ. (should have checked before asking though...)
https://github.com/scop/bash-completion#faq
------------------------------------------------------------------------------
The recommended directory is completionsdir, which you can get with pkg-config --variable=completionsdir bash-completion. From this directory, completions are loaded on-demand based on invoked commands' names, so be sure to name your completion file accordingly, and to include (for example) symbolic links in case the file provides completions for more than one command.
------------------------------------------------------------------------------

On my NetBSD, the output of "pkg-config --variable=completionsdir bash-completion" is /usr/pkg/share/bash-completion/completions.
So (a) looks the right directory.

> I see the point of conflicts with bash-completion package, but I don't
> see how having the same name in different files (what would happen in
> the same situation but a different place) is good either.

I see. The latter is not better.

> It seems that where completion files are installed should be someplace
> bash looks by default, or we should decide that users should have to opt
> into this.  But one decision, for all.

I think bash itself does not have default, "bash-completion" has some directories to load by default, including (a) and (d).
And (a) is the recommend directory of "bash-completion".
I will continue to use /usr/pkg/share/bash-completion/completions, hope other packages will do same.

Thanks,
iku


Home | Main Index | Thread Index | Old Index