LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   how is extra/bash_completion supposed to work? (https://www.linuxquestions.org/questions/slackware-14/how-is-extra-bash_completion-supposed-to-work-4175596965/)

a4z 01-07-2017 05:09 AM

how is extra/bash_completion supposed to work?
 
installed this packages, but
/etc/bash_completion.d/
stays empty

everything is in /usr/share/bash-completion/
and git copmletition in the git doc dir?

do I need to copy all files self to /etc/bash_completion.d/ ?

could this not be something that just work on Slackware?

rjj 01-07-2017 05:18 AM

Hi,

I think all you need to do is
Code:

# installpkg <path_to_slackware_mount>/extra/bash-completion/bash-completion-2.2-noarch-3.txz
For Git, I followed: https://git-scm.com/book/en/v1/Git-B...ips-and-Tricks

ponce 01-07-2017 05:19 AM

Quote:

Originally Posted by a4z (Post 5651537)
installed this packages, but
/etc/bash_completion.d/
stays empty

everything is in /usr/share/bash-completion/
and git copmletition in the git doc dir?

do I need to copy all files self to /etc/bash_completion.d/ ?

could this not be something that just work on Slackware?

well, it actually just works, I'm using it: maybe you have just to logout and login again (or source /etc/profile), check /etc/profile.d/bash_completion.sh

the directory /etc/bash_completion.d/ is for the third-party completion stuff (here it contains the files acroread, libreoffice.sh and youtube-dl.bash-completion).

git is a special case as it doesn't install bash completion stuff in the usual places by default: so yes, if you prefer you can copy its git-completion.bash in /etc/bash_completion.d or ~/.config/bash_completion

bassmadrigal 01-07-2017 09:16 AM

This is something seen in other packages as well. Typically /usr/ locations are for upstream or distribution supplied files, and then /etc/ locations are for the user to add over override other files. One of the most common packages you see this with is X (/usr/share/X11/xorg.conf.d/ vs /etc/X11/xorg.conf.d/).

a4z 01-07-2017 10:47 AM

2 observations:

1:
it does not work for me if I boot to runleven 4, the output of complete -p is totally empty kde terminal, xfce terminal, terminator,

but not if I log in on a shell via runlevel 3 or switching to a Ctr+Alt+f1 session. but this login ignores my .bashrc

shouldn't a login always run the global profile, why is my x session ignoring that?
what is the correct setup? starting each shell as login shell and sourcing .bashrc in .profile?


2:
not all software assumes that bash completion is available and puts therefore config files somewhere else.
for example git, the useful stuff is in /usr/doc/git-2.9.0/contrib/completion/

this is not good, if I would for example like to add bash completion to sbbdep, I could not assume that bash completion is active and would also have to deliver my completion files in the doc folder?
should in 2017 bash completion not be available per default?

ponce 01-07-2017 10:59 AM

Quote:

Originally Posted by a4z (Post 5651691)
shouldn't a login always run the global profile, why is my x session ignoring that?

it depends on how you initialize your shells but yes, a login shell should read /etc/profile (see "man bash" in the "INVOCATION" section).
Quote:

what is the correct setup?
there's not actually a "correct" setup, there are multiple choices.
Quote:

starting each shell as login shell and sourcing .bashrc in .profile?
in my terminals I do like that.

Quote:

not all software assumes that bash completion is available and puts therefore config files somewhere else.
for example git, the useful stuff is in /usr/doc/git-2.9.0/contrib/completion/

this is not good, if I would for example like to add bash completion to sbbdep, I could not assume that bash completion is active and would also have to deliver my completion files in the doc folder?
should in 2017 bash completion not be available per default?
this depends mostly on how upstream decide to do things: if the bash_completion stuff is installed by the "make install" in the usual places then it's available by default, if upstream decides to put it in a contrib directory then it's there where you most probably will find it when packaged.
if you decide that your completion file for sbbdep has to be available by default to whoever has bash_completion enabled, IMHO, the right place where "make install" has to put it is /usr/share/bash-completion/completions

a4z 01-07-2017 11:31 AM

thanks, need to write a blog entry for that since I tend to forget from one fresh install to an other.
/etc/profiled.d stuff is invoked also in the various terminals, but all the alias stuff disappears (that's why export -f should be preferred over alias). I am unsure how often I have already learned that now :-)

but, the git situations is still less than optimal...

edit: and why . /usr/share/bash-completion/bash_completion
does this mean this will be ignored/
Code:

ls /etc/bash_completion.d/
dkms  libreoffice.sh*

installed via sbo dkms, and alienbob libreoffice

ponce 01-07-2017 11:53 AM

Quote:

why . /usr/share/bash-completion/bash_completion
does this mean this will be ignored/
Code:

ls /etc/bash_completion.d/
dkms  libreoffice.sh*

installed via sbo dkms, and alienbob libreoffice
/etc/bash_completion.d is defined as BASH_COMPLETION_COMPAT_DIR in /usr/share/bash-completion/bash_completion so it's parsed too.

a4z 01-08-2017 02:18 PM

decided to source the stuff in .bashrc,
/etc/profile/d/bash_completion.sh and extra some of the aliases of coreutils-dircolors.sh
since this will make all terminal applications work out of the box, without customizing the shell command to `bash -l`
thanks for the help!


All times are GMT -5. The time now is 08:31 PM.