unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Raghav Gururajan <rg@raghavgururajan.name>, guix-devel@gnu.org
Subject: Re: delete-generations or --delete-generations?
Date: Fri, 27 Aug 2021 11:27:06 +0200	[thread overview]
Message-ID: <86v93rb5lh.fsf@gmail.com> (raw)
In-Reply-To: <fdb27bc6-875e-d0e7-8d8e-4c21331b06c4@raghavgururajan.name>

Hi Raghav,

On Thu, 26 Aug 2021 at 21:04, Raghav Gururajan <rg@raghavgururajan.name> wrote:

> Why there is no '--' prefix to 'delete-generations' for `guix system`, 
> when there is for `guix pull` and `guix package`?

I speculate too. :-) I guess because the idea behind “guix system” is
one action at a time however “guix package” can compose actions in one
transaction (guix package --install=foo --remove=bar).  Using the
default CLI parser (SRFI-37), it seems easier for composing to use the
options (--<name-it>) than to extract actions.  For instance, if it was
“guix package <action>” as it is with “guix system”, then it is harder
to parse the composition, i.e.,

  guix package install foo remove bar

Aside the CLI parser is more work than just using ’args-fold’ from
SRFI-37, ambiguities happen: consider the case where ’remove’ is also a
package, for instance.

Then the other actions (--list-generations, --show, --search, etc.)
would inherit from this initial “guix package” design about composition
for a install/remove transactions.

Well, I agree that “guix system” is inconsistent with the rest of
commands.  First, “guix system” does not enjoy the typo hinter:

  $ guix system delte-generations
  guix system: error: delte-generations: unknown action

compared to:

  $ guix package --delte-generations
  guix package: error: delte-generations: unrecognized option
  hint: Did you mean `delete-generations'?

Well, although it is obviously fixable. ;-) Second, it leads to corner
cases as describe by the manual, for instance,

  $ guix system delete-generation -1
  guix system: error: 1: unrecognized option

here ’-1’ is considered by the parser as a short option, so one needs:

  $ guix system delete-generation -- -1

Issue which does not happen using “--delete-generation”. :-)

On the other hand, the composition is not totally true, for instance:

  $ guix package --show=cuirass --search="GNU hello"
  name: hello
  …

  $ guix package  --search="GNU hello" --show=cuirass
  name: cuirass
  …

although it is debatable to compose them. :-)


Ah consistent CLI, so complicated topic! ;-)


Cheers,
simon

PS: It reminds me issues with short-name accepting optional argument:

   guix package -I -p /tmp/profile # fails
   guix package -p /tmp/profile -I # works

<http://issues.guix.gnu.org/40549#19> where a next action is described
here <http://issues.guix.gnu.org/40549#22>. :-)



  parent reply	other threads:[~2021-08-27  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  1:04 delete-generations or --delete-generations? Raghav Gururajan
2021-08-27  2:55 ` Jack Hill
2021-08-27  9:27 ` zimoun [this message]
2021-09-08 20:59   ` Ludovic Courtès
2021-09-09 13:47     ` Leo Famulari
2021-09-09 14:14       ` André A. Gomes
2021-09-09 14:44         ` Leo Famulari

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=86v93rb5lh.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=rg@raghavgururajan.name \
    /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 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).