I updated it to just remove quotes completely for now, so it should work for those cases - feel free to ping me if there are other failures
Hi anyone know of a way to read and write to excel with babashka?
@kbosompem you could possibly shell out to some other CLI which can read excel. e.g.: https://csvkit.readthedocs.io/en/latest/scripts/in2csv.html
Other options: Excel is XML right...., manually read the XML? I honestly don't know how hard this is. The other option would be to make an excel pod.
If you rename the excel to .zip you can unzip it and there you will see a bunch of XML files. Maybe it's not too hard :) :/ :-s
Is there a good way to get a repl with all of the namespaces in my `:requires` key processed? (also the default commands)
@duck What kind of repl, just the command line REPL?
yeah. I found myself wishing that I had the same environment setup as I do in my task definitions. Figured there might be some easy way to acheive that
@duck This is for debugging only but when you run with BABASHKA_DEV=true bb run foo
it will run foo
but also print the program needed to run. Maybe that can form the basis for such a REPL experience... worth experimenting.
The program isn't pretty to look at btw
It's probably better to write a tiny script that parses your :init
and :requires
and makes a starter script
you can invoke (clojure.main/repl)
at the end of that script
worth looking into
just a simple repl (clojure.main/repl)
task seems to be enough to drop me into user1 with my global requires available.
wow nice!
this is worth documenting, I'll put it in the issue
Does babashka tasks support grouping subtasks?
Something like: bb :build <subtasks>
Not yet. I think just using a prefix like build-foo
, build-bar
could be the current way of grouping
I do want to add something around this, but it's not yet clear at this point
Ok thanks. May I specify the url to script file which is available on github?
of course!
Yay ❤️
I am now adding some logging around tasks:
1) By default the task names are printed before execution
2) It can be suppressed globally using :log-level :error
3) or on individual task level
4) in private tasks the log-level is :error
automatically
5) shell
and clojure
also print their command, they can be suppressed similarly
6) shell
and clojure
print a when their exit code is non-zero (with :log-level :info
and :error
)
A binary to test this will be available shortly on #babashka-circleci-builds...
example output from clj-kondo.lsp:
$ bb lsp-jar
> java1.8
> recent-clj-kondo
> update-project-clj
> build-server
> lein with-profiles -user do clean, run -m clj-kondo.lsp-server.impl.version
Generation version file: 2021.04.23 > ../vscode-extension/CLJ_KONDO_VERSION
> lein with-profiles -user do clean, uberjar
Compiling clj-kondo.lsp-server.impl.server
Compiling clj-kondo.lsp-server.impl.version
Compiling clj-kondo.lsp-server.main
Created /Users/borkdude/Dropbox/dev/clojure/clj-kondo.lsp/server/target/lsp-server-2021.04.23.jar
Created /Users/borkdude/Dropbox/dev/clojure/clj-kondo.lsp/server/target/lsp-server-2021.04.23-standalone.jar
> lsp-jar
#object[sun.nio.fs.UnixPath 0x157d3c8d "server/target/clj-kondo-lsp-server-2021.04.23-standalone.jar"]
@borkdude where can I find some bb.edn file specification?
@karol.wojcik https://github.com/babashka/babashka/issues/778
Hmm. I got the same structure as antq https://github.com/borkdude/antq/blob/bb.edn/bb.edn. When I type bb tasks babashka says that there are no tasks
I can't really diagnose anything if you link to something that is already working :)
which bb version are you using and which branch of antq are we looking at
We're looking at bb.edn branch
Babashka v0.3.5
try the bb-run
branch
Works
But tasks from script folder are not included
I am not sure what you mean by this
Isn’t it that paths for bb.edn specify where tasks are located?
Therefore bb tasks should return list of tasks which are in script folder?
@karol.wojcik That's not how it works. :paths
is the classpath for bb, you can also have :deps
, similar to deps.edn
. The tasks are the symbols in the :tasks
map
I think in the antq bb.edn :paths
isn't really used
Ahhh ok
Impressive bb.edn by @mike1452 : https://github.com/redstarssystems/rssyslib/blob/develop/bb.edn
Oh the requirement sections is a great idea!
@borkdude Thank you so much. Last question though. Is it possible to provide doc for babashka task from source script? I would rather not provide doc inline. Here is what I'm trying to build
{:paths ["script"
;; "<https://github.com/FieryCod/holy-lambda/tree/master/modules/holy-lambda-babashka-tasks/script>"
]
:tasks {:requires ([holy-lambda.tasks :as t])
doctor t/doctor} ;; when runing `bb tasks` I would love babashka to take doc of task `doctor` from source code.
}
@karol.wojcik Ah yeah, that's not yet supported yet, but I think that could work...
One potential "danger" there could be that requiring a script to get the docstring takes time and could cause side effects (although if you use it like this, it should not have any)
Is there an issue for it?
Not yet, please create one
I will probably do a release tomorrow or so with that one in
🙂
Lovely
Can I ask you for a favor? What OS do you use?
Btw I'm experimenting with babashka tasks and I like it's design so far. Found also one bug which I will report as well.
Arch Linux
Sure. Go ahead!
Could you try out this binary: https://17698-201467090-gh.circle-artifacts.com/0/release/babashka-0.3.6-SNAPSHOT-linux-amd64.tar.gz (latest from #babashka-circleci-builds) I has additional "logging": it prints the task names (also of dependent tasks that are running) and I want to know if this is useful/obtrusive
How it works is described here: https://github.com/babashka/babashka/discussions/779#discussioncomment-653726
Checking!
what is subcommand?
Imho it looks fine, but still I would like to have an option to disable it or provide my own decoration fn.
@karol.wojcik You can disable it with :log-level :error
or :log-level :none
but maybe a pluggable function is nicer
Maybe
[bb] clean
is a nicer logging format :)or:
[babashka] clean
I'll try that
Example from antq:
$ clojure -M:babashka/dev lint
[babashka] Running: lint
[babashka] Shell: echo cljstyle
cljstyle
[babashka] Shell: clj-kondo --lint src:test
linting took 309ms, errors: 0, warnings: 0
I could include the task name in the logging during the task, e.g.:
[babashka lint] Shell: clj-kondo --lint src:test
$ bb lint
[bb lint] Starting
[bb lint] echo cljstyle
cljstyle
[bb lint] clj-kondo --lint src:test
linting took 304ms, errors: 0, warnings: 0
I think that makes sense since bb lint
is the exact same command you can invoke in the command line
This might be a little bit annoying too btw:
$ bb lsp-jar
[bb java1.8] Starting
[bb recent-clj-kondo] Starting
[bb update-project-clj] Starting
[bb build-server] Starting
[bb lsp-jar] Starting
Maybe I'll just remove this logging idea
or put the default to :error
logging
I'll do that so we can start testing without annoying people with it
ok it's now:
$ bb lint
cljstyle
linting took 357ms, errors: 0, warnings: 0
and
$ bb run --log-level info lint
[bb lint]
[bb lint] echo cljstyle
cljstyle
[bb lint] clj-kondo --lint src:test
linting took 306ms, errors: 0, warnings: 0