unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: 43769@debbugs.gnu.org
Cc: zimoun <zimon.toutoune@gmail.com>
Subject: [bug#43769] [PATCH v2 1/2] guix-install.sh: Add symbolic links for supported shell completions.
Date: Sat,  3 Oct 2020 20:44:46 +0200	[thread overview]
Message-ID: <20201003184447.9542-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20201002173537.12045-1-zimon.toutoune@gmail.com>

Fixes <https://bugs.gnu.org/43744>.

* etc/guix-install.sh (sys_create_shell_completion): New function to add
system wide all the symlinks for supported shell completions.
---
 etc/guix-install.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index eb7205a261..a5da198eb0 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -5,6 +5,7 @@
 # Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 # Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 # Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+# Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -459,6 +460,36 @@ export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/us
 EOF
 }
 
+sys_create_shell_completion()
+{ # Symlink supported shell completions system-wide
+
+    var_guix=/var/guix/profiles/per-user/root/current-guix
+    bash_completion=/etc/bash_completion.d
+    zsh_completion=/usr/share/zsh/site-functions
+    fish_completion=/usr/share/fish/vendor_completions.d
+
+    while true; do
+        read -p "Install shell completion? (yes/no)" yn
+        case $yn in
+            [Yy]*)
+                { # Just in case
+                  for dir_shell in $bash_completion $zsh_completion $fish_completion; do
+                      [ -d "$dir_shell" ] || mkdir -p $dir_shell
+                  done;
+
+                  ln -sf ${var_guix}/etc/bash_completion.d/* "$bash_completion";
+                  ln -sf ${var_guix}/share/zsh/site-functions/* "$zsh_completion";
+                  ln -sf ${var_guix}/share/fish/vendor_completions.d/* "$fish_completion"; } &&
+                    _msg "${PAS}Installed shell completion"
+                break;;
+            [Nn]*) _msg "${INF}Skipped shell completion installation"
+                   break;;
+            *) _msg "Please answer yes or no.";
+        esac
+    done
+}
+
+
 welcome()
 {
     cat<<"EOF"
@@ -516,6 +547,7 @@ main()
     sys_enable_guix_daemon
     sys_authorize_build_farms
     sys_create_init_profile
+    sys_create_shell_completion
 
     _msg "${INF}cleaning up ${tmp_path}"
     rm -r "${tmp_path}"
-- 
2.28.0





  parent reply	other threads:[~2020-10-03 18:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 17:35 [bug#43769] [PATCH 0/2] guix-install.sh: Minor first user-experience tweaks zimoun
2020-10-02 17:40 ` [bug#43769] [PATCH 1/2] guix-install.sh: Add symbolic links for supported shell completions zimoun
2020-10-02 17:42 ` [bug#43769] [PATCH 2/2] guix-install.sh: Check the daemon 'nscd' and suggest it zimoun
2020-10-03 18:44 ` zimoun [this message]
2020-10-03 18:44   ` [bug#43769] [PATCH v2 2/2] guix-install.sh: Check the service " zimoun
2020-10-03 19:14     ` Tobias Geerinckx-Rice via Guix-patches via
2020-10-05  8:08       ` Ludovic Courtès
2020-10-05  9:19         ` zimoun
2020-10-05 12:28         ` Tobias Geerinckx-Rice via Guix-patches via
2020-10-13 16:45           ` zimoun
2020-10-03 19:11   ` [bug#43769] [PATCH v2 1/2] guix-install.sh: Add symbolic links for supported shell completions Tobias Geerinckx-Rice via Guix-patches via
2020-10-05  8:09     ` Ludovic Courtès
2020-10-05  9:23       ` zimoun
2020-10-05 12:02         ` Ludovic Courtès
2020-10-13 17:12 ` [bug#43769] [PATCH v3 2/2] guix-install.sh: Check the service 'nscd' and suggest it zimoun
2020-10-13 17:12   ` [bug#43769] [PATCH v3 1/2] guix-install.sh: Add symbolic links for supported shell completions zimoun
2020-10-16  9:39   ` bug#43769: [PATCH v3 2/2] guix-install.sh: Check the service 'nscd' and suggest it Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201003184447.9542-1-zimon.toutoune@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=43769@debbugs.gnu.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.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).