diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index abd5b269..f5149aba 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1261,6 +1261,38 @@ (else (display "No libraries matched your query.\n"))))) +(define (all-packages repositories) + (filter + (lambda (item) + (if (and (list? item) (equal? (car item) 'package)) item #f)) + repositories)) + +(define (command/list-all cfg spec . args) + (let* ((repositories (current-repositories cfg)) + (sexp? (conf-get cfg 'sexp?)) + (separator (conf-get cfg 'separator " ")) + (name->dotted + (lambda (name) + (string-join + (map (lambda (item) + (cond ((symbol? item) (symbol->string item)) + ((number? item) (number->string item)) + (else (error "Unknown type in library name" name)))) + name) + "."))) + (names (map package-name (all-packages repositories)))) + (when sexp? (display "(")) + (for-each + (lambda (name) + (if (conf-get cfg 'dotted-format?) + (display (name->dotted name)) + (display name)) + (display separator)) + names) + (when sexp? (display ")")) + (newline))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Show - show detailed information for the given libraries ;; diff --git a/lib/chibi/snow/commands.sld b/lib/chibi/snow/commands.sld index ee0b5d01..d9e3a0c9 100644 --- a/lib/chibi/snow/commands.sld +++ b/lib/chibi/snow/commands.sld @@ -13,6 +13,7 @@ command/install-dependencies command/remove command/search + command/list-all command/show command/status command/srfi-list diff --git a/tools/snow-chibi.scm b/tools/snow-chibi.scm index ae57b281..88918579 100755 --- a/tools/snow-chibi.scm +++ b/tools/snow-chibi.scm @@ -95,7 +95,8 @@ (foreign-depends (list string) "foreign libraries library depends on") (use-curl? boolean ("use-curl") "use curl for file uploads") (sexp? boolean ("sexp") "output information in sexp format") - )) + (dotted-format? boolean "output the package names in dotted format") + (separator string "string to separate package names with, defaults to space"))) (define (conf-default-path name) (or (get-environment-variable "SNOW_CHIBI_CONFIG") @@ -105,6 +106,13 @@ (define search-spec '()) (define show-spec '()) +(define list-all-spec + '((dotted-format? boolean + ("dotted-format") + "output the package names in dotted format") + (sexp? boolean ("sexp") "output the package names as sexp") + (separator string + "string to separate package names with, defaults to space"))) (define install-spec '((skip-tests? boolean ("skip-tests") "don't run tests even if present") (show-tests? boolean ("show-tests") "show test output even on success") @@ -156,8 +164,7 @@ (test-library sexp) (sig-file existing-filename) (output filename) - (output-dir dirname) - )) + (output-dir dirname))) (define upload-spec `((uri string) ,@package-spec)) @@ -180,6 +187,9 @@ (search "search for packages" (@ ,@search-spec) (,command/search terms ...)) + (list-all + "list all packages" + (@ ,@list-all-spec) (,command/list-all)) (show "show package descriptions" (@ ,@show-spec) (,command/show names ...))