From: AllKind <AllKind@fastest.cc>
To: Giuseppe Longo <giuseppelng@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [RFC nftables PATCH] nft: add bash completion script
Date: Sat, 6 Feb 2016 21:13:02 +0100 [thread overview]
Message-ID: <56B653CE.1020005@fastest.cc> (raw)
In-Reply-To: <1454691182-6573-1-git-send-email-giuseppelng@gmail.com>
On 05.02.2016 17:53, Giuseppe Longo wrote:
> The following patch adds a bash completion script
> which permits to complete nft commands.
>
> To install it:
> - cp files/nft-completion /etc/bash_completion.d/
> - . /etc/bash_completion.d/nft-completion
[...]
Another thing - reading the README of bash completion 2.1, this behavior
is deprecated and just kept for backwards compatibility.
Since 2.0 dynamic loading of completion is supported and quoting the
readme it should be done like this:
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.
For packages using GNU autotools the installation can be handled
for example like this in configure.ac:
PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
bashcompdir="${sysconfdir}/bash_completion.d")
AC_SUBST(bashcompdir)
...accompanied by this in Makefile.am:
bashcompdir = @bashcompdir@
dist_bashcomp_DATA = # completion files go here
For cmake we ship the bash-completion-config.cmake and
bash-completion-config-version.cmake files. Example usage:
find_package(bash-completion)
if(BASH_COMPLETION_FOUND)
message(STATUS
"Using bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}")
else()
set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d")
message (STATUS
"Using fallback bash completion dir
${BASH_COMPLETION_COMPLETIONSDIR}")
endif()
install(FILES your-completion-file DESTINATION
${BASH_COMPLETION_COMPLETIONSDIR})
Best regards,
AllKind
next prev parent reply other threads:[~2016-02-06 20:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 16:53 [RFC nftables PATCH] nft: add bash completion script Giuseppe Longo
2016-02-06 7:56 ` AllKind
2016-02-06 20:13 ` AllKind [this message]
2016-02-15 19:56 ` Pablo Neira Ayuso
2016-02-16 13:00 ` Giuseppe Longo
2016-02-16 16:26 ` Pablo Neira Ayuso
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=56B653CE.1020005@fastest.cc \
--to=allkind@fastest.cc \
--cc=giuseppelng@gmail.com \
--cc=netfilter-devel@vger.kernel.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.
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).