This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-18
Channels
- # announcements (22)
- # asami (7)
- # babashka (43)
- # beginners (68)
- # biff (2)
- # calva (10)
- # clj-kondo (7)
- # cljdoc (29)
- # clojure (41)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-nl (2)
- # clojure-norway (9)
- # clojure-uk (31)
- # clojurescript (3)
- # community-development (7)
- # cursive (3)
- # data-science (4)
- # datomic (17)
- # emacs (30)
- # honeysql (10)
- # hyperfiddle (39)
- # introduce-yourself (1)
- # jobs-discuss (5)
- # kaocha (1)
- # lsp (11)
- # malli (12)
- # pathom (18)
- # pedestal (3)
- # proletarian (2)
- # quil (11)
- # rdf (46)
- # reitit (8)
- # releases (2)
- # shadow-cljs (34)
- # sql (3)
- # squint (10)
- # tools-deps (24)
- # xtdb (10)
Is there a way to make -x
work with positional args, or are only named args supported?
bb -x my/f a b c
I tried :opts->args
but that doesn't seem to workI guess I can use *command-line-args*
directly?
Looks like *command-line-args*
contains the remaining args, so I'll use that. Unless that's unsafe?
no sorry I was wrong, positional args work, like this:
(ns dude)
(defn foo
{:org.babashka/cli {:coerce {:a []}}}
[{:keys [a b c]}]
(prn [a b c]))
oh I meant that I want to pass in a bunch of files names, like a.txt b.txt c.txt
(ns dude)
(defn foo
{:org.babashka/cli {:coerce {:a []}}}
[{:keys [a b c] :as m}]
(prn (meta m))
(prn [a b c]))
$ bb -cp /tmp -x dude/foo -a 1 2 3 -b 1 -c 2 1 2 3
#:org.babashka{:cli {:args ["1" "2" "3"]}}
[[1 2 3] 1 2]
oh the metadata 🤯
Hard to to search for
$ bb
Babashka v1.3.182 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (->> (babashka.process/shell "ls -l /tmp/*" {:out :string})
:out)
ls: cannot access '/tmp/*': No such file or directory
clojure.lang.ExceptionInfo [at <repl>:1:6]
user=>
This works fine if I drop the *
Guessing that sci is doing something to the *
before it gets to the shell. I get the same output on mac and linux.I see. I was trying to do a tar cvzf something.tgz /tmp/something*
when I hit the issue. I'll work around it, Thanks for the clarification.
the fs
api is great, I think I'll lean in to it to solve this one. Much appreciated.
(could be wrong channel to ask this) I use calva and it would be good if it were aware of the bb.edn file usage of functions.
It's probably best to minimize the amount of code in bb.edn and just require an external file and do the coding in there
I really only have the calls to the entry points for each task, but it would be good to a have help when creating the function calls and also show that a function is used.
@U0ETXRFEW what I notice is that the functions that are used as the entry points show as unused, in someways helpful as you can find them, but in otherways it also keeps making me think I have made an error somewhere.
I don’t know what’s possible here. This is functionality that Calva sources from #CPABC1H61 and. by proxy, #CHY97NXE2. @U04V15CAJ knows more about what’s involved. 😃
It is a bit of a strange request as you are in effect tying an .edn file as if it were a code file, which is unusual for tools to pick up on.
@U4C3ZU6KX navigation from edn files to functions does work when the symbol is fully qualified
I am not seeing that. I have :
:tasks {:requires ([convert.core :as core]
[convert.utils :as utils]
[clojure.tools.cli :as cli])
convert (do
(println "Converting " (:import-dir options))
(core/handle-conversion (:import-dir options) (:export-dir options)))}
Thanks that worked. That just leaves the showing as unused in the convert.core.clj file.