This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-22
Channels
- # babashka (36)
- # beginners (42)
- # calva (6)
- # chlorine-clover (25)
- # cider (31)
- # clara (5)
- # clj-kondo (55)
- # cljdoc (3)
- # cljs-dev (7)
- # cljsrn (3)
- # clojure (73)
- # clojure-brasil (6)
- # clojure-europe (8)
- # clojure-italy (2)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-spec (3)
- # clojure-sweden (4)
- # clojure-switzerland (2)
- # clojure-uk (29)
- # clojurescript (93)
- # conjure (21)
- # data-science (14)
- # datomic (19)
- # emacs (4)
- # exercism (3)
- # figwheel-main (38)
- # fulcro (38)
- # graalvm (42)
- # graphql (5)
- # jackdaw (3)
- # jobs (1)
- # joker (2)
- # lambdaisland (1)
- # leiningen (31)
- # malli (8)
- # meander (5)
- # off-topic (27)
- # pathom (2)
- # pedestal (28)
- # re-frame (25)
- # reagent (2)
- # reitit (11)
- # releases (3)
- # remote-jobs (1)
- # rum (1)
- # shadow-cljs (63)
- # spacemacs (17)
- # sql (1)
Variable expansion macro:
$ export BABASHKA_PRELOADS="(defmacro $ [x] `(System/getenv ~(str x)))"
$ bb '(-> ($ PWD) (str/split #"/") last)'
"clj-kondo"
@U0510902N Feel free to list your pod here as well: https://github.com/borkdude/babashka/blob/master/doc/libraries.md#pods
Would it be of general interest to add https://clojure.github.io/clojure/clojure.java.browse-api.html to babashka? I ask because I’m writing a script that optionally launches a web browser. Not terrible for me if it does not make sense to add, just thought I’d ask.
It's not terribly important to me. The namespace has a weird dependency on java.awt.Desktop. This code could be problematic with GraalVM as well: https://github.com/clojure/clojure/blob/ef00c7cffad10e6104d333f7f71a29163b06cd0a/src/clj/clojure/java/browse.clj#L57-L64
My guess would be that if Clojure was written from scratch again, this might not get into the core
Could be wrong though. And I have used it in the past a couple of times. For bb it's probably not so hard to write a cross platform browser opening script, that calls open on macOS, xdg-open on linux, and start on Windows
oh indeed, it's used here: https://github.com/clojure/clojurescript/blob/1084cca73ac5082ae76f1939356f664f35284c4d/src/main/clojure/cljs/repl/browser.clj#L351
hmmm… looks like it more than just browsers in clojure too. It acts like open
on the mac. For example (browse/browse-url ".")
opens finder in the current directory.
@lee I would be open to a PR that adds clojure.java.browse/browse-url, but only shells out and doesn't use the reflection or swing stuff.
Made the issue here: https://github.com/borkdude/babashka/issues/495
@lee FWIW - open
and xdg-open
do all of this for you in OSX and Linux respectively, so could be just a one-liner. No idea about Windows
@lukaszkorecki @lee I've included clojure.java.browse/browse-url here now: https://clojurians.slack.com/archives/CSDUA8S6B/p1592905277013100 Feel free to give it a test run
Hmm:
C:\Users\borkdude\Downloads>bb -e "(require '[clojure.java.browse :refer [browse-url]]) (browse-url \"\")"
java.io.IOException: Cannot run program "start": CreateProcess error=2, The system cannot find the file specified [at line 1, column 54]
@U04V15CAJ, you are a dynamo! maybe start
is part of the shell and needs something like cmd /c start
also saw this nuance which might be relevant? https://superuser.com/a/1335757
thanks @lukaszkorecki, I’ve added your note to the issue.
yep, I also said that here: > that calls open on macOS, xdg-open on linux, and start on Windows https://clojurians.slack.com/archives/CLX41ASCS/p1592859104311400 🙂