From 6f8ba58642df9bc07881a23518cc53fac30c8405 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 23 Jun 2014 23:37:29 +0900 Subject: [PATCH] package-author takes an optional arg to show email --- lib/chibi/snow/commands.scm | 2 +- lib/chibi/snow/package.scm | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 45df2fd1..84b51340 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1050,7 +1050,7 @@ (display " ") (display i) (display " ") (display (package-name pkg)) (display " ") (display (package-version pkg)) - (display " (") (display (package-author repo pkg)) + (display " (") (display (package-author repo pkg #t)) (display ")\n") (lp (cdr ls) (+ i 1))))) (let ((n (input-number cfg 'candidate-number "Candidate number: " diff --git a/lib/chibi/snow/package.scm b/lib/chibi/snow/package.scm index ea38cac0..48acb6b5 100644 --- a/lib/chibi/snow/package.scm +++ b/lib/chibi/snow/package.scm @@ -80,14 +80,17 @@ (and (pair? sig) (assoc-get (cdr sig) 'email eq?))))) -(define (package-author repo pkg) +(define (package-author repo pkg . o) (and (package? pkg) - (let ((email (package-email pkg))) + (let ((email (package-email pkg)) + (show-email? (and (pair? o) (car o)))) (or (cond ((repo-find-publisher repo email) => (lambda (pub) - (string-append (or (assoc-get pub 'name) "") - " <" (or email "") ">"))) + (let ((name (assoc-get pub 'name))) + (if (and name show-email?) + (string-append name " <" (or email "") ">") + (or name email ""))))) (else #f)) email))))