diff --git a/guix/scripts/git.scm b/guix/scripts/git.scm index 8fcd0ccca8..3b141a622d 100644 --- a/guix/scripts/git.scm +++ b/guix/scripts/git.scm @@ -18,18 +18,26 @@ (define-module (guix scripts git) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:use-module (guix ui) #:use-module (guix scripts) + #:use-module (srfi srfi-1) #:export (guix-git)) +(define %sub-commands + `(("authenticate" . "verify commit signatures and authorizations") + ("log". "show Git commit history"))) + (define (show-help) (display (G_ "Usage: guix git COMMAND ARGS... Operate on Git repositories.\n")) (newline) (display (G_ "The valid values for ACTION are:\n")) (newline) - (display (G_ "\ - authenticate verify commit signatures and authorizations\n")) + (for-each (match-lambda + ((name . help) + (format #t "~13a ~a\n" name help))) + %sub-commands) (newline) (display (G_ " -h, --help display this help and exit")) @@ -38,8 +46,6 @@ Operate on Git repositories.\n")) (newline) (show-bug-report-information)) -(define %sub-commands '("authenticate" "log")) - (define (resolve-sub-command name) (let ((module (resolve-interface `(guix scripts git ,(string->symbol name)))) @@ -61,7 +67,6 @@ Operate on Git repositories.\n")) ((or ("-V") ("--version")) (show-version-and-exit "guix git")) ((sub-command args ...) - (if (member sub-command %sub-commands) + (if (find (lambda (s) (string=? (first s) sub-command)) %sub-commands) (apply (resolve-sub-command sub-command) args) - (format (current-error-port) - (G_ "guix git: invalid sub-command~%"))))))) + (leave (G_ "~a: invalid sub-command~%") sub-command))))))