From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:54369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWeuF-0005I7-GQ for guix-patches@gnu.org; Fri, 31 May 2019 06:37:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWeuD-0007uH-UL for guix-patches@gnu.org; Fri, 31 May 2019 06:37:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWeuD-0007tx-RQ for guix-patches@gnu.org; Fri, 31 May 2019 06:37:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWeuD-0002ot-NX for guix-patches@gnu.org; Fri, 31 May 2019 06:37:01 -0400 Subject: [bug#36021] [PATCH] search-paths: 'environment-variable-definition' output for fish Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:54294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWetw-0005I0-Cs for guix-patches@gnu.org; Fri, 31 May 2019 06:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWetv-0007Zz-2P for guix-patches@gnu.org; Fri, 31 May 2019 06:36:44 -0400 Received: from smtp2.science.ru.nl ([131.174.16.145]:41408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hWetu-0007Tq-QW for guix-patches@gnu.org; Fri, 31 May 2019 06:36:43 -0400 From: Dan Frumin Date: Fri, 31 May 2019 12:36:30 +0200 Message-Id: <20190531103630.6739-1-dfrumin@cs.ru.nl> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 36021@debbugs.gnu.org Cc: Dan Frumin --- guix/search-paths.scm | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/guix/search-paths.scm b/guix/search-paths.scm index 002e6342bb..fe9253e88e 100644 --- a/guix/search-paths.scm +++ b/guix/search-paths.scm @@ -177,15 +177,28 @@ current value), or 'suffix (return the definition where VALUE is added as a suffix to VARIABLE's current value.) In the case of 'prefix and 'suffix, SEPARATOR is used as the separator between VARIABLE's current value and its prefix/suffix." - (match (if (not separator) 'exact kind) - ('exact - (format #f "export ~a=\"~a\"" variable value)) - ('prefix - (format #f "export ~a=\"~a${~a:+~a}$~a\"" - variable value variable separator variable)) - ('suffix - (format #f "export ~a=\"$~a${~a:+~a}~a\"" - variable variable variable separator value)))) + (let* ([shell-env (getenv "SHELL")] + [is-fish? (and shell-env + (equal? (last (string-split shell-env #\/)) + "fish"))]) + (match (if (not separator) 'exact kind) + ('exact + (if is-fish? + ;; See for syntax + (format #f "set -x ~a \"~a\"" variable value) + (format #f "export ~a=\"~a\"" variable value))) + ('prefix + (if is-fish? + (format #f "set -x ~a \"~a\" $~a" + variable value variable) + (format #f "export ~a=\"~a${~a:+~a}$~a\"" + variable value variable separator variable))) + ('suffix + (if is-fish? + (format #f "set -x ~a $~a \"~a\"" + variable variable value) + (format #f "export ~a=\"$~a${~a:+~a}~a\"" + variable variable variable separator value)))))) (define* (search-path-definition search-path value #:key (kind 'exact)) -- 2.17.1