guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash completions


From: Ludovic Courtès
Subject: Bash completions
Date: Tue, 03 Mar 2015 23:13:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hello!

I’m considering applying this so that Bash completions would work
out-of-the-box.  Apparently handling of completions is not fully
standardized; this approach is based on the suggestions of the
‘bash-completion’ package on one hand the the Bash manual on the other.

Thoughts?

Thanks,
Ludo’.

diff --git a/gnu/system.scm b/gnu/system.scm
index 5a3842f..45d1424 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -355,6 +355,8 @@ explicitly appear in OS."
 
          e2fsprogs kbd
 
+         bash-completion
+
          ;; The packages below are also in %FINAL-INPUTS, so take them from
          ;; there to avoid duplication.
          (map canonical-package
@@ -461,6 +463,23 @@ export GIT_SSL_CAINFO=\"$SSL_CERT_FILE\"
 # Allow Aspell to find dictionaries installed in the user profile.
 export ASPELL_CONF=\"dict-dir $HOME/.guix-profile/lib/aspell\"
 "))
+
+       (bashrc    (text-file "bashrc" "\
+# Bash-specific initialization.
+
+# The 'bash-completion' package.
+if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
+then
+  source /run/current-system/profile/etc/profile.d/bash_completion.sh
+fi
+
+# Automatic completion loading from the user profile
+# (info \"(bash) Programmable Completion\").
+_completion_loader()
+ {
+   . \"$HOME/.guix-profile/etc/bash_completion.d/$1.sh\" >/dev/null 2>&1 && 
return 124
+ }
+complete -D -F _completion_loader -o bashdefault -o default\n"))
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
                 `(("services" ,#~(string-append #$net-base "/etc/services"))
@@ -474,6 +493,7 @@ export ASPELL_CONF=\"dict-dir 
$HOME/.guix-profile/lib/aspell\"
                   ("skel" ,#~#$skel)
                   ("shells" ,#~#$shells)
                   ("profile" ,#~#$profile)
+                  ("bashrc" ,#~#$bashrc)
                   ("hosts" ,#~#$hosts-file)
                   ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                                  #$timezone))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]