unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bash completions
@ 2015-03-03 22:13 Ludovic Courtès
  2015-03-16 22:24 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2015-03-03 22:13 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1710 bytes --]

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))


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

* Re: Bash completions
  2015-03-03 22:13 Bash completions Ludovic Courtès
@ 2015-03-16 22:24 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-03-16 22:24 UTC (permalink / raw)
  To: guix-devel

I forgot to mention it but commit 1d167b6 implements that.

Now, when the ‘bash-completion’ package is available in the global
profile (which is the case by default), Bash completions are
automatically loaded, included those found in user profiles.

Ludo’.

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

end of thread, other threads:[~2015-03-16 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 22:13 Bash completions Ludovic Courtès
2015-03-16 22:24 ` 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).