guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#50296] [PATCH 1/2] scripts: Add 'guix home'.


From: zimoun
Subject: [bug#50296] [PATCH 1/2] scripts: Add 'guix home'.
Date: Tue, 31 Aug 2021 12:53:51 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]