From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] environment: Add a prompt-name argument. Date: Mon, 24 Oct 2016 22:40:48 +0200 Message-ID: <87ziltzdin.fsf@gnu.org> References: <87lgxjp98m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bym3D-00036O-Iw for guix-devel@gnu.org; Mon, 24 Oct 2016 16:40:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bym39-0002mt-Li for guix-devel@gnu.org; Mon, 24 Oct 2016 16:40:55 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bym39-0002mn-Ic for guix-devel@gnu.org; Mon, 24 Oct 2016 16:40:51 -0400 In-Reply-To: <87lgxjp98m.fsf@gnu.org> (Roel Janssen's message of "Thu, 20 Oct 2016 13:09:45 +0200") 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" To: Roel Janssen Cc: guix-devel@gnu.org Hi, Roel Janssen skribis: > This patch adds a -p and --prompt-name argument to @code{guix > environment}, and puts the argument's value between the square brackets > instead of "env". Sounds like a good idea! Maybe =E2=80=98--prompt-suffix=E2=80=99 would be = more accurate a name? WDYT? >>From ea958e847019c94a2bde49285f1436dfec72e570 Mon Sep 17 00:00:00 2001 > From: Roel Janssen > Date: Thu, 20 Oct 2016 13:07:15 +0200 > Subject: [PATCH] environment: Add a prompt-name argument. > > * guix/scripts/environment.scm: Add --prompt-name (-p) argument. Some cosmetic suggestions follow=E2=80=A6 :-) > (define* (launch-environment/container #:key command bash user-mappings > - profile paths network?) > + profile paths network? prompt-nam= e) Make it (prompt-suffix %default-prompt-suffix) with: (define %default-prompt-suffix ;; The default prompt suffix " [env]") such that #:prompt-suffix is always a string. > + (setenv "PS1" (string-append "\\u@\\h \\w [" > + (if (not prompt-name) > + "env" > + prompt-name) Assume =E2=80=98prompt-name=E2=80=99 is a string. > + (let* ((opts (parse-args args)) > + (pure? (assoc-ref opts 'pure)) > + (container? (assoc-ref opts 'container?)) > + (network? (assoc-ref opts 'network?)) > + (prompt-name (assoc-ref opts 'prompt-name)) I=E2=80=99d change =E2=80=98%default-options=E2=80=99 like this: (define %default-options `(=E2=80=A6 (prompt-suffix . ,%default-prompt-suffix))) > + #:prompt-name prompt-n= ame Maybe add the brackets here? Like: #:prompt-suffix (match prompt-suffix ("" "") ;allow for an empty suffix ((? string? suffix) (string-append " [" suffix "]"))) Thanks! Ludo=E2=80=99.