[PATCH 0/3] Properly install shell completions

22 views
Skip to first unread message

Ludovico Gerardi

unread,
Sep 30, 2024, 3:22:20 PM9/30/24
to Newsboat mailing list
Currently the files for shell completions are stored into the
'contrib' directory, and the build system installs them under $docdir.
However that is not useful for the final user because by default shells
don't use that path when looking for completion files. This patchset
addresses that by installing those files under the right directories. It
also provides completions for zsh.

Ludovico Gerardi (3):
Put shell completions in a dedicated directory
Install shell completions
Add zsh completions

Makefile | 18 +++++++++++++----
contrib/completions/_newsboat | 27 +++++++++++++++++++++++++
contrib/{ => completions}/newsboat.fish | 0
3 files changed, 41 insertions(+), 4 deletions(-)
create mode 100644 contrib/completions/_newsboat
rename contrib/{ => completions}/newsboat.fish (100%)

--
2.46.2

Ludovico Gerardi

unread,
Sep 30, 2024, 3:23:29 PM9/30/24
to Newsboat mailing list
Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---
contrib/{ => completions}/newsboat.fish | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename contrib/{ => completions}/newsboat.fish (100%)

diff --git a/contrib/newsboat.fish b/contrib/completions/newsboat.fish
similarity index 100%
rename from contrib/newsboat.fish
rename to contrib/completions/newsboat.fish
--
2.46.2

