unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57722] [PATCH] gnu: ipfs: Install bash completion.
@ 2022-09-10 21:47 Michael Rohleder
  2022-09-11 11:47 ` Maxime Devos
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Rohleder @ 2022-09-10 21:47 UTC (permalink / raw)
  To: 57722; +Cc: Michael Rohleder

* gnu/packages/ipfs.scm (ipfs)[arguments]: Add 'install-bashcompletion
phase to install bash completion.
---
 gnu/packages/ipfs.scm | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ipfs.scm b/gnu/packages/ipfs.scm
index ccc36007b4..faa209bf2a 100644
--- a/gnu/packages/ipfs.scm
+++ b/gnu/packages/ipfs.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
-;;; Copyright © 2020, 2021 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020, 2021, 2022 Michael Rohleder <mike@rohleder.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -230,7 +230,26 @@ (define-public go-ipfs
     (build-system go-build-system)
     (arguments
      `(#:unpack-path "github.com/ipfs/go-ipfs"
-       #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"))
+       #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"
+       #:modules ((guix build utils)
+                  (guix build go-build-system)
+                  (ice-9 popen)
+                  (ice-9 textual-ports))
+       #:phases
+       (modify-phases %standard-phases
+         ;; https://github.com/ipfs/kubo/blob/master/docs/command-completion.md
+         (add-after 'install 'install-bashcompletion
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (completiondir (string-append out "/etc/bash_completion.d")))
+               (mkdir-p completiondir)
+               (call-with-output-file (string-append completiondir "/ipfs")
+                 (lambda (port)
+                   (let ((input-pipe (open-pipe* OPEN_READ
+                                                 (string-append out "/bin/ipfs")
+                                                 "commands" "completion" "bash")))
+                     (display (get-string-all input-pipe) port)
+                     (close-pipe input-pipe))))))))))
     (native-inputs
      (list python-minimal-wrapper zsh))
     (home-page "https://ipfs.io")
-- 
2.37.3





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-14 21:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-10 21:47 [bug#57722] [PATCH] gnu: ipfs: Install bash completion Michael Rohleder
2022-09-11 11:47 ` Maxime Devos
2022-09-12 11:21   ` Maxime Devos
2022-09-13  9:49   ` Michael Rohleder
2022-09-13 10:48     ` Maxime Devos
2022-09-13 11:02       ` Maxime Devos
2022-09-14 21:29     ` bug#57722: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).