Hi @borkdude this shebang.bat is helpful for my issues on the Powershell commandline?
If so how would I use it? An example would be nice if you can ๐
I have Babashka installed now and want to get the :args correct like this in Powershell:
clojure -X:new :template luminus :name yourname/example.webapp :output '"mywebapp"' :args '["+h2" "+http-kit"]'
I'm not having much luck though, it is becoming trial and error for me, I looked up Powershell escapes and it just seems to confuse me further. Here are my outputs so far:
Sorry, the shebang.bat script was just a general remark of how you could get a shebang working on Windows. It wasn't related to your problem.
@flyingpython I think this works:
bb -e "(map edn/read-string *command-line-args*)" '[\"foo\" \"bar\"]'
(["foo" "bar"])
OK thanks I'll give that a try ๐
deps.clj is now available as a babashka .bat script on Windows! The fastest way to get a Clojure REPL on Windows: curl -sLO https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.bat & deps
Honestly I don't think the -X API is better here: https://clojurians.slack.com/archives/CFN4QDHPS/p1617253963060700 I assume @flyingpython can still use the -main API @seancorfield ? I honestly don't think -X improves command line APIs in these cases. Why make it more complicated for users. I do understand the convenience of calling functions both from Clojure and the command line, but how much work is it really to maintain both and offer a good experience on the command line. I feel bad about seeing beginners struggle like this.
OK I checked the output like you showed me @borkdude and I think it is correct, though I am not sure what is correct from a Linux/Unix point of view so it makes it hard for me to tell, but at least I get a different error now though, maybe progress?:
clojure -X:new :template luminus :name Rowan/guestbook :output '"mywebapp"' :args '[\"+h2\" \"+http-kit\"]'
Generating a Luminus project.
Execution error (IllegalArgumentException) at leiningen.new.templates/->files (templates.clj:171).
No implementation of method: :as-file of protocol: #'<http://clojure.java.io/Coercions|clojure.java.io/Coercions> found for class: clojure.lang.Symbol
Full report at:
C:\Users\celap\AppData\Local\Temp\clojure-10223585383419122293.edn
I think probably it is best for me to stop stubbornly trying to get this working on Windows and just get WSL2 installed and try it from there. Unless there is a simple solution to the above error?what is :name
supported to be? maybe also a string?
name is the project name it should be in the folder structure generated by the template
(again: it makes me sad, angry, etc. that people have to go through this. just write an ff-ing command line interface!)
Hang on I just grab Sean's original example for you
clojure -X:new :template luminus :name yourname/example.webapp \
:output '"mywebapp"' :args '["+http-kit" "+h2" "+reagent" "+auth"]'
That slash in the middle is just a newline that Github puts there
So I take that out, didn't realise that at first and that gave me issues too ๐
I suspect this error is about the :name
, but I'm not sure.
Nah it's OK I think it's a lot of me being stubborn trying to do things above my level before I reach that level - I could easily do it with Leiningen but I like Sean's setup and deps.edn and the Clojure CLI
try :name '"Rowan/guestbook"'
OK I'll try that
No same error still so it's not that
Hmmm... @borkdude, youโve just convinced me to also support the regular cmd line in addition to -X for a tool I am writing. Its docs currently have a tip for Windows users saying โWindows users, trying to correctly escape -X args on the command line can lead to frustration. Consider instead specifying options under :exec-args in your :gen-doc-tests alias in deps.edn.โ
Imo regular command line has better UX as it's designed for... the command line, or at least up to the degree that people want to put effort into it. -X is convenient (for the author), but more limiting and frustrating when it comes to regular strings (be it top level strings or nested strings).
I just found on https://github.com/practicalli/clojure-deps-edn what I think you are referring to (the commandline interface I mean):
clojure -M:project/new luminus practicalli/full-stack-app +http-kit +h2 +reagent +auth
So it has no string stuff which might cause problems I guess is the point right, so an easier interface for users?
I think I better tell this Practicalli person whoever they are of the issues I had with this as they are supporting the edn argument passing method too and recommending that over the above.
So it might be wise to re-visit that recommendation in light of my experience with this?
yes!
OK I'm going to bed now but will look at grabbing this tomorrow and seeing if that works for me ๐
clojure -X:new :template luminus :name yourname/example.webapp :output '"mywebapp"' :args '["+http-kit" "+h2" "+reagent" "+auth"]'
clojure -M:project/new luminus practicalli/full-stack-app +http-kit +h2 +reagent +auth
Do you know this person? I think someone should link him/her to this and maybe we can change their recommendation on that
@jr0cket please read the conversation of yesterday and today and draw your own conclusions
Oh cool thanks!