From 2b43d2ad2b1e0ee39c42cc489e5821deebe6c0a8 Mon Sep 17 00:00:00 2001
Message-ID: <2b43d2ad2b1e0ee39c42cc489e5821deebe6...@posteo.it>
In-Reply-To: <cover.1727722771.g...@posteo.it>
References: <cover.1727722771.g...@posteo.it>
From: Ludovico Gerardi <ludovico...@posteo.it>
Date: Mon, 30 Sep 2024 15:57:56 +0200
Subject: [PATCH 2/3] Install shell completions
To: Newsboat mailing list <news...@googlegroups.com>

Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---
Makefile | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index cf4631f1..811747f4 100644
--- a/Makefile
+++ b/Makefile
@@ -361,9 +361,9 @@ install-docs: doc
$(MKDIR) $(DESTDIR)$(docdir)
$(INSTALL) -m 644 doc/xhtml/* $(DESTDIR)$(docdir)
$(INSTALL) -m 644 CHANGELOG.md $(DESTDIR)$(docdir)
- find contrib/ -type d -print0 | xargs -0 -I@ $(MKDIR) $(DESTDIR)$(docdir)/@
- find contrib/ -type f -perm /0111 -print0 | xargs -0 -I@ install -m 755 @ $(DESTDIR)$(docdir)/@
- find contrib/ -type f ! -perm /0111 -print0 | xargs -0 -I@ install -m 644 @ $(DESTDIR)$(docdir)/@
+ find contrib/ -type d ! -wholename 'contrib/completions' -print0 | xargs -0 -I@ $(MKDIR) $(DESTDIR)$(docdir)/@
+ find contrib/ -type f ! -wholename 'contrib/completions*' -perm /0111 -print0 | xargs -0 -I@ install -m 755 @ $(DESTDIR)$(docdir)/@
+ find contrib/ -type f ! -wholename 'contrib/completions*' ! -perm /0111 -print0 | xargs -0 -I@ install -m 644 @ $(DESTDIR)$(docdir)/@
$(MKDIR) $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 doc/$(NEWSBOAT).1 $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 doc/$(PODBOAT).1 $(DESTDIR)$(mandir)/man1
@@ -378,7 +378,13 @@ install-icon:
$(MKDIR) $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
$(INSTALL) -m 644 logo.svg $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/newsboat.svg

-install: install-newsboat install-podboat install-docs install-examples install-mo install-icon
+install-completions-fish:
+ $(MKDIR) $(DESTDIR)$(datadir)/fish/vendor_completions.d
+ $(INSTALL) -m 644 contrib/completions/newsboat.fish $(DESTDIR)$(datadir)/fish/vendor_completions.d
+
+install-completions: install-completions-fish
+
+install: install-newsboat install-podboat install-docs install-examples install-mo install-icon install-completions

uninstall: uninstall-mo
$(RM) $(DESTDIR)$(prefix)/bin/$(NEWSBOAT)
--
2.46.2

From a4fc92c89ebff582d027fd53059b574f3074dc7b Mon Sep 17 00:00:00 2001
Message-ID: <a4fc92c89ebff582d027fd53059b574f3074...@posteo.it>
In-Reply-To: <cover.1727722771.g...@posteo.it>
References: <cover.1727722771.g...@posteo.it>
From: Ludovico Gerardi <ludovico...@posteo.it>
Date: Mon, 30 Sep 2024 16:11:39 +0200
Subject: [PATCH 3/3] Add zsh completions
To: Newsboat mailing list <news...@googlegroups.com>

Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---
Makefile | 6 +++++-
contrib/completions/_newsboat | 27 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 contrib/completions/_newsboat

diff --git a/Makefile b/Makefile
index 811747f4..e5ed26a4 100644
--- a/Makefile
+++ b/Makefile
@@ -382,7 +382,11 @@ install-completions-fish:
$(MKDIR) $(DESTDIR)$(datadir)/fish/vendor_completions.d
$(INSTALL) -m 644 contrib/completions/newsboat.fish $(DESTDIR)$(datadir)/fish/vendor_completions.d

-install-completions: install-completions-fish
+install-completions-zsh:
+ $(MKDIR) $(DESTDIR)$(datadir)/zsh/site-functions
+ $(INSTALL) -m 644 contrib/completions/_newsboat $(DESTDIR)$(datadir)/zsh/site-functions
+
+install-completions: install-completions-fish install-completions-zsh

install: install-newsboat install-podboat install-docs install-examples install-mo install-icon install-completions

diff --git a/contrib/completions/_newsboat b/contrib/completions/_newsboat
new file mode 100644
index 00000000..e459f26b
--- /dev/null
+++ b/contrib/completions/_newsboat
@@ -0,0 +1,27 @@
+#compdef newsboat
+
+_arguments : \
+ '(- *)'{-h,--help}'[display help]' \
+ '(- *)'{-v,-V,--version}'[get version information]' \
+ '(-q --quiet)'{-q,--quiet}'[quiet startup]' \
+ '(-r --refresh-on-start)'{-r,--refresh-on-start}'[refresh feeds on start]' \
+ '(-e --export-to-opml)'{-e,--export-to-opml}'[export feeds as OPML to stdout]' \
+ '--export-to-opml2[export feeds as OPML2 to stdout]' \
+ '(-X --vacuum)'{-X,--vacuum}'[compact the cache]' \
+ '--cleanup[remove unreferenced entries from the cache and quit]' \
+ '(-i --import-from-opml)'{-i,--import-from-opml=}'[import an OPML file]:OPML file:_files' \
+ '(-u --url-file)'{-u,--url-file=}'[use an alternative URL file]:URL file:_files' \
+ '(-c --cache-file)'{-c,--cache-file=}'[use an alternative cache file]:cache file:_files' \
+ '(-C --config-file)'{-C,--config-file=}'[use an alternative configuration file]:config file:_files' \
+ '--queue-file=[use an alternative queue file]:queue file:_files' \
+ '--search-history-file=[use an alternative search history file]:search history file:_files' \
+ '--cmdline-history-file=[use an alternative command line history file]:command line history file:_files' \
+ '(-x --execute)'{-x,--execute}'[execute commands]:commands:'\
+'((reload\:reload\ feed print-unread\:print\ unread\ articles))' \
+ '(-l --log-level)'{-l,--log-level}'[generate a logfile with specified loglevel]:level:(1 2 3 4 5 6)' \
+ '(-d --log-file)'{-d,--log-file=}'[use this logfile]:filename:_files' \
+ '(-E --export-to-file)'{-E,--export-to-file=}'[export a list of read articles]:filename:_files' \
+ '(-I --import-from-file)'{-I,--import-from-file=}'[import a list of read articles]:filename:_files'
+
+
+# vim: ft=zsh sw=2 ts=2 et
--
2.46.2

Ludovico Gerardi

unread,
Sep 30, 2024, 3:31:35 PM9/30/24
to Newsboat mailing list
Currently the files for shell completions are stored into the
'contrib' directory, and the build system installs them under $docdir.
However that is not useful for the final user because by default shells
don't use that path when looking for completion files. This patchset
addresses that by installing those files under the right directories. It
also provides completions for zsh.

Ludovico Gerardi (3):
Put shell completions in a dedicated directory
Install shell completions
Add zsh completions

Makefile | 18 +++++++++++++----
contrib/completions/_newsboat | 27 +++++++++++++++++++++++++
contrib/{ => completions}/newsboat.fish | 0
3 files changed, 41 insertions(+), 4 deletions(-)
create mode 100644 contrib/completions/_newsboat
rename contrib/{ => completions}/newsboat.fish (100%)

--
2.46.2

Ludovico Gerardi

unread,
Sep 30, 2024, 3:31:37 PM9/30/24
to Newsboat mailing list
Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---
contrib/{ => completions}/newsboat.fish | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename contrib/{ => completions}/newsboat.fish (100%)

Ludovico Gerardi

unread,
Sep 30, 2024, 3:31:37 PM9/30/24
to Newsboat mailing list
Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---

Ludovico Gerardi

unread,
Sep 30, 2024, 3:31:40 PM9/30/24
to Newsboat mailing list
Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
---
Makefile | 6 +++++-
contrib/completions/_newsboat | 27 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 contrib/completions/_newsboat

diff --git a/Makefile b/Makefile
index 811747f4..e5ed26a4 100644
--- a/Makefile
+++ b/Makefile
@@ -382,7 +382,11 @@ install-completions-fish:
$(MKDIR) $(DESTDIR)$(datadir)/fish/vendor_completions.d
$(INSTALL) -m 644 contrib/completions/newsboat.fish $(DESTDIR)$(datadir)/fish/vendor_completions.d

-install-completions: install-completions-fish
+install-completions-zsh:
+ $(MKDIR) $(DESTDIR)$(datadir)/zsh/site-functions
+ $(INSTALL) -m 644 contrib/completions/_newsboat $(DESTDIR)$(datadir)/zsh/site-functions
+
+install-completions: install-completions-fish install-completions-zsh

install: install-newsboat install-podboat install-docs install-examples install-mo install-icon install-completions

Ludovico Gerardi

unread,
Sep 30, 2024, 3:35:54 PM9/30/24
to news...@googlegroups.com
Okay I've made a bit of a mess here, sorry, I hope you understand what's
going on.

Dennis van der Schagt

unread,
Sep 30, 2024, 4:18:18 PM9/30/24
to Ludovico Gerardi, news...@googlegroups.com
Hi Ludovico,

Thank you for this contribution!

I don't have much experience with email-based git workflows, but I
think I got the patches in correctly.
See https://github.com/newsboat/newsboat/pull/2879
Let me know if you see any issues.

Kind regards,
Dennis

On Mon, 30 Sept 2024 at 21:35, Ludovico Gerardi
<ludovico...@posteo.it> wrote:
>
> Okay I've made a bit of a mess here, sorry, I hope you understand what's
> going on.
>
> --
> You received this message because you are subscribed to the Google Groups "newsboat" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to newsboat+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/newsboat/7ezzic3e7txf7yokohz66xizgmys46gjsy272nu27b5hmcecda%40727kyxntxngs.

Alexander Batischev

unread,
Oct 2, 2024, 2:36:51 PM10/2/24
to Ludovico Gerardi, Newsboat mailing list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Mon, Sep 30, 2024 at 07:31:54PM +0000, Ludovico Gerardi wrote:
>Signed-off-by: Ludovico Gerardi <ludovico...@posteo.it>
>---
> Makefile | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
>diff --git a/Makefile b/Makefile
>index cf4631f1..811747f4 100644
>--- a/Makefile
>+++ b/Makefile
>@@ -361,9 +361,9 @@ install-docs: doc
> $(MKDIR) $(DESTDIR)$(docdir)
> $(INSTALL) -m 644 doc/xhtml/* $(DESTDIR)$(docdir)
> $(INSTALL) -m 644 CHANGELOG.md $(DESTDIR)$(docdir)

>- find contrib/ -type d -print0 | xargs -0 -I@ $(MKDIR) $(DESTDIR)$(docdir)/@
>- find contrib/ -type f -perm /0111 -print0 | xargs -0 -I@ install -m 755 @ $(DESTDIR)$(docdir)/@
>- find contrib/ -type f ! -perm /0111 -print0 | xargs -0 -I@ install -m 644 @ $(DESTDIR)$(docdir)/@
>+ find contrib/ -type d ! -wholename 'contrib/completions' -print0 | xargs -0 -I@ $(MKDIR) $(DESTDIR)$(docdir)/@
>+ find contrib/ -type f ! -wholename 'contrib/completions*' -perm /0111 -print0 | xargs -0 -I@ install -m 755 @ $(DESTDIR)$(docdir)/@
>+ find contrib/ -type f ! -wholename 'contrib/completions*' ! -perm /0111 -print0 | xargs -0 -I@ install -m 644 @ $(DESTDIR)$(docdir)/@

`-wholename` appears to be a non-standard synonym for `-path`. Even the
manpage notes that it's a less portable alternative:
https://www.man7.org/linux/man-pages/man1/find.1.html It seems to be
supported by FreeBSD, but is missing from OpenBSD:
https://man.openbsd.org/find

Hope you don't mind if I replace it with `-path` before merging.

> $(MKDIR) $(DESTDIR)$(mandir)/man1
> $(INSTALL) -m 644 doc/$(NEWSBOAT).1 $(DESTDIR)$(mandir)/man1
> $(INSTALL) -m 644 doc/$(PODBOAT).1 $(DESTDIR)$(mandir)/man1
>@@ -378,7 +378,13 @@ install-icon:
> $(MKDIR) $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
> $(INSTALL) -m 644 logo.svg $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/newsboat.svg
>
>-install: install-newsboat install-podboat install-docs install-examples install-mo install-icon
>+install-completions-fish:
>+ $(MKDIR) $(DESTDIR)$(datadir)/fish/vendor_completions.d
>+ $(INSTALL) -m 644 contrib/completions/newsboat.fish $(DESTDIR)$(datadir)/fish/vendor_completions.d
>+
>+install-completions: install-completions-fish
>+
>+install: install-newsboat install-podboat install-docs install-examples install-mo install-icon install-completions
>
> uninstall: uninstall-mo
> $(RM) $(DESTDIR)$(prefix)/bin/$(NEWSBOAT)
>--
>2.46.2
>
>--
>You received this message because you are subscribed to the Google Groups "newsboat" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to newsboat+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/newsboat/2b43d2ad2b1e0ee39c42cc489e5821deebe6c0a8.1727722771.git.ludovico.gerardi%40posteo.it.

- --
Regards,
Alexander Batischev

PGP key 356961A20C8BFD03
Fingerprint: CE6C 4307 9348 58E3 FD94 A00F 3569 61A2 0C8B FD03

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEzmxDB5NIWOP9lKAPNWlhogyL/QMFAmb9krgACgkQNWlhogyL
/QNhiA//ZAokYufVj1jy2EWH4iy06gM53fuN1jSr+h3ruquyx3yJc7EoQ+twKtw5
Dm6o4sjkYmy23NCsqUWYaZZEg6gTyZ815d67K8mLkByVgJ7+IKAPLgMxnO+OFImk
GxewmwZ5fH/MDS2ig7/+t4hyTGikAlzAC1r2mOHbQsoOHGTnQu09IZLDSTg/uB/y
BwGsPHJvsG6KjmGI1Fs+IlXxIAFoCbePMw51jYubLXjh2T29+zR17NEzCn+4iA4v
ic1DgcRKRi6lBfDA0es7OqHtzSMylSDO+SaZJ9FLB7+LvtMXqy8drFi1pIIsVGM7
O0usHjVPI3L1w5ordBWibcfBxB8XSw280gpC1XelPodNAU9owwA0P/bnEr1wj6+j
8U9RJOD1MJftt8iL6iSFEigjBwSHtk0KNFfw5nksNryWa6y9ouSmP8hDzxtVfGf8
QkI1yomQYUecUvyizLcNqxPsSwr0xujSzUgSECBMLfIv/AKAjzws13eNYT+vdf41
yC/9QX0xvdrqV1Iy5POQyARWgsksVxozlHJyylCeKFm2SueqfBEsXj87VtnQw4ev
z/LC9G3O9J4kArY1gPLVAHxbIr2P6KKVM8SFczHSHWnf94OkFw/yo1oMsVFM0QA3
fjFk8b0M/OBLmgMT5iLaW2zq88esICKoXgtMWDKmel+0VJj4+bY=
=6oov
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages