Comments (16)
It could also be cool to add a run-as option of exec-cli
which wraps an exec using: https://github.com/babashka/cli so you can then pass it normal CLI args, even though the alias is an exec-fn.
from neil.
I'm not sure if we should re-invent the clojure CLI, but I think it would be powerful if neil offered some short-hands for things you can install with neil. E.g.:
neil add test
and then
neil test :only foo.bar
would translate into
clojure -M:test -n foo.bar
And similar for neil uberjar
-> clojure -T:build uber
from neil.
I agree that neil -x ...
could be a babashka.cli invocation of clojure -X ...
. What about aliases?
neil --aliases foo bar -x ...
? Or just neil -x:foo:bar
(this would not work very well with babashka CLI right now) ?
from neil.
Implemented neil test
now in 0.1.41.
from neil.
@borkdude @didibus: The neil test
command makes sense to me because it's a higher-level abstraction than what tools.deps
provides. Also, something like bb -x
makes sense to me because it's not a wrapper around tools.deps
.
When we add things like neil -x
, neil run-as tool build uber
, etc..., these are basically just another syntax for the clj
CLI, similar but potentially different enough to cause confusion. In my opinion, we should focus on providing higher-level abstractions on top of the API rather than providing syntax sugar for clj -X/-T/-M
, and encourage people to use clj
for running aliases.
Consider someone who is learning Clojure today. They can't avoid the clj
tool, but they also now need to be aware of projects that use neil
(and likely lein
, but that's a different issue) which will have a different way of invoking the same commands compared to clj
. I think they should just use clj
instead and neil
when they don't want to think about what clj
command to run or alias to add.
from neil.
I agree. So something like neil test
makes sense, maybe also neil uberjar
(assuming neil add build
was ran, similar to lein uberjar
).
from neil.
Another suggestion: neil
could support running Babashka tasks in bb.edn
like bb test
or bb uberjar
. Then it's the job of bb.edn
to figure out what options to pass into the clj
command. That way the user could still rely on things like neil test
or neil uberjar
but it would ultimately be under their control.
To expand on this, maybe neil test
would provide the current default behavior, but could be overridden as a bb
task if needed. Just an idea though, need to think about this some more.
from neil.
I think typing neil test
vs bb test
doesn't have much benefit.
Btw, I do see a benefit in having arguments run through babashka.cli first before they are passed to the clojure CLI, since the clojure CLI demands you to quote things as EDN first which is problematic for some people (on Windows, but also when you use $(...)
in the middle of an argument).
E.g. neil tool install --git/url .. git/tag .. --as foo
could work instead of clj -Ttool install '{:git/url "... "}' :as foo
which is very hard to figure out in Powershell for example.
from neil.
I think typing neil test vs bb test doesn't have much benefit.
Yeah, I think you're right. It even takes more characters! So with that in mind, my stance is that people should run their tasks directly with bb
and clj
when possible. That way we encourage people to learn the base tools and not hide them with neil
.
Btw, I do see a benefit in having arguments run through babashka.cli first before they are passed to the clojure CLI, since the clojure CLI demands you to quote things as EDN first which is problematic for some people (on Windows, but also when you use $(...) in the middle of an argument).
That makes sense. I think if there was one command that did this for all possible invocations of clj
/clojure
, basically a "transpiler" from the babashka.cli to Clojure CLI, that would be simpler than trying to create specific commands for generic operations like run-as
. That said, even if we don't end up doing that (which would be fine with me), adding commands for specific aliases like neil tool
seems like a reasonable compromise.
from neil.
I think it would even make more sense if we supported:
clojure -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.13"}' :as new
vs
neil tool install io.github.seancorfield/deps-new :as new
and neil picked the most recent version by default. So, not only transpiling, but also offering some convenience.
from neil.
and once that's supported, perhaps:
neil run new app --foo 1 --bar 2
where run
is short for clojure -Tnew
or something.
So: not only a simple transpilation, but convenience which justifies this feature.
from neil.
Another idea:
# Equivalent commands
# Note: `neil new` doesn't use the `clj` command, but the output should be the same
$ neil new app my-app --foo 1 --bar 2
$ neil clj -Tnew app my-app --foo 1 --bar 2
$ clj -Tnew app my-app :foo 1 :bar 2
# Equivalent commands
$ neil tool install io.github.seancorfield/deps-new --as new
$ neil tool install io.github.seancorfield/deps-new --git/tag v0.4.13 --as new
$ neil clojure -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.13"}' --as new
$ clojure -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.13"}' :as new
In this example, the sole purpose of the neil clj
and neil clojure
commands is to provide babashka.cli
integration.
For abstractions on top of clj
/clojure
, the specific top-level commands (neil tool
, neil new
) can include additional functionality such as inferring the deps info from the lib name.
from neil.
One issue I see with Clojure CLI is that running an alias is kind of complicated. You have to figure out if it's supposed to be used with -X or -T or -T: or -M, which means you almost always have to inspect the deps.edn to remember how to call the alias. And then even if you know how to call it, the invokation is extra long and cryptic and escaping options is more difficult than standard Unix.
This is why you added neil new
and neil test
no?
But instead of eventually adding a special command for every common alias that comes into existence so that beginners have an easier way to remember and call those aliases. Why not make it generic that all aliases automatically becomes neil commands?
Say I want to add antq
for checking outdated deps:
neil tools install-latest --lib com.github.liquidz/antq --as antq
neil antq outdated
Alternatively I create an issue in neil and ask to add neil outdated
as a command.
I still think it makes sense to have the most common aliases lifted into neil
itself so that it auto-injects the alias and so standardizes things in a way, but having a generic "alias" is automatically a "command" of neil seems to fill the gap, and I think you could then replace all usage of Clojure CLI related to build with neil.
from neil.
An alias can support both -X and -M. In fact, the test alias added by neil can be run in both ways. So there is no automatic way of detecting that. I think standardizing the way neil behaves is the best way forward.
from neil.
An alias can support both -X and -M. In fact, the test alias added by neil can be run in both ways. So there is no automatic way of detecting that.
That's true, but like I mentioned, it could either prompt or we can use an extra key on the alias to specify which one neil should use like so:
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.3" :git/sha "0d20256"}}
:ns-default build
:neil/run-as :tool}
I think standardizing the way neil behaves is the best way forward.
It's possible as well. I was hoping more for a Clojure CLI but with better command line UX. But also possibly if neil just covers 99% of all common commands just in a standard way it brings most of the same benefits with less effort and complexity, because then I only need to reach for Clojure CLI in exceptional cases. As always, I trust your judgement.
from neil.
From 0.1.43 on neil saves data in {:aliases {:neil {:project ...}}}
. Using that data, we could have some more possibilities here (not sure what precisely).
E.g. the project name is saved under :name myorg/mylib
.
I'm planning to put :version ...
there too and have a neil version patch
command which increments the patch version, etc. Similar to what npm does. Npm also adds a tag for the version but I think we could have that as a separate neil tag
command which creates a git tag for the {:project {:version ...}}
.
from neil.
Related Issues (20)
- `neil new` crashes on certain forms of invalid input HOT 2
- Add `neil add tasks` too. HOT 1
- `neil new` puts `:neil :project :name ,,,` indented behind `:aliases :build :nsdefault` HOT 6
- Make `:version` consistent over `search` and `dep add` commands HOT 1
- neil does not find a newer version of a library that antq does HOT 2
- `neil new`: Support Git repos without tags
- add support to add files which describe "development" environments HOT 2
- Error on dep update HOT 1
- Unable to install `com.cnuernber/ham-fisted` with Neil 0.1.59 HOT 2
- `neil dep upgrade` should update unstable versions HOT 2
- Error when running `neil --version` on versions `>=0.1.58` HOT 1
- Suggestion: `neil dep local <lib> <path>` HOT 2
- neil dep upgrade drops dep :exclusions HOT 2
- Neil completely crashes on fresh install HOT 24
- `neil dep add` exits with code 0 on both failure and success HOT 1
- Neil new behaviour different for windows HOT 4
- NPE on `neil dep upgrade ` HOT 5
- suggestion: support `neil add nrepl -with-cider` HOT 3
- Documentation: add git as a requirement HOT 1
- Feature request: a flag that does what `dep search` already does, but works for multiple artifacts and outputs a string suitable for `-Sdeps` HOT 3
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 neil.