From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id OBglFxaAp2UX4AAAqHPOHw:P1 (envelope-from ) for ; Wed, 17 Jan 2024 08:21:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id OBglFxaAp2UX4AAAqHPOHw (envelope-from ) for ; Wed, 17 Jan 2024 08:21:58 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=BJOJL2qz; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705476118; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EiYARU02fImWGbV6isc/ZQNHfCTfMLodtortfyerEgg=; b=CJqFgRF6vZUDvLOH3X6Mc++8yCXNuyj9BeONKPJy9aDOrUU9zegp7pk/Fwvqz/lSHr6Rvf M0YG8ED9ssEzEo2q0BDvhjMwVsVzgeytpSywJnoteM9i4zCnhde0eSV0n6//7KlPBuvnwm sgcaD1jJeNh2cHtIXRR5LftlOPuFeoUiI78HnfCFog5sNZ9HlJHyEG4/K5RYZ3IF4IyxWF uJvVaLXBYr27eUCEd6ytGuGX6SFGSgVVX2M9mZ/MH/3iSLfHOZtmK5UvGXj+SIh5/nnEii lP2E8k4kHoOFSoSk9L4mUNaVEbCNsCJGXeE4JwOJvCaAeC9Dlc29ihtyrgOexA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705476118; a=rsa-sha256; cv=none; b=fWP2aIgUo5fkiVweAVYpMliq9eFcnrxBy2C6y2ZYGfGnCtV/LBmt3OLA4V04Ss4KahvLpE 0tjdKl2sLrLACYaZ7xPJ+bN1zbiJeFq2jK3BpZdN4VVRwoMbXsySHUbQ4BWJRBSXHzpQVX 0TFkSAy6tgiyNcSOU3h56+aAQd44T43O50VQfEhe+/3/eMDo6DUgGW/AqkSZoSVSztXDIW TPEX5wysvmNw837I+PTcvOvEWnPsh23qGHEicigUCETauVmReun+7w1rkFG3k6mh2lCTr4 iZO6J/2+Y9ZhLAJyikcPg6za7g8BC6cmc0pIC95G2zOhJkBoPRZGOrrEUtNkqw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=BJOJL2qz; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E457CE6EE for ; Wed, 17 Jan 2024 08:21:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ0Ep-0005MQ-T9; Wed, 17 Jan 2024 02:21:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQ0Eo-0005MF-6x for guix-devel@gnu.org; Wed, 17 Jan 2024 02:21:26 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQ0El-0004p8-D9 for guix-devel@gnu.org; Wed, 17 Jan 2024 02:21:25 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e8801221cso5131045e9.1 for ; Tue, 16 Jan 2024 23:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705476081; x=1706080881; darn=gnu.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=EiYARU02fImWGbV6isc/ZQNHfCTfMLodtortfyerEgg=; b=BJOJL2qzMg7i5sB/ueiZQsOUJ1dARIxOOuiQ1VkFIXIUu0K7w4kL01ISttSpcwriej PIEBzPWPZEQ4KtytpKRAhgtyle6/zjW0cIhkgpJVxuqZzA2jnotVmnT84lHr/FbDf1QE FWSnC82yekaFWTDTMm2Vew6uUyNaRzcUlZRvQLPN9P8QaiFB607kppnS5vreBuRkEUR4 sHrNZga8PQIvizOFrIWfz8UwPG2JUSNw0a+rQn29gEdBenpqv4CjbBIztpPO/aGIvlFS cvP+cVDVr1KvT/fNKVYb0hxVDbRPbJJisyuj1I9uJwrYeYxpr+RWqDtl+/4lsRHMWb33 p0Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705476081; x=1706080881; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EiYARU02fImWGbV6isc/ZQNHfCTfMLodtortfyerEgg=; b=F5Ge46sK9vIu+ad8+5LOESVtG8cSFkSMFWvAJHOlIqFW2eAaaV2pXrfnGjrAvLXU49 9P7jsiMBw5XBLfeTREdG6RR97fYukr0NedFjApWNfYvTCSO0tQJL/Zspio8ibFkdV9dv 7V8r/Jd9Kn75NGnBzFbO4jTB/NlBBbn28zwDxq1Oefn+vXQNEQF8wFBK/UicKinF/xpA cIW830t8HD1t/AChWSZ6g6EAtsvj1f424Ux9vgfcQ6YDNQ70sO7tW2hQlZJzl40PlgXI Jq1LD8o9nIxrRigEreA5FxlEMiTmYXXDonnJgkTEnoL35tmG3/sM1Fj4hIMT4nlRu9AU WnCA== X-Gm-Message-State: AOJu0YyVTsmxQrDbAE9aIo+RnXs6XA/E43jGi3aDEi1xczfjDVbFy9c3 6iCTwK5edrx7KTWCtaBg/ZJHjq3R6Dhrtw== X-Google-Smtp-Source: AGHT+IEBqugfA2w6JGvxNw3vO0EWgjIv6AbqeZKE/bR3yG96TfjyQOsaHLrNTQdBcaYDMCD1Vbdayg== X-Received: by 2002:a7b:cb05:0:b0:40e:5bd0:a87a with SMTP id u5-20020a7bcb05000000b0040e5bd0a87amr4789789wmj.60.1705476080539; Tue, 16 Jan 2024 23:21:20 -0800 (PST) Received: from localhost ([141.226.15.142]) by smtp.gmail.com with ESMTPSA id r19-20020a05600c459300b0040e42391a12sm21257922wmo.13.2024.01.16.23.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 23:21:19 -0800 (PST) Date: Wed, 17 Jan 2024 09:21:18 +0200 From: Efraim Flashner To: Ian Eure Cc: guix-devel Subject: Re: Guix CLI, thoughts and suggestions Message-ID: Mail-Followup-To: Ian Eure , guix-devel References: <87il3upczg.fsf@retrospec.tv> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9HOceSRJQv4uYgb/" Content-Disposition: inline In-Reply-To: <87il3upczg.fsf@retrospec.tv> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=efraim.flashner@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list 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+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -4.29 X-Spam-Score: -4.29 X-Migadu-Queue-Id: E457CE6EE X-TUID: xZtzVCZD23Xp --9HOceSRJQv4uYgb/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 15, 2024 at 11:24:29AM -0800, Ian Eure wrote: > Greetings, >=20 > As I=E2=80=99ve been learning Guix, one of the things I=E2=80=99ve found = somewhat unpleasant > is the lack of consistency within the guix CLI tool. It feels a bit > Git-like, with not much consistency, commands that non-obvioulsy perform > more than operation, related commands in different places in the tree, et= c. >=20 > Just so you know where I=E2=80=99m coming from: I=E2=80=99ve found that c= ompliex CLI tooling > benefits from organization and consistency. The Linux ip(8) command is a > good example of this kind of organization: to add an IP address, you use = `ip > address add'. To show address, `ip address show', and to remove one `ip > address del'. When options are needed, they get added after the verb or > branch in the verb tree; the final verb may take positional arguments as > well as --long or -s (short)-form options. >=20 > Some examples of where I think Guix could do better. This is an > illustrative list, not an exhaustive one. >=20 > Inconsistent organization > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D >=20 > Most package-related commands are under `guix package', but many are sibl= ing > commands. Examples are `guix size', `guix lint', `guix hash', etc. >=20 >=20 > Inconsistency between verbs and options > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Some verbs are bare-word positional arguments, and others are flags to > related verbs. IMO, this is the biggest problem, and makes it very > difficult to find all the things the CLI can do. `guix package' is a major > offender in this area, as it mixes verbs and verb-specific options into t= he > same level. For example, installing a package is `guix package -i foo' > rather than `guix package install foo', removing is `guix package -r foo' > rather than `guix package remove foo', and listing installed packages is > `guix package -I' rather than `guix package installed' (or similar). >=20 > This means that users can express commands which *seem* like they should > work, but do not. For example `guix package -i emacs -r emacs-pgtk -I' > represents a command to 1) install emacs 2) remove emacs-pgtk 3) list > installed packages (which would verify the previous two operations > occurred). This is a valid command within the accepted organization of > `guix package', and doesn=E2=80=99t cause an error, but doesn=E2=80=99t w= ork: the install > and remove steps are ignored. I found this part surprising. I know you can chain together -i and -r, but I had never tried adding -I to the list also, and it makes sense to me that it should be able to be chained in also. > A thing I=E2=80=99ve found throughout my ca= reer is > that designing systems so it=E2=80=99s *impossible* to represent unsuppor= ted, > nonsensical, or undefined things is an extremely valuable technique to av= oid > errors and pitfalls. I think Guix could get a lot of mileage out of > adopting something similar. >=20 > This causes a related problem of making it impossible to know what options > are valid for what verbs. Will `guix package --cores=3D8 -r emacs' remov= e the > package while using eight cores of my system? Will `guix system -s i686 > switch-generation 5' switch me to a 32-bit version of generation 5? If > verbs are organized better, and have their own options, this ambiguity > vanishes. >=20 >=20 > More inconsistency > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Other parts of guix have the opposite problem: `guix system docker-image' > probably ought to be an option to `guix system image' rather than a separ= ate > verb. >=20 >=20 > Inconsistency between similar commands > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > There are generations of both the system (for GuixSD) and the user profil= e, > however, they work differently. For the system, there=E2=80=99s `guix sy= stem > list-generations' and `guix system switch-generation', but for the user > profile, you need `guix package --list-generations' and `guix package > --switch-generation=3DPATTERN'. Additionally, no help is available for e= ither > of the system commands: `guix system switch-generations --help' gives the > same output as `guix system --help' -- no description of the supported wa= ys > of expressing a generation are available. >=20 >=20 > Flattened verbs > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Related, the generation-related commands under `guix system' ought to be = one > level deeper: `guix system generation list', `guix system generation swit= ch' > etc. >=20 >=20 > Repeated options > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Many commands (`guix package', `guix system', `guix build', `guix shell') > take -L options, to add Guile source to their load-path. This probably ou= ght > to be an option to guix itself, so you can do `guix -L~/src/my-channel bu= ild > ...'. >=20 >=20 > Suggestions > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > All commands should be organized into a tree of verbs. >=20 > Verbs should have common aliases (`rm' for `remove', etc). >=20 > Verbs should be selected by specifying the minimum unambiguous substring. > For example `guix sys gen sw' could refer to `guix system generation > switch'. >=20 > Options should be applicable to each level of the tree, ex `guix > -L~/src/my-channel' would add that load-path, which would be visible to a= ny > command. >=20 > Requesting help is a verb. Appending "help" to any level of the verb tree > should show both options applicable to that verb, and its child verbs. > `guix help' would show global options and all top-level verbs (package, > system, generation, etc); `guix package help' would show package-specific > options and package-specific verbs; and so on. >=20 >=20 > Conclusion > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I have no idea if anyone feels similarly about this, or whether there=E2= =80=99s > appetite to change the CLI, but I think it=E2=80=99d be time well-spent. = Having > some kind of agreed-upon standard for how the CLI stuff is organized seems > like a good thing to me, even if it just stops or slows the addition of m= ore > commands with unique expressions. >=20 > It seems like a lot of work to change, and backwards compatibility also is > an issue. One option I could see working is shoving the entire existing > structure under a command in the new tool, so you could do `guix old pack= age > -I' or similar. An alternate approach would be using an environment > variable to change behaviors. >=20 > What do you all think? This is probably the most well written critique I've seen on the layout of the CLI for Guix. I think it would be worthwhile to mock-up a 'guix profile' command to see how it would look. I'm going to add it as a possible topic for Guix Days just before FOSDEM and see if we can create something that makes more sense. --=20 Efraim Flashner =D7=A8=D7=A0=D7=A9=D7=9C=D7=A4 = =D7=9D=D7=99=D7=A8=D7=A4=D7=90 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --9HOceSRJQv4uYgb/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmWnf+sACgkQQarn3Mo9 g1FDoQ/9FWXLQB0UTrhED/EdQkqDPym+tKtdQSpjPejJHaHkPFa3DTaYK6Jp5Bu3 B7Xt7B0Vj+QkZZUpgeYKeGvrCdb9TelVoBgAh3XzrG7q61PJ249akf6ux+e5N75K HgIHTGXijM6cuKN1J0cK8FO6k34CqDU8c4km9XdvvmplZLSLzy3Y9lgoKTUZPZL7 +13uPfLFUicrm7ueQzLzTeWGbQV23W9Bew83fRhCQRQHc2KOMJTAmd3hoJINhq2m 4p57dRqFBy0dyAetOBsmrRbW11rVcfRS4jKSQK4ocQVx2+bGP4TBqw3H0ockVB15 5jE4obMfWgnoTbV+Zz0/IitdON5qGeX9/wBwpapuKDkp4OhbLjy86H67yAX4+boe NTc9BLDWiDVxDT5/1EdBON5p+r9qvuCKaLfYEKsmZVDvTAIOk+EF4BYWEexyvtMv 3cnrtx19CtCxYgdPrTEw1FnCzjtvVPmASE/pf8W4AcxByK0F/HvQwfB8EJ80Rwsz ZEPpOzTNkW0UtUtuz3hJ/QBvRxgyp7gf8jRcW6samzRaiKv371rQa9oLMCI/0x7c meL9JHhJkcRO8Py6Bx+hpDiuiUJmFtxdOZhXlw5JEmqTByK/bTQ3ynz2AQaTN/e1 n0frS06eoh6iun+THjSVVl6oLdNOuBgmIdYaEyMekHKUoKqBW0w= =4JN8 -----END PGP SIGNATURE----- --9HOceSRJQv4uYgb/--