From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Bash completions Date: Tue, 03 Mar 2015 23:13:48 +0100 Message-ID: <87twy1pw4j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSv4d-0002X0-Ic for guix-devel@gnu.org; Tue, 03 Mar 2015 17:13:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSv4Z-0003ka-I4 for guix-devel@gnu.org; Tue, 03 Mar 2015 17:13:55 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSv4Z-0003kW-FS for guix-devel@gnu.org; Tue, 03 Mar 2015 17:13:51 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:49387 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1YSv4Y-0007Pt-4t for guix-devel@gnu.org; Tue, 03 Mar 2015 17:13:50 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! I=E2=80=99m 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 =E2=80=98bash-completion=E2=80=99 package on one hand the the Bash manual o= n the other. Thoughts? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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)) --=-=-=--