all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roel Janssen <roel@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] environment: Add a prompt-name argument.
Date: Thu, 27 Oct 2016 10:51:12 +0200	[thread overview]
Message-ID: <8760oedvjz.fsf@gnu.org> (raw)
In-Reply-To: <87ziltzdin.fsf@gnu.org>


Ludovic Courtès writes:

> Hi,
>
> Roel Janssen <roel@gnu.org> 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 ‘--prompt-suffix’ would be more accurate
> a name?  WDYT?

I think the goal is to identify the environments by name, and whether
that's by adding a suffix or a prefix doesn't really matter.  So I
believe we should emphasize on "name" and not on "suffix".

I wanted to use --name first, but it doesn't explain why we would use -p
for the short option instead of -n (which is already taken by --dry-run).

WDYT?

>>From ea958e847019c94a2bde49285f1436dfec72e570 Mon Sep 17 00:00:00 2001
>> From: Roel Janssen <roel@gnu.org>
>> 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…  :-)
>
>>  (define* (launch-environment/container #:key command bash user-mappings
>> -                                       profile paths network?)
>> +                                       profile paths network? prompt-name)
>
> 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 ‘prompt-name’ 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’d change ‘%default-options’ like this:
>
>   (define %default-options
>     `(…
>       (prompt-suffix . ,%default-prompt-suffix)))
>
>> +                                                  #:prompt-name prompt-name
>
> Maybe add the brackets here?  Like:
>
>   #:prompt-suffix (match prompt-suffix
>                     ("" "")  ;allow for an empty suffix
>                     ((? string? suffix) (string-append " [" suffix "]")))
>
> Thanks!
>
> Ludo’.

These are great suggestions!  I will adapt it when we agree
upon the long option name :).

Thanks!

Kind regards,
Roel Janssen

  reply	other threads:[~2016-10-27  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 11:09 [PATCH] environment: Add a prompt-name argument Roel Janssen
2016-10-24 20:40 ` Ludovic Courtès
2016-10-27  8:51   ` Roel Janssen [this message]
2016-10-27 12:47     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760oedvjz.fsf@gnu.org \
    --to=roel@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.