Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions lib/chibi/snow/commands.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
1 change: 1 addition & 0 deletions lib/chibi/snow/commands.sld
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
command/install-dependencies
command/remove
command/search
command/list-all
command/show
command/status
command/srfi-list
Expand Down
16 changes: 13 additions & 3 deletions tools/snow-chibi.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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))
Expand All @@ -180,6 +187,9 @@
(search
"search for packages"
(@ ,@search-spec) (,command/search terms ...))
(list-all

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently search with no terms just takes a long time to output nothing. We could repurpose that to be equivalent to list-all, though it may not be intuitive. It's fine to make list-all a separate command, but they should share the same underlying code.

"list all packages"
(@ ,@list-all-spec) (,command/list-all))
(show
"show package descriptions"
(@ ,@show-spec) (,command/show names ...))
Expand Down