unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Andrew Tropin <andrew@trop.in>, 50296@debbugs.gnu.org
Subject: [bug#50296] [PATCH 1/2] scripts: Add 'guix home'.
Date: Tue, 31 Aug 2021 12:53:51 +0200	[thread overview]
Message-ID: <86pmttopfk.fsf@gmail.com> (raw)
In-Reply-To: <87y28ihs07.fsf@trop.in>

Hi,

On Tue, 31 Aug 2021 at 12:40, Andrew Tropin <andrew@trop.in> wrote:

> +(define-command (guix-home . args)
> +  (synopsis "build and deploy home environments")
> +
> +  (define (parse-sub-command arg result)
> +    ;; Parse sub-command ARG and augment RESULT accordingly.
> +    (if (assoc-ref result 'action)
> +        (alist-cons 'argument arg result)
> +        (let ((action (string->symbol arg)))
> +          (case action
> +            ((build
> +              reconfigure
> +              extension-graph shepherd-graph
> +              list-generations describe
> +              delete-generations roll-back
> +              switch-generation search
> +              import)
> +             (alist-cons 'action action result))
> +            (else (leave (G_ "~a: unknown action~%") action))))))

For parsing the actions, I would define elsewhere the list.  Then if the
action is unknown, you could use ’string-closest’ and so return an hint
if there is a typo.

Other said, this

  guix home recnfigure

would return

  guix home: error: recnfigure: unknown action
  hint: Did you mean `reconfigure'?

WDYT?

Cheers,
simon




  reply	other threads:[~2021-08-31 11:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  9:28 [bug#50296] [PATCH 0/2] Add 'guix home' command Andrew Tropin
     [not found] ` <handler.50296.B.16304022327647.ack@debbugs.gnu.org>
2021-08-31  9:40   ` [bug#50296] [PATCH 1/2] scripts: Add 'guix home' Andrew Tropin
2021-08-31 10:53     ` zimoun [this message]
2021-08-31 12:12       ` Andrew Tropin
2021-08-31 13:09         ` zimoun
2021-09-01  5:20           ` Andrew Tropin
2021-08-31  9:40   ` [bug#50296] [PATCH 2/2] scripts: home: Add import subcommand Andrew Tropin
2021-08-31 10:46 ` [bug#50296] [PATCH 0/2] Add 'guix home' command zimoun
2021-08-31 12:03   ` Andrew Tropin
2021-08-31 11:13 ` bug#50296: " Oleg Pykhalov
2021-08-31 11:46   ` [bug#50296] " Andrew Tropin
2021-08-31 12:47     ` Andrew Tropin
2021-08-31 14:23       ` Oleg Pykhalov
2021-09-01  5:36         ` Andrew Tropin
2021-09-09  6:10         ` Andrew Tropin
2021-09-09 17:45           ` Oleg Pykhalov
2021-09-10  5:31             ` Andrew Tropin

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=86pmttopfk.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=50296@debbugs.gnu.org \
    --cc=andrew@trop.in \
    /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).