From: Johan Grande <nahoj@crans.org>
To: zsh-workers@zsh.org
Subject: Re: [feature] Provide a pkg-config file
Date: Fri, 14 Jul 2023 20:08:59 +0200 [thread overview]
Message-ID: <b863a12d-763b-d1ea-46fb-a9be1c48b51f@crans.org> (raw)
In-Reply-To: <2k4aom63gjwye7qltsgrmihalb4dwilbqnzxffck32segn66pr@5a2zhmh4qhzn>
Le 14/07/2023 à 19:34, Wu Zhenyu a écrit :
> bash-completion has a pkg-config file, developers who want to provide completions can get the directory by
I recently had the same problem of determining where to install the
completion function for my program.
Here's what I did, should this be useful to anyone. I'd be happy to hear
if there is a better solution.
Note: I believe I read somewhere that /usr/share/zsh/site-functions is
always in fpath so forcing the user to install it there could be an option.
Note2: For my personal use, this made me add
~/.local/share/zsh/site-functions to my fpath and I realized that
another program had just assumed that this was the directory for
completions and put its there and I was missing out on it.
Makefile
```
...
ZSH_FUNCTIONS_DIR=$(PREFIX)/share/zsh/site-functions
install:
...
install -Dm644 "$(SRC_DIR)/_tss.zsh" "$(ZSH_FUNCTIONS_DIR)/_tss"
# (tss is the name of my program)
zsh postinstall.zsh "$(ZSH_FUNCTIONS_DIR)"
```
postinstall.zsh
```
...
local functions_dir=$1
if ! ((fpath[(Ie)$functions_dir])); then
cat <<EOF
###
### ${(qqq)functions_dir} doesn't seem to be in your
### fpath, at least in non-interactive mode. You need to add it, which
### you can do by running:
###
### print -r ${(qq):-fpath+=(${(qqq)functions_dir})}
>>${(q-)ZDOTDIR:-$HOME}/.zshenv
###
EOF
fi
```
--
Johan
next prev parent reply other threads:[~2023-07-14 18:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 17:34 Wu Zhenyu
2023-07-14 18:08 ` Johan Grande [this message]
2023-07-15 1:52 ` Oliver Kiddle
2023-07-15 10:28 ` install paths (was: Re: [feature] Provide a pkg-config file) zeurkous
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b863a12d-763b-d1ea-46fb-a9be1c48b51f@crans.org \
--to=nahoj@crans.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).