This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-27
Channels
- # announcements (26)
- # babashka (36)
- # beginners (7)
- # biff (34)
- # calva (9)
- # cider (5)
- # clj-http (9)
- # clj-kondo (24)
- # cljs-dev (9)
- # clojure (110)
- # clojure-austin (1)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # clojurescript (4)
- # clr (1)
- # core-async (9)
- # cursive (11)
- # datomic (6)
- # emacs (17)
- # events (3)
- # fulcro (45)
- # graphql (6)
- # helix (1)
- # hyperfiddle (28)
- # java (1)
- # london-clojurians (1)
- # lsp (75)
- # malli (1)
- # membrane (35)
- # reitit (4)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (48)
- # tools-build (5)
- # tools-deps (26)
@UJSBQNUG6 This is implicitly already there in the form of:
(fs/file .. .. ..)
hmm, okay, that works
don’t you think it would be convenient to have such thing?
okay, I missed the fs/path
one
Is there a way to display a formatted help for a dispatch table with babashka.cli?
cli/format-opts
is great, but I cannot see how could I display the command table in a nice way
@UJSBQNUG6 For the command table it's not there (yet), I've done it manually so far
E.g. in neil:
https://github.com/babashka/neil/blob/65a078a24462ab06fc7bc3bd5e240f4adfaa7f8a/src/babashka/neil.clj#L629
I print a global overview and then use format-opts
to print the details for each subcommand
there is a bit of duplication here and there
but it works, thanks!
I suspect there won't be a single way that fits every subcommand need, but maybe it's worth a shot one day
that is fine, I thought there might be something but I am blind as I proved earlier 😄
when using babashka.http as a library, is it possible to use a newer version of it or will the built-in always be used instead? It seems to be preferring the built-in version so a bb upgrade was a breaking change in our case.
For babashka.fs: Are you interested in a PR that would extend the zip
function to allow more flexibility with relative paths?
Some ideas in:thread:
Right now you must specify relative paths for entries that will be mirrored in the resulting zip.
Specifically right now I'm trying to remove this babashka shell call to zip
.
(shell {:dir "root-dir"}
"zip" "myzip.zip"
"file1.txt"
"file2.txt"
"file3.txt")
Which takes the given file in the root-dir and puts them in a zip. Unfortunately zip cli calls aren't optimal for cross platform things.
So one way to support this in fs is have the zip function take an option that essentially "relativizes" the paths when putting them in the zip.
(fs/zip "myzip.zip" ["root-dir/file1.txt"
"root-dir/file2.txt"
"root-dir/file3.txt"]
{:relativize-entry-paths "root-dir"})
Another more general option might be to allow a function to be passed to transform an entry to the path that will appear in the zip, ie
(fs/zip "myzip.zip" ["root-dir/file1.txt"
"root-dir/file2.txt"
"root-dir/file3.txt"]
{:entry-path (fn [p] (fs/relativize "root-dir" p))})
Another idea is to allow a map for the entries themselves, mapping the path on the filesystem to the path it will appear in the zip:
(fs/zip "myzip.zip" {"file1.txt" "path/for/file1.txt"
"file2.txt" "another/path/file2.txt"})
I sort of like the last option the best, but interested in any input. Also open to the idea that this is getting too fancy with zipping functionality for a general file library, and it should be somewhere else.
This issue may be related: https://github.com/babashka/fs/issues/67
> Another more general option might be to allow a function to be passed to transform an entry to the path that will appear in the zip, I think this will be the most flexible option
but do I understand correctly that you just want to get rid of the parent directory, like in that issue?
I want to use a different directory as the parent directory, which I think is different
One thing I realized I missed is the case where a directory is specified as an entry. Presumably the path-fn in that case would return the entry path of the directory. And then the contents of that dir are all given a path relative to that in the zip
@U064UGEUQ I went ahead and added both :root
and :path-fn
- it's released, see #C06MAR553