Comments (11)
Hi Daniel. I'm glad you find this project helpful.
Use clj
and clojure
whenever possible. Period. The requirement is that your current shell is Powershell. This should be the default in most, if not all, useful cases.
But if your shell is cmd.exe
(aka Command Prompt), you won't be able to use clj
and clojure
because cmd.exe
know nothing about Powershell scripts aliases, etc. So these shims serve the purpose of the bridge. They are just executables that run intermediary Powershell with proper parameters for you.
Try it yourself. Launch Command Prompt (cmd.exe
) and try clj
and see what happens. Then the same with cmd-clj
.
If Emacs or VSCode launch a terminal with cmd.exe
as a shell, these shims become handy.
Hope it answers your question.
from scoop-clojure.
@chadkennedyonline There are reasons...
I can't put random files to shim directory on my own. It's managed by scoop based on the config from manifest file.
See "bin" section here:
scoop-clojure/bucket/clojure.json
Line 20 in 9dabceb
ad 1) You can do this entirely in Powershell and it's what you should use.
ad 2) Unfortunately yes. Until npm will be able to execute through powershell.
What you don't see is that clojure.bat and clj.bat would shadow powershell clojure
alias.
Powershell users would then run cmd.exe just to issue cmd-clojure which would launch powershell again with Invoke-Clojure
commandlet. Not very effective and who knows what breaks on the way. There is also quote escaping issue.
So yes, it's a small inconvenience with one (or two) .bat files copied over among projects once. But at least it's clear and relatively safe execution.
I may change my mind if I find better (non clashing) solution to this problem.
from scoop-clojure.
Thanks @littleli! I understand now.
Adding a little additional context here just for anyone with similar questions to my own:
-
clojure
andclj
were originally available from the cmd prompt through this package. They were removed due to this issue: #5 . -
cmd-clj
andcmd-clojure
were then added back in to try to provide something for cmd shell users, without breaking the powershell functionality
Moving forward, I'm going to investigate if npm or yarn can be forced to use powershell instead of cmd, either globally or (better) per project. A quick search shows it may be possible. If not, I'll stick to my 2 batch files. I'll probably move them into the project folder as suggested, so I'm not breaking anything that uses powershell.
EDIT: I can confirm that using scoop-clojure
in its stock configuration, along with running yarn config set script-shell powershell.exe
allowed me to run all the scripts in package.json
just fine!
from scoop-clojure.
EDIT: I can confirm that using
scoop-clojure
in its stock configuration, along with runningyarn config set script-shell powershell.exe
allowed me to run all the scripts inpackage.json
just fine!
@chadkennedyonline This is cool, it definitely helps.
You actually don't even need yarn
. You can setup npm
accordingly with something like this:
npm config set script-shell "C:\\Program Files\\PowerShell\\7\\pwsh.exe"
(my case)
from scoop-clojure.
@littleli Do you think it's worth adding something about using ... script-shell ...
to the README.md
? Or is this enough of an edge case to not want to add additional clutter?
from scoop-clojure.
Would it be possible to create a clojure.bat
and clj.bat
alongside cmd-clojure.exe
and cmd-clj.exe
? They would just contain something like @cmd-clojure %*
and @cmd-clj %*
respectively. I've been using a setup like this so I can run clojure
and clj
from cmd shell, and it's working pretty well for me so far.
from scoop-clojure.
@chadkennedyonline I understand your strugle, but I'm reluctant to add this. It's already confusing enough.
I read your case on Slack - and for other readers the use case is to launch clojure and clj commands from npm run scripts.
I was playing around a bit with this and I come with a nice tweak.
You can add clojure.bat and clj.bat to your npm project root and use it like this:
shelling $ ls
Directory: C:\Users\alesn\Projects\shelling
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 27.12.2021 18:50 15 clojure.bat
-a--- 27.12.2021 18:29 248 package.json
shelling $ cat .\clojure.bat
@cmd-clojure %*
shelling $ cat .\package.json
{
"name": "shelling",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"clojure": "clojure"
},
"keywords": [],
"author": "",
"license": "ISC"
}
shelling $ npm run clojure
> [email protected] clojure C:\Users\alesn\Projects\shelling
> clojure
Clojure 1.10.3
user=>
On Unices your commands should work from their particular locations, on Windows it will pick the batch files first.
Let me know if you like this proposal.
from scoop-clojure.
Hi @littleli! Thanks for the feedback! Clearly I'm just starting out on my Clojure adventure, and eager to learn!
I've essentially done exactly what you suggest, except clojure.bat
and clj.bat
live in the same folder as cmd-clj.exe
and cmd-clojure.exe
created by scoop (scoop\shims
).
This has two important upsides for me:
- I can follow along with Clojure tutorials, books, etc that call for making calls to clj or clojure . As you mentioned in your comment above, this can already by done via PowerShell. Maybe I'm an oddball, but I much prefer the cmd prompt to PowerShell. As a beginner, I was quite confused when I couldn't find any solutions out there to simply run
clojure
orclj
from the cmd prompt. Clearly though, I must be in the minority on this, since no such packaged solution exists, as far as I can find. - Any Clojure project that has scripts in their
package.json
that callclojure
orclj
will work. Under your proposal, I'd have to make these batch files for each project. Projects where this would be helpful.
So those are the upsides as I see them from my amateur perspective. Admittedly, I have no understanding of what all it's taken to get scoop-clojure
working on Windows up to this point. But I don't understand when you say "it's already confusing enough". Would you mind explaining a bit more how adding these bat files alongside the shims would add to confusion?
I'm certainly very grateful that scoop-clojure
exists, and for me, I'm perfectly happy to just use my 2 bat files as-is. But I am eager to learn if there are downsides to my approach.
from scoop-clojure.
@chadkennedyonline @dmg46664 Hi guys. I just want to let you know something about this issue is baking for this Christmas.
from scoop-clojure.
@littleli Good to know! But don't feel any pressure from me. I was temporarily a PC user when I wrote this up and was waiting for the M1 to come out 😋 I've also seen how well WSL works for many clj
use cases. Have a festive season!
from scoop-clojure.
ok, here we go. Current default method of getting Clojure on Windows is following:
scoop uninstall clojure
scoop install clj-deps
cmd-clojure
and cmd-clj
are gone, long live clj
and clojure
A lot of thanks has to go to @borkdude for deps.exe
and to @casselc for his work on msi installer which basically pushed me to resolve this.
from scoop-clojure.
Related Issues (16)
- Update to v1.10.1.672
- [email protected]: hash check failed HOT 1
- Suggestion: Automate bumps HOT 2
- Add suggestion to extras/vcredist2010
- clojure stuck at version 1.10.3.1040 -- can't upgrade, can't uninstall HOT 4
- Clojure On Main Bucket HOT 1
- [email protected]: hash check failed HOT 3
- Adhere to manifest schema
- [email protected]: hash check failed HOT 1
- Installation procedure ends up with "itcode" error
- Move Item error, when installing. HOT 8
- [Bug]: Command "scoop install clj-deps" returns with message "Couldn't find manifest for 'vcredist2015'." HOT 2
- scoop update clojure not seeing 1.10.1.483 version HOT 1
- [Bug]: Changing to new download location for Clojure CLI artifacts HOT 1
- Remove shim generation for clj/clojure HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scoop-clojure.