where do I install custom completions for a python command line script on OSX

1.4k views Asked by At

In the bash-completions read me it states:

Q. I author/maintain package X and would like to maintain my own
completion code for this package. Where should I put it to be sure
that interactive bash shells will find it and source it?

Install it in one of the directories pointed to by
bash-completion's pkgconfig file variables. There are two
alternatives: the recommended one is 'completionsdir' (get it with
"pkg-config --variable=completionsdir bash-completion") from which
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. The other one which is present for
backwards compatibility reasons is 'compatdir' (get it with
"pkg-config --variable=compatdir bash-completion") from which files
are loaded when bash_completion is loaded.

However, on OS X after installing bash-comletion via homebrew this doesn't work:

pkg-config --variable=completionsdir bash-completion

Package bash-completion was not found in the pkg-config search path.
Perhaps you should add the directory containing `bash-completion.pc'
to the PKG_CONFIG_PATH environment variable
No package 'bash-completion' found

How/where would I install custom completions for a command line script I've written and will install via pip?

1

There are 1 answers

0
a14m On BEST ANSWER

use echo $BASH_COMPLETION in the terminal to get where the bash completion are installed

if you used homebrew it's most likely in /usr/local/etc/bash_completion.d/