From 6b7245fb3858bee36184af851cac976613afa1aa Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Mon, 2 Oct 2023 21:47:46 +0200 Subject: cli: tabular output in list command --- neocities/cli.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/neocities/cli.scm b/neocities/cli.scm index 3e80ae4..d59e2c0 100644 --- a/neocities/cli.scm +++ b/neocities/cli.scm @@ -31,7 +31,16 @@ (exit 1)) (let-values (((response body) (neocities-list %api (and (not (null? args)) (car args))))) (if (neocities-success? body) - (display (assoc-ref body "files")) ;; TODO Display in table + (format #t + "Updated at~32tDir~36tFilename~86tSize~91tSHA-1~&~:{~A~33t~@[d~]~36t~A~84t~@[~6d~]~91t~@[~A~]~&~}" + (map + (lambda (file) (list + (assoc-ref file "updated_at") + (assoc-ref file "is_directory") + (assoc-ref file "path") + (assoc-ref file "size") + (assoc-ref file "sha1_hash"))) + (vector->list (assoc-ref body "files")))) (format (current-error-port) "~A~&" (assoc-ref body "message"))))) (define (neocities-cmd-key args) -- cgit v1.2.3