Fork me on GitHub
#babashka
<
2023-04-24
>
mjhika03:04:21

I'm having an issue with a small project i'm fiddling on. I can't quite tell if it's a babashka/cli issue or a me issue and the way i'm trying to use the library. I assume this is the best place to post but I can always move it to another channel if i'm in the wrong spot. My project is a small utility to ping sweep a network for a given cidr. The code is sitting at https://github.com/mjhika/netscanner My specific issue is when I've built the jar and i'm trying to pass paramters to the jar to verify that everything worked the parameters appear to not be making it into the app. before packing into a jar it all works from the clojure cli. If i alter -main to prn the values given to it then I get nil 100 if i call the app with java -jar <jar-name>.jar --cidr "10.1.1.1/32" --timeout 10.

pesterhazy06:04:58

Could you boil it down to a minimal repro case?

borkdude07:04:20

@U01C9CMAPK4 I think the issue might be that you should use the arguments to -main instead of *command-line-args* since that var maybe isn't bound when you run it as a jar (with JVM Clojure)

❤️ 2
mjhika12:04:25

oh gosh I didn't even think that perhaps *command-line-args* wasn't bound when it's a jar. That was my bug

mjhika12:04:38

thanks guys for the help 🙂

furiel13:04:32

Hello, is there a way to specify aliases for bb? The bb.edn of my project has runtime and build time dependencies, and I am wondering if I could separate the test related dependencies under a :test alias. In the babashka book, I can only see how to pass aliases to deps/add-dep , but I do not see how to specify it for bb ( missing -A option).

2
borkdude13:04:55

@UR7TLKXKQ babashka currently doesn't have aliases, but tasks. if you have a test task, you can specify the test dependencies in there with :extra-deps

borkdude13:04:19

are you using the task runner?

furiel13:04:39

I am not using tasks right now, but I may be able to wrap my app into one. The structure of my repo looks like there are some independent scripts, bash, and babashka mixed. As the scripts are independent, I was thinking the usecases I would use tasks/makefiles/justfiles does not hold, so I created small wrappers around the babashka jobs: For example:

#!/usr/bin/env sh

bb --config "$(dirname $0)/test-runner/bb.edn" --main tests-runner $@

furiel13:04:16

I can probably wrap a task too.

borkdude13:04:07

You can also use babashka.deps/add-deps for the test runner dynamically

borkdude13:04:19

Perhaps aliases will be supported in the future, but currently not there.

👍 2
furiel14:04:34

Yes I can also investigate the add-deps route.