diff options
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r-- | emacs/guix-main.scm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index bec26c7c40..335686ed25 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -1083,3 +1083,25 @@ Return #t if the shell command was executed successfully." "Return a license URI by its name." (and=> (lookup-license name) license-uri)) + +(define %license-param-alist + `((id . ,license-name) + (name . ,license-name) + (url . ,license-uri) + (comment . ,license-comment))) + +(define license->sexp + (object-transformer %license-param-alist)) + +(define (find-licenses search-type . search-values) + "Return a list of licenses depending on SEARCH-TYPE and SEARCH-VALUES." + (case search-type + ((id name) + (let ((names search-values)) + (filter-map lookup-license names))) + ((all) + (licenses)))) + +(define (license-entries search-type . search-values) + (map license->sexp + (apply find-licenses search-type search-values))) |