This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-07
Channels
- # announcements (1)
- # babashka (38)
- # beginners (21)
- # calva (1)
- # cider (6)
- # cljsrn (1)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (51)
- # clojurescript (2)
- # clr (100)
- # conjure (3)
- # core-typed (3)
- # data-science (2)
- # fulcro (21)
- # joker (1)
- # joyride (1)
- # lsp (7)
- # malli (4)
- # nbb (5)
- # reagent (1)
- # releases (1)
- # shadow-cljs (5)
- # spacemacs (5)
- # squint (5)
- # xtdb (16)
how do you guys set up a modeline in an extensionless file with a babashka shebang for vim?
Is this correct? #_" vim: set ft=clojure:"
. It works but I don't want anything extra
Out of curiosity, what does #_"
represent? I usually just go with the regular comment syntax for that given language, so ; vim: set ft=clojure:
@U7ERLH6JX might also know as a vim user
@U01KUQRDMLG standard clojure comment like the one @U0422G22932 said would work, (n)vim looks for set patterns in the first line, doesnt need to start with #
@U0422G22932 the #_
is the clojure reader dispatch character to ignore the next form. in this case the string following it
can comment out forms in a form like (-> foo (bar a) #_(baz b) (quz c))
cool thanks. @U04V15CAJ i think you use emacs. Do you do #_"..."
or ; -*- mode: clojure; -*-
?
Yeah #_
is nice because you can comment out a form that has other forms on the same line, or a form that spans lines
have used? Are you on vscode now? 😜
perfect tense implies an ended action
have been using vs. have used, the former adds a participle using to sort of reimply it's continuing 😛
Ah, you don't use standalone chmod +x bb scripts?
oh. Will check it out!
@U01KUQRDMLG Here are some of my scripts that you can install with bbin: https://github.com/borkdude/tools
cool thanks again
I think in emacs I just enable clojure-mode
manually as well, if needed. I add the mode-line for github highlighting though
I have a beginner-question on the organization of babashka-scripts. I have a big bucket of shell-scripts (bash) I want to reorganize and rewrite to bb. I'm used to just tossing all my scripts with a shebang and executable-flag into my $PATH, then invoking them directly from other shell-scripts. I'm not really sure how to transition into babashka for this, as requiring things involves the classpath, and including files via load-file suffers from relative path problems. I'm probably just missing some basic understanding, but how do you guys go about organizing these things? Ideally, I want to be able to write scripts as small and composable as possible, so managing metadata and deps (deps.edn, bb.edn) for every 2-3 lines of code seems heavy. Any tips or reading resources on how to approach this? I guess I could just throw a bb-shebang on them and toss them into $PATH as well, but then I'd be back to glueing them with stdout/stdin again. 🤷
I'd go with a ~/.bb.edn
maybe and refer all of these scripts as tasks. then have aliases to bb --config ~/.bb.edn <task-name>
You can do that but you can also just write libraries to compose things together and then make script entry points to call into those libraries.
Btw, I don't recommend putting a bb.edn in your home root folder, since clojure-lsp etc might recognize your entire home directory as a giant clojure project
yeah fair point
i have my aliases pointing to a dir of bb.edn and the tasks
I'm not sure I know what you mean with script entry point here, do you have any articles or reference-projects to illustrate?
@U0422G22932 an example is lein2deps, which itself is a library but the "front-end" script uses this library. The script lives here and can be installed using #babashka-bbin
bbin install
while the library code lives here:
https://github.com/borkdude/lein2depsThe front-end script is just a thin wrapper:
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {io.github.borkdude/lein2deps {:git/sha "60e33d969f624143f03ebd3456a703e68c8b9ab7"}}})
(require '[lein2deps.api])
(apply lein2deps.api/-main *command-line-args*)
@U7ERLH6JX’s approach works well if you're not planning to have your code on github etc, but even then you could use the "library" approach using :local/root
Everything will be on GitHub, my primary concern is just to keep the friction of producing new scripts as low as possible, without ending up with maven-style project hierarchies for what is basically a single, independent function. I guess I just need some more experience with building proper libraries
I'll take a look at your examples, yeah! Also, while you're here; I've been through several of your talks/podcasts, and I really appreciate your feedback and your work. Thank you!
if you're writing a tool that you want to install just once, maybe it makes sense to use #C03KJHCNZ99 to implement subcommands