This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-28
Channels
- # adventofcode (2)
- # announcements (4)
- # babashka (34)
- # beginners (44)
- # biff (5)
- # calva (8)
- # cider (4)
- # clj-kondo (5)
- # clj-on-windows (5)
- # clojure (57)
- # clojure-art (1)
- # clojure-denmark (2)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-seattle (1)
- # clojure-uk (2)
- # clojurescript (20)
- # cursive (6)
- # datomic (1)
- # emacs (6)
- # events (5)
- # fulcro (22)
- # helix (5)
- # hyperfiddle (5)
- # jobs (1)
- # joyride (2)
- # lsp (8)
- # malli (8)
- # off-topic (30)
- # pathom (8)
- # pedestal (1)
- # portal (5)
- # proton (1)
- # rdf (2)
- # re-frame (4)
- # releases (1)
- # remote-jobs (1)
- # reveal (8)
- # xtdb (5)
Hello, when using -x
I get CLI params parsing for “free”, but when I use the task runner I get a more “raw” version of the params in *command-line-args*
. If there a way to get the same parsing in the task runner?
@stathissideris yes :) use :task (exec 'my.ns/my-fn)
and your function will be called with the parsed arguments map
thank you!
follow up: is one of -x
/tasks runner the preferred way to do things? or are they both considered ok and you pick whichever you like?
pick whichever you like, but I find the task runner the easiest to remember the things you can do in a project
yeah I suppose it’s like a high-level doc of some sort… and dependencies/parallel tasks are pretty neat 🙂
any advice for making task runner tasks available globally in a system? I’m writing a postgresql helper tool and I’d like to be able to run it from anywhere in the system. I think I’ll define an alias in my shell, but I’m not sure how it will behave in terms of directories etc
this isn't really what the task runner is for, you should think of the task runner as a Makefile-like replacement. To make global tools, I recommend writing a script or github repo and then make it installable with #babashka-bbin https://github.com/babashka/bbin you will have to implement the CLI yourself in this case, using the babashka.cli library you can find some examples here: https://github.com/borkdude/tools
thanks for pointing me in the right direction… I’ll try to get it the code right first and then convert it
the shared part of these things is the library interface, you can use a library in tasks and in tools
(you’re like an one-man ecosystem 😄 )
it seems related with https://github.com/clojure-lsp/clojure-lsp/blob/master/lib/src/clojure_lsp/internal_api.clj#L291
#error {
:cause Not supported: class clojure_lsp.internal_api$clean_ns_BANG__STAR_$fn__34827
:via
[{:type java.lang.RuntimeException
:message java.lang.Exception: Not supported: class clojure_lsp.internal_api$clean_ns_BANG__STAR_$fn__34827
:at [com.cognitect.transit.impl.WriterFactory$1 write WriterFactory.java 65]}
{:type java.lang.Exception
:message Not supported: class clojure_lsp.internal_api$clean_ns_BANG__STAR_$fn__34827
:at [com.cognitect.transit.impl.AbstractEmitter marshal AbstractEmitter.java 195]}]
:trace
[[com.cognitect.transit.impl.AbstractEmitter marshal AbstractEmitter.java 195]
[com.cognitect.transit.impl.JsonEmitter emitMap JsonEmitter.java 171]
[com.cognitect.transit.impl.AbstractEmitter emitMap AbstractEmitter.java 86]
[com.cognitect.transit.impl.AbstractEmitter marshal AbstractEmitter.java 185]
[com.cognitect.transit.impl.AbstractEmitter marshalTop AbstractEmitter.java 212]
[com.cognitect.transit.impl.JsonEmitter emit JsonEmitter.java 41]
[com.cognitect.transit.impl.WriterFactory$1 write WriterFactory.java 62]
[cognitect.transit$write invokeStatic transit.clj 171]
[cognitect.transit$write invoke transit.clj 168]
[pod.clojure_lsp.api$write_transit invokeStatic api.clj 70]
[pod.clojure_lsp.api$write_transit invoke api.clj 68]
[pod.clojure_lsp.api$run_pod$fn__41678 invoke api.clj 116]
[pod.clojure_lsp.api$run_pod invokeStatic api.clj 108]
[pod.clojure_lsp.api$run_pod invoke api.clj 85]
[clojure_lsp.main$handle_action_BANG_ invokeStatic main.clj 156]
[clojure_lsp.main$handle_action_BANG_ invoke main.clj 149]
it's not relevant for bb pod actually, the clojure-lsp.internal-api is called by: • cli • editor • bb pod
https://github.com/clojure-lsp/clojure-lsp/blob/master/lib/src/pod/clojure_lsp/api.clj, I'll try
Has anyone before talked about the possibility of compiling babashka scripts into a standalone executable?
@U11EL3P9U You can do this with execa: https://github.com/babashka/babashka/wiki/Self-contained-executable