GNU bug report logs - #43769
[PATCH 0/2] guix-install.sh: Minor first user-experience tweaks

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Fri, 2 Oct 2020 17:36:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 43769 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: 43769 <at> debbugs.gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH v2 1/2] guix-install.sh: Add symbolic links for supported
 shell completions.
Date: Sat,  3 Oct 2020 20:44:46 +0200
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 <at> flashner.co.il>
 # Copyright © 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 # Copyright © 2020 Morgan Smith <Morgan.J.Smith <at> outlook.com>
+# Copyright © 2020 Simon Tournier <zimon.toutoune <at> 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





This bug report was last modified 4 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